brapi 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/MIT-LICENSE +20 -0
- data/README.md +76 -0
- data/Rakefile +1 -0
- data/brapi.gemspec +30 -0
- data/lib/brapi/base_model.rb +7 -0
- data/lib/brapi/client.rb +28 -0
- data/lib/brapi/errors.rb +5 -0
- data/lib/brapi/version.rb +3 -0
- data/lib/brapi/zipcode.rb +6 -0
- data/lib/brapi.rb +8 -0
- data/spec/brapi/base_model_spec.rb +19 -0
- data/spec/brapi/client_spec.rb +66 -0
- data/spec/brapi/zipcode_spec.rb +16 -0
- data/spec/fixtures/vcr_cassettes/Brapi/Client/zipcode/invalid.yml +42 -0
- data/spec/fixtures/vcr_cassettes/Brapi/Client/zipcode/valid.yml +63 -0
- data/spec/spec_helper.rb +24 -0
- metadata +199 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8e7a05c34b5b27aeb5fc26e85db5eea4bdee1854
|
4
|
+
data.tar.gz: 1fb58149c3dc35257b8cec3400fef5d344424bc9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a3f7a33b3be11c8fe1b5635edef028455c56a3f85c580b0c3869496bc3aa800e34d6494c3d2deeb3ec78f8711081e536765740a4fb6ac3c0d3d9a2d3f6ba98cc
|
7
|
+
data.tar.gz: e94c501786a9ac378c789c04043da164cf737eeed7c9be8cb54b5d3bbe829846eb486ecf79dad2b87a305e8c4f6819e733e0d498008178ffd7341093f6f99db3
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
brapi-rubygem
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.0
|
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
We love pull requests. Here's a quick guide:
|
4
|
+
|
5
|
+
1. Fork the repo.
|
6
|
+
|
7
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
8
|
+
|
9
|
+
3. Run the tests. We only take pull requests with passing tests, and it's great
|
10
|
+
to know that you have a clean slate: `bundle && rake`
|
11
|
+
|
12
|
+
4. Add a test for your change. Only refactoring and documentation changes
|
13
|
+
require no new tests. If you are adding functionality or fixing a bug, we need
|
14
|
+
a test!
|
15
|
+
|
16
|
+
5. Make the test pass.
|
17
|
+
|
18
|
+
6. Update [CHANGELOG.md](https://github.com/Helabs/brapi-ruby/blob/master/CHANGELOG.md) with a brief description of your changes under the `unreleased` heading.
|
19
|
+
|
20
|
+
7. Commit your changes (`git commit -am 'Added some feature'`)
|
21
|
+
|
22
|
+
8. Push to the branch (`git push origin my-new-feature`)
|
23
|
+
|
24
|
+
9. Create new Pull Request
|
25
|
+
|
26
|
+
At this point you're waiting on us. We like to at least comment on, if not
|
27
|
+
accept, pull requests within three business days (and, typically, one business
|
28
|
+
day). We may suggest some changes or improvements or alternatives.
|
29
|
+
|
30
|
+
Some things that will increase the chance that your pull request is accepted is to follow the practices described on [Ruby style guide](https://github.com/bbatsov/ruby-style-guide), [Rails style guide](https://github.com/bbatsov/rails-style-guide) and [Better Specs](http://betterspecs.org/).
|
31
|
+
|
32
|
+
# Testing
|
33
|
+
|
34
|
+
To run the tests you'll need to have an `access_token`. Create a `.env` file on the root of the gem and put your access_token there. This file is not commited into the repo to keep theses private credentials safe.
|
35
|
+
|
36
|
+
```
|
37
|
+
BRAPI_ACCESS_TOKEN: your-token-here
|
38
|
+
```
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Matheus Bras
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 HE:labs
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Brapi.io Ruby Client
|
2
|
+
|
3
|
+
Ruby gem to interact with the brapi.io APIs
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'brapi'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install brapi
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Initializing the client
|
22
|
+
|
23
|
+
You will need to have your account's access_token to be able to interact with the API. You also need to set an 'User-Agent' to identify your application.
|
24
|
+
|
25
|
+
```
|
26
|
+
access_token = 'your-access-token'
|
27
|
+
user_agent = 'Your Application Name (youremail@provider.com)'
|
28
|
+
|
29
|
+
client = Brapi::Client.new(access_token, user_agent)
|
30
|
+
```
|
31
|
+
|
32
|
+
### Zipcodes
|
33
|
+
|
34
|
+
You can search for zipcodes by using the `#zipcode` method on the client. This method will return an instance of `Brapi::Zipcode` so you can use it like a plain Ruby object.
|
35
|
+
|
36
|
+
```
|
37
|
+
# ... Instantiate the client
|
38
|
+
|
39
|
+
client.zipcode(20061003)
|
40
|
+
=> #<Brapi::Zipcode:0x007fbbf50eb4e8
|
41
|
+
@address="Presidente Vargas",
|
42
|
+
@address_type="Avenida",
|
43
|
+
@city="Rio de Janeiro",
|
44
|
+
@city_ibge_code="3304557",
|
45
|
+
@neighborhood="Centro",
|
46
|
+
@state="RJ",
|
47
|
+
@zipcode="20071003">
|
48
|
+
```
|
49
|
+
|
50
|
+
## Versioning
|
51
|
+
|
52
|
+
Brapi.io Ruby Client follow the [Semantic Versioning](http://semver.org/).
|
53
|
+
|
54
|
+
## Issues
|
55
|
+
|
56
|
+
If you have problems, please create a [Github Issue](https://github.com/Helabs/brapi-ruby/issues).
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
Please see [CONTRIBUTING.md](https://github.com/Helabs/brapi-ruby/blob/master/CONTRIBUTING.md) for details.
|
61
|
+
|
62
|
+
## Release
|
63
|
+
|
64
|
+
Follow this steps to release a new version of the gem.
|
65
|
+
|
66
|
+
1. Test if everything is running ok;
|
67
|
+
1. Change version of the gem on `VERSION` constant;
|
68
|
+
1. Add the release date on the `CHANGELOG`;
|
69
|
+
1. Do a commit "Bump version x.x.x", follow the semantic version;
|
70
|
+
1. Run `$ rake release`, this will send the gem to the rubygems;
|
71
|
+
1. Check if the gem is on the rubygems and the tags are correct on the github;
|
72
|
+
|
73
|
+
## Credits
|
74
|
+
|
75
|
+
Brapi.io Ruby Client is maintained and funded by [HE:labs](http://helabs.com.br/opensource/).
|
76
|
+
Thank you to all the [contributors](https://github.com/Helabs/brapi-ruby/graphs/contributors).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/brapi.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'brapi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'brapi'
|
8
|
+
spec.version = Brapi::VERSION
|
9
|
+
spec.authors = ['Matheus Bras']
|
10
|
+
spec.email = ['bras.matheus@gmail.com']
|
11
|
+
spec.summary = %q{A Ruby wrapper for brapi.io}
|
12
|
+
spec.description = %q{A Ruby wrapper for brapi.io}
|
13
|
+
spec.homepage = 'https://github.com/Helabs/brapi-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '1.5.2'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rspec', '2.14.1'
|
24
|
+
spec.add_development_dependency 'dotenv', '0.9.0'
|
25
|
+
spec.add_development_dependency 'vcr', '2.8.0'
|
26
|
+
spec.add_development_dependency 'webmock', '1.17.2'
|
27
|
+
spec.add_development_dependency 'pry'
|
28
|
+
spec.add_runtime_dependency 'rest-client', '1.6.7'
|
29
|
+
spec.add_runtime_dependency 'json'
|
30
|
+
end
|
data/lib/brapi/client.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Brapi
|
2
|
+
class Client
|
3
|
+
|
4
|
+
def initialize(access_token, user_agent)
|
5
|
+
@access_token = access_token
|
6
|
+
@user_agent = user_agent
|
7
|
+
end
|
8
|
+
|
9
|
+
def zipcode(zipcode)
|
10
|
+
endpoint = "#{base_uri}/zipcodes/#{zipcode}.json"
|
11
|
+
RestClient.get(endpoint, { accept: :json, content_type: :json, 'User-Agent' => user_agent }) do |response|
|
12
|
+
case response.code
|
13
|
+
when 200
|
14
|
+
Brapi::Zipcode.new(JSON.parse(response))
|
15
|
+
else
|
16
|
+
raise Brapi::Error, response
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
attr_reader :access_token, :user_agent
|
23
|
+
|
24
|
+
def base_uri
|
25
|
+
"https://x:#{access_token}@brapi.herokuapp.com/api/v1"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/brapi/errors.rb
ADDED
data/lib/brapi.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Brapi::BaseModel do
|
4
|
+
class FakeModel < Brapi::BaseModel
|
5
|
+
attr_accessor :id
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#initialize' do
|
9
|
+
let(:model) { FakeModel.new({ id: '1', name: 'fake_model' }) }
|
10
|
+
|
11
|
+
it 'sets the id on the model' do
|
12
|
+
expect(model.id).to eq('1')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'does not set the name on the model' do
|
16
|
+
expect(model).to_not respond_to(:name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Brapi::Client do
|
4
|
+
|
5
|
+
describe '#zipcode' do
|
6
|
+
let(:client) { Brapi::Client.new(ENV['BRAPI_ACCESS_TOKEN'], 'User-Agent') }
|
7
|
+
|
8
|
+
context 'valid zipcode', vcr: { cassette_name: 'Brapi/Client/zipcode/valid' } do
|
9
|
+
let(:zipcode) { "6720050" }
|
10
|
+
|
11
|
+
it 'returns an instance of Brapi::Zipcode' do
|
12
|
+
expect(client.zipcode(zipcode)).to be_an_instance_of(Brapi::Zipcode)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'pass correct headers' do
|
16
|
+
RestClient.should_receive(:get).with(anything, { accept: :json, content_type: :json, 'User-Agent' => 'User-Agent' })
|
17
|
+
client.zipcode(zipcode)
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'Brapi::Zipcode attributes' do
|
21
|
+
|
22
|
+
subject do
|
23
|
+
client.zipcode(zipcode)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'have correct zipcode' do
|
27
|
+
expect(subject.zipcode).to eq('6720050')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'have correct address' do
|
31
|
+
expect(subject.address).to eq('Ciro Monteiro')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'have correct address_type' do
|
35
|
+
expect(subject.address_type).to eq('Rua')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'have correct city' do
|
39
|
+
expect(subject.city).to eq('Cotia')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'have correct city_ibge_code' do
|
43
|
+
expect(subject.city_ibge_code).to eq('3513009')
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'have correct neighborhood' do
|
47
|
+
expect(subject.neighborhood).to eq('Parque Mirante da Mata')
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'have correct state' do
|
51
|
+
expect(subject.state).to eq('SP')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'invalid zipcode', vcr: { cassette_name: 'Brapi/Client/zipcode/invalid' } do
|
57
|
+
let(:zipcode) { 'ABS' }
|
58
|
+
|
59
|
+
it 'raises a Brapi::Error' do
|
60
|
+
expect do
|
61
|
+
client.zipcode(zipcode)
|
62
|
+
end.to raise_error(Brapi::Error, %({"status":"404","error":"Not Found"}))
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Brapi::Zipcode do
|
4
|
+
describe 'attributes' do
|
5
|
+
let(:zipcode) { Brapi::Zipcode.new({}) }
|
6
|
+
|
7
|
+
subject do
|
8
|
+
zipcode
|
9
|
+
end
|
10
|
+
|
11
|
+
%w[zipcode address_type address state city neighborhood city city_ibge_code].each do |attr|
|
12
|
+
it { should respond_to(attr) }
|
13
|
+
it { should respond_to("#{attr}=") }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://x:<BRAPI_ACCESS_TOKEN>@brapi.herokuapp.com/api/v1/zipcodes/ABS.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
User-Agent:
|
17
|
+
- User-Agent
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 404
|
21
|
+
message: Not Found
|
22
|
+
headers:
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Date:
|
26
|
+
- Wed, 05 Feb 2014 13:13:51 GMT
|
27
|
+
Status:
|
28
|
+
- 404 Not Found
|
29
|
+
X-Request-Id:
|
30
|
+
- badd211b-b8d8-432c-a579-61e23fba9cda
|
31
|
+
X-Runtime:
|
32
|
+
- '1.136146'
|
33
|
+
Content-Length:
|
34
|
+
- '36'
|
35
|
+
Connection:
|
36
|
+
- keep-alive
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: "{\"status\":\"404\",\"error\":\"Not Found\"}"
|
40
|
+
http_version:
|
41
|
+
recorded_at: Wed, 05 Feb 2014 13:13:52 GMT
|
42
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,63 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://x:<BRAPI_ACCESS_TOKEN>@brapi.herokuapp.com/api/v1/zipcodes/6720050.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
User-Agent:
|
17
|
+
- User-Agent
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- max-age=0, private, must-revalidate
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Date:
|
28
|
+
- Wed, 05 Feb 2014 13:13:49 GMT
|
29
|
+
Etag:
|
30
|
+
- "\"186c04cfe69b92b322d8069ad1d1d468\""
|
31
|
+
Last-Modified:
|
32
|
+
- Wed, 29 Jan 2014 12:37:57 GMT
|
33
|
+
Set-Cookie:
|
34
|
+
- request_method=GET; path=/
|
35
|
+
Status:
|
36
|
+
- 200 OK
|
37
|
+
X-Content-Type-Options:
|
38
|
+
- nosniff
|
39
|
+
X-Frame-Options:
|
40
|
+
- SAMEORIGIN
|
41
|
+
X-Ratelimit-Limit:
|
42
|
+
- '500'
|
43
|
+
X-Ratelimit-Remaining:
|
44
|
+
- '499'
|
45
|
+
X-Request-Id:
|
46
|
+
- d4304cef-58ad-46d4-9d37-efbc3895ed9c
|
47
|
+
X-Runtime:
|
48
|
+
- '0.721375'
|
49
|
+
X-Ua-Compatible:
|
50
|
+
- chrome=1
|
51
|
+
X-Xss-Protection:
|
52
|
+
- 1; mode=block
|
53
|
+
Transfer-Encoding:
|
54
|
+
- chunked
|
55
|
+
Connection:
|
56
|
+
- keep-alive
|
57
|
+
body:
|
58
|
+
encoding: UTF-8
|
59
|
+
string: "{\"zipcode\":\"6720050\",\"address_type\":\"Rua\",\"address\":\"Ciro
|
60
|
+
Monteiro\",\"neighborhood\":\"Parque Mirante da Mata\",\"city\":\"Cotia\",\"city_ibge_code\":\"3513009\",\"state\":\"SP\"}"
|
61
|
+
http_version:
|
62
|
+
recorded_at: Wed, 05 Feb 2014 13:13:50 GMT
|
63
|
+
recorded_with: VCR 2.8.0
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.require(:default, :development)
|
3
|
+
|
4
|
+
require 'dotenv'
|
5
|
+
Dotenv.load
|
6
|
+
|
7
|
+
require 'brapi'
|
8
|
+
require 'vcr'
|
9
|
+
|
10
|
+
VCR.configure do |c|
|
11
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
12
|
+
c.hook_into :webmock
|
13
|
+
c.configure_rspec_metadata!
|
14
|
+
c.filter_sensitive_data('<BRAPI_ACCESS_TOKEN>') { ENV['BRAPI_ACCESS_TOKEN'] }
|
15
|
+
end
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
config.order = 'random'
|
19
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
20
|
+
|
21
|
+
config.expect_with :rspec do |c|
|
22
|
+
c.syntax = :expect
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brapi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matheus Bras
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.5.2
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.5.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.14.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.14.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dotenv
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.8.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.8.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.17.2
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.17.2
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rest-client
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.6.7
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.6.7
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: json
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: A Ruby wrapper for brapi.io
|
140
|
+
email:
|
141
|
+
- bras.matheus@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".ruby-gemset"
|
148
|
+
- ".ruby-version"
|
149
|
+
- CHANGELOG.md
|
150
|
+
- CONTRIBUTING.md
|
151
|
+
- Gemfile
|
152
|
+
- LICENSE.txt
|
153
|
+
- MIT-LICENSE
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- brapi.gemspec
|
157
|
+
- lib/brapi.rb
|
158
|
+
- lib/brapi/base_model.rb
|
159
|
+
- lib/brapi/client.rb
|
160
|
+
- lib/brapi/errors.rb
|
161
|
+
- lib/brapi/version.rb
|
162
|
+
- lib/brapi/zipcode.rb
|
163
|
+
- spec/brapi/base_model_spec.rb
|
164
|
+
- spec/brapi/client_spec.rb
|
165
|
+
- spec/brapi/zipcode_spec.rb
|
166
|
+
- spec/fixtures/vcr_cassettes/Brapi/Client/zipcode/invalid.yml
|
167
|
+
- spec/fixtures/vcr_cassettes/Brapi/Client/zipcode/valid.yml
|
168
|
+
- spec/spec_helper.rb
|
169
|
+
homepage: https://github.com/Helabs/brapi-ruby
|
170
|
+
licenses:
|
171
|
+
- MIT
|
172
|
+
metadata: {}
|
173
|
+
post_install_message:
|
174
|
+
rdoc_options: []
|
175
|
+
require_paths:
|
176
|
+
- lib
|
177
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
requirements: []
|
188
|
+
rubyforge_project:
|
189
|
+
rubygems_version: 2.2.0.rc.1
|
190
|
+
signing_key:
|
191
|
+
specification_version: 4
|
192
|
+
summary: A Ruby wrapper for brapi.io
|
193
|
+
test_files:
|
194
|
+
- spec/brapi/base_model_spec.rb
|
195
|
+
- spec/brapi/client_spec.rb
|
196
|
+
- spec/brapi/zipcode_spec.rb
|
197
|
+
- spec/fixtures/vcr_cassettes/Brapi/Client/zipcode/invalid.yml
|
198
|
+
- spec/fixtures/vcr_cassettes/Brapi/Client/zipcode/valid.yml
|
199
|
+
- spec/spec_helper.rb
|