Socket
Book a DemoInstallSign in
Socket

infosimples-data

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

infosimples-data

2.0.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Infosimples::Data

Ruby API for Infosimples::Data (https://infosimples.com/).

Installation

Add this line to your application's Gemfile:

gem 'infosimples-data'

And then execute:

$ bundle

Or install it yourself as:

$ gem install infosimples-data

Usage

  • Create a client
require 'infosimples/data'
client = Infosimples::Data::Client.new('my_token')
  • Automate a service
response = client.automate('correios/cep', cep: '01311915')
response['code']                  # 200
response['code_message']          # "A consulta foi realizada com sucesso e retornou um resultado."
response['data']                  # Information about the postal code
response['receipt']['sites_urls'] # Links for the original HTMLs.

client.download_sites_urls(response) # Array with HTML bodies for `sites_urls`.

Check the full response in our documentation: https://data.infosimples.com/docs

  • Billing
billing = client.billing          # Array of Hashes with:
billing.first['name']             # - Name of the Token
billing.first['quantity']         # - Number of automation requests the token has made
billing.first['credits']          # - How many credits the token has used
  • Pricing
pricing = client.pricing          # Array of Hashes with:
pricing.first['service']          # - Name of the service that can be automated
pricing.first['credits']          # - How many credits this service uses
  • Response codes
# Check a response code:
response['code'] == Infosimples::Data::CODE[:single_result]

# List of codes
{
  # success
  single_result:          200,
  multiple_results:       201,

  # error
  unexpected_error:       600,
  unauthorized:           601,
  invalid_service:        602,
  forbidden:              603,
  invalid_request:        604,
  timeout:                605,
  empty_parameters:       606,
  invalid_parameters:     607,
  refused_parameters:     608,
  attempts_exceeded:      609,
  failed_captcha:         610,
  incomplete_data:        611,
  inexistent:             612,
  blocked_request:        613,
  try_again:              614,
  source_unavailable:     615,
  source_error:           616,
  service_overloaded:     617,
  rate_limit_exceeded:    618,
  converted_parameters:   619,
  permanent_error:        620,
  receipt_error:          621,
}

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/infosimples/infosimples-data.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 27 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.