getnet_api 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d03fd2ae26025e8728fca764861e8f328fe9b5af
4
- data.tar.gz: 8b0af9f78626a13ab70a4e2272fc90526887cead
2
+ SHA256:
3
+ metadata.gz: b083288e0b0ceb66b96ec653754a6ef21f464987b09ec56d05713308a61ac5e8
4
+ data.tar.gz: 249bf80e84152c593846858e785c1762c3bcb75fd0ac6dc926dfcb588de2c641
5
5
  SHA512:
6
- metadata.gz: 8b755becd2cc848759b252d2a15bf9326ba31cd88dddd0fbd934aaec1bff8629acecaf2a2457904a61bba9110bea7c28b10f15c27dc9399dbe1e4b79c49fa572
7
- data.tar.gz: 093fcda3eb0c2554d0c1c910bcca079ef8282ecc053ae7b65e3f3db081ba17c04145c14195c4a579907f823675425d2d0249ed8a53682be26b14a1e7a6514bd5
6
+ metadata.gz: 152b4a70325e83ff21d558ebe801299f347b621735276226cbff7af16dc09d89c3ed6e0a1effe10fd720d0ea7454afcf3c3d536690a7800ea51b38c92676756a
7
+ data.tar.gz: 7f2f0f5338c61b5874a1f45973a0f8d64f304de1975d5d081ce5813ae7fba05af382966e5d3f2e47e1e0e8841e1f47b133edfc1414490a9b4d511cb8366c2ad8
@@ -0,0 +1,28 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - uses: actions/setup-ruby@v1
22
+ with:
23
+ ruby-version: '2.6'
24
+ - name: Install dependencies
25
+ run: bundle install
26
+ - name: Run tests
27
+ run: bundle exec rspec
28
+
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/Gemfile CHANGED
@@ -1,2 +1,12 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
  gemspec
5
+ gem 'activemodel'
6
+
7
+ group :test do
8
+ gem 'pry', '~> 0.13.1'
9
+ gem 'rspec'
10
+ gem 'vcr'
11
+ gem 'webmock'
12
+ end
data/Gemfile.lock CHANGED
@@ -1,33 +1,86 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- getnet_api (0.1.1)
4
+ getnet_api (1.0.1)
5
5
  rest-client (>= 1.7.3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- domain_name (0.5.20180417)
10
+ activemodel (6.1.3.1)
11
+ activesupport (= 6.1.3.1)
12
+ activesupport (6.1.3.1)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ addressable (2.7.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ coderay (1.1.3)
21
+ concurrent-ruby (1.1.8)
22
+ crack (0.4.3)
23
+ safe_yaml (~> 1.0.0)
24
+ diff-lcs (1.4.4)
25
+ domain_name (0.5.20190701)
11
26
  unf (>= 0.0.5, < 1.0.0)
27
+ hashdiff (1.0.0)
28
+ http-accept (1.7.0)
12
29
  http-cookie (1.0.3)
13
30
  domain_name (~> 0.5)
14
- mime-types (3.2.2)
31
+ i18n (1.8.10)
32
+ concurrent-ruby (~> 1.0)
33
+ method_source (1.0.0)
34
+ mime-types (3.3.1)
15
35
  mime-types-data (~> 3.2015)
16
- mime-types-data (3.2018.0812)
36
+ mime-types-data (3.2021.0225)
37
+ minitest (5.14.4)
17
38
  netrc (0.11.0)
18
- rest-client (2.0.2)
39
+ pry (0.13.1)
40
+ coderay (~> 1.1)
41
+ method_source (~> 1.0)
42
+ public_suffix (4.0.6)
43
+ rest-client (2.1.0)
44
+ http-accept (>= 1.7.0, < 2.0)
19
45
  http-cookie (>= 1.0.2, < 2.0)
20
46
  mime-types (>= 1.16, < 4.0)
21
47
  netrc (~> 0.8)
48
+ rspec (3.10.0)
49
+ rspec-core (~> 3.10.0)
50
+ rspec-expectations (~> 3.10.0)
51
+ rspec-mocks (~> 3.10.0)
52
+ rspec-core (3.10.1)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-expectations (3.10.1)
55
+ diff-lcs (>= 1.2.0, < 2.0)
56
+ rspec-support (~> 3.10.0)
57
+ rspec-mocks (3.10.2)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.10.0)
60
+ rspec-support (3.10.2)
61
+ safe_yaml (1.0.5)
62
+ tzinfo (2.0.4)
63
+ concurrent-ruby (~> 1.0)
22
64
  unf (0.1.4)
23
65
  unf_ext
24
- unf_ext (0.0.7.5)
66
+ unf_ext (0.0.7.7)
67
+ vcr (6.0.0)
68
+ webmock (3.7.1)
69
+ addressable (>= 2.3.6)
70
+ crack (>= 0.3.2)
71
+ hashdiff (>= 0.4.0, < 2.0.0)
72
+ zeitwerk (2.4.2)
25
73
 
26
74
  PLATFORMS
27
75
  ruby
28
76
 
29
77
  DEPENDENCIES
78
+ activemodel
30
79
  getnet_api!
80
+ pry (~> 0.13.1)
81
+ rspec
82
+ vcr
83
+ webmock
31
84
 
32
85
  BUNDLED WITH
33
- 1.16.4
86
+ 1.17.3
data/README.md CHANGED
@@ -177,8 +177,12 @@ cancelamento = GetnetApi::PaymentCancel.create obj_cancelamento
177
177
 
178
178
  - [QW3 Software & Marketing](http://qw3.com.br)
179
179
  - [Leandro dos Santos Falcão](https://www.linkedin.com/in/lsfalcao)
180
+
181
+ ## Contributors
182
+
180
183
  - [Victor Barreiros](www.linkedin.com/in/victor-barreiros)
181
184
  - [Daniel B. Brumazzi](https://www.linkedin.com/in/daniel-brumazzi-2153707b/)
185
+ - [eduardosleite](https://github.com/eduardosleite)
182
186
 
183
187
  ## Copyright
184
188
 
data/lib/getnet_api.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'rubygems'
3
3
  require 'active_model'
4
+ require 'active_support/time'
5
+ require 'json'
4
6
 
5
7
  require "getnet_api/version"
6
8
  require "getnet_api/configure"
@@ -98,7 +98,7 @@ module GetnetApi
98
98
  end
99
99
 
100
100
  def base_uri
101
- return "#{self.endpoint}/#{self.api_version}/"
101
+ return "#{self.endpoint}/#{self.api_version}"
102
102
  end
103
103
 
104
104
  end
@@ -42,7 +42,7 @@ module GetnetApi
42
42
 
43
43
  private
44
44
  def self.endpoint payment_id
45
- "payments/cancel/request"
45
+ "payments/credit/#{payment_id}/cancel"
46
46
  end
47
47
  end
48
48
  end
@@ -3,7 +3,7 @@ module GetnetApi
3
3
  module Version
4
4
  MAJOR = 1
5
5
  MINOR = 0
6
- PATCH = 2
6
+ PATCH = 3
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
8
  end
9
9
  end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GetnetApi::Base do
4
+ describe '.build_request' do
5
+ it 'builds and executes request based on' do
6
+ VCR.use_cassette 'getnet_api/base/build_request' do
7
+ GetnetApi.ambiente = :sandbox
8
+ response = GetnetApi::Base.build_request 'some_endpoint', 'get'
9
+ expect(response).to be_a Net::HTTPNotFound
10
+ expected_uri = 'https://api-sandbox.getnet.com.br/v1/some_endpoint'
11
+ expect(WebMock).to have_requested(:get, expected_uri)
12
+ end
13
+ end
14
+ end
15
+
16
+ describe '.default_headers' do
17
+ let(:dummy_url) { 'someurl.com' }
18
+ let(:dummy_request) { Net::HTTP::Get.new(dummy_url) }
19
+ it 'creates headers for request' do
20
+ VCR.use_cassette 'getnet_api/base/valid_bearer' do
21
+ request = GetnetApi::Base.default_headers dummy_request
22
+ expected_auth = "Bearer #{GetnetApi::Base.valid_bearer}"
23
+ expect(request['authorization']).to eq expected_auth
24
+ expect(request['Content-Type']).to eq 'application/json'
25
+ expect(request['seller_id']).to eq GetnetApi.seller_id
26
+ end
27
+ end
28
+ end
29
+
30
+ describe '.valid_bearer' do
31
+ context 'when token is expired' do
32
+ it 'requests for new access token' do
33
+ VCR.use_cassette 'getnet_api/base/valid_bearer' do
34
+ GetnetApi.expires_in = nil
35
+ expect(GetnetApi::Base.valid_bearer).to be_present
36
+ expect(GetnetApi.expires_in).to be_present
37
+ expect(GetnetApi.expires_in > DateTime.current).to be true
38
+ end
39
+ end
40
+ end
41
+
42
+ context 'when token is not expired' do
43
+ it 'returnes current token' do
44
+ GetnetApi.access_token = 'some_token'
45
+ GetnetApi.expires_in = DateTime.current + 1.day
46
+ expect(GetnetApi::Base.valid_bearer).to be_present
47
+ expect(GetnetApi::Base.valid_bearer).to eq 'some_token'
48
+ end
49
+ end
50
+ end
51
+
52
+ describe '.get_token_de_bearer' do
53
+ context 'when token is expired' do
54
+ it 'creates requests for new access token' do
55
+ VCR.use_cassette 'getnet_api/base/valid_bearer' do
56
+ GetnetApi.expires_in = nil
57
+ GetnetApi::Base.get_token_de_bearer
58
+ expect(GetnetApi::Base.valid_bearer).to be_present
59
+ expect(GetnetApi.expires_in).to be_present
60
+ expect(GetnetApi.expires_in).to be > DateTime.current
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GetnetApi::CardToken do
4
+ describe '.get' do
5
+ it 'performs the request and returns the number_token' do
6
+ VCR.use_cassette 'getnet_api/cardtoken/get' do
7
+ card_number = '5155901222280001' # see https://developers.getnet.com.br/api#section/Cartoes-para-Teste
8
+ response = GetnetApi::CardToken.get card_number
9
+ expected_uri = 'https://api-sandbox.getnet.com.br/v1/tokens/card'
10
+ expect(WebMock).to have_requested(:post, expected_uri)
11
+ expect(response).to have_key("number_token")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GetnetApi::Configure do
4
+ describe '#configure' do
5
+ before do
6
+ GetnetApi.configure do |config|
7
+ config.ambiente = :sandbox
8
+ config.seller_id = 'seller_id'
9
+ config.client_id = 'client_id'
10
+ config.client_secret = 'client_secret'
11
+ end
12
+ end
13
+
14
+ it 'sets attributes to GetnetApi' do
15
+ expect(GetnetApi.seller_id).to eq 'seller_id'
16
+ expect(GetnetApi.client_id).to eq 'client_id'
17
+ expect(GetnetApi.client_secret).to eq 'client_secret'
18
+ end
19
+ end
20
+
21
+ describe '#endpoint' do
22
+ it 'sets and returns endpoint based on ambiente' do
23
+ ambiente = GetnetApi.ambiente
24
+ expected_endpoint = GetnetApi::Configure::URL[ambiente]
25
+ expect(GetnetApi.endpoint).to eq expected_endpoint
26
+ end
27
+ end
28
+
29
+ describe '#set_endpoint' do
30
+ context 'when ambiente is producao' do
31
+ it 'returns endpoint for producao' do
32
+ GetnetApi.ambiente = :producao
33
+ expected_endpoint = GetnetApi::Configure::URL[:producao]
34
+ expect(GetnetApi.set_endpoint).to eq expected_endpoint
35
+ end
36
+ end
37
+
38
+ context 'when ambiente is homologacao' do
39
+ it 'returns endpoint for homologacao' do
40
+ GetnetApi.ambiente = :homologacao
41
+ expected_endpoint = GetnetApi::Configure::URL[:homologacao]
42
+ expect(GetnetApi.set_endpoint).to eq expected_endpoint
43
+ end
44
+ end
45
+
46
+ context 'when ambiente is sandbox' do
47
+ it 'returns endpoint for sandbox' do
48
+ GetnetApi.ambiente = :sandbox
49
+ expected_endpoint = GetnetApi::Configure::URL[:sandbox]
50
+ expect(GetnetApi.set_endpoint).to eq expected_endpoint
51
+ end
52
+ end
53
+ end
54
+
55
+ describe '#base_uri' do
56
+ it 'returnes uri based on endpoint and api version' do
57
+ expected_endpoint = "#{GetnetApi.endpoint}/#{GetnetApi.api_version}"
58
+ expect(GetnetApi.base_uri).to eq expected_endpoint
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,120 @@
1
+ require 'rubygems'
2
+ require 'getnet_api'
3
+ require 'pry'
4
+ require 'vcr'
5
+ require 'webmock/rspec'
6
+
7
+ # This file was generated by the `rspec --init` command. Conventionally, all
8
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
9
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
10
+ # this file to always be loaded, without a need to explicitly require it in any
11
+ # files.
12
+ #
13
+ # Given that it is always loaded, you are encouraged to keep this file as
14
+ # light-weight as possible. Requiring heavyweight dependencies from this file
15
+ # will add to the boot time of your test suite on EVERY test run, even for an
16
+ # individual file that may not need all of that loaded. Instead, consider making
17
+ # a separate helper file that requires the additional dependencies and performs
18
+ # the additional setup, and require it from the spec files that actually need
19
+ # it.
20
+ #
21
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22
+
23
+ GetnetApi.configure do |config|
24
+ config.ambiente = :sandbox
25
+ config.seller_id = '67be6e90-00c1-410d-83f5-6d75621effc8'
26
+ config.client_id = '74438877-f00b-4502-8454-de3d7166dc2a'
27
+ config.client_secret = '4eac6920-1b57-4cd1-8799-d877173bfa37'
28
+ end
29
+
30
+ VCR.configure do |c|
31
+ c.cassette_library_dir = 'spec/vcr_cassettes'
32
+ c.hook_into :webmock
33
+ c.allow_http_connections_when_no_cassette = false
34
+ end
35
+
36
+ RSpec.configure do |config|
37
+ # rspec-expectations config goes here. You can use an alternate
38
+ # assertion/expectation library such as wrong or the stdlib/minitest
39
+ # assertions if you prefer.
40
+ config.expect_with :rspec do |expectations|
41
+ # This option will default to `true` in RSpec 4. It makes the `description`
42
+ # and `failure_message` of custom matchers include text for helper methods
43
+ # defined using `chain`, e.g.:
44
+ # be_bigger_than(2).and_smaller_than(4).description
45
+ # # => "be bigger than 2 and smaller than 4"
46
+ # ...rather than:
47
+ # # => "be bigger than 2"
48
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
49
+ end
50
+
51
+ # rspec-mocks config goes here. You can use an alternate test double
52
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
53
+ config.mock_with :rspec do |mocks|
54
+ # Prevents you from mocking or stubbing a method that does not exist on
55
+ # a real object. This is generally recommended, and will default to
56
+ # `true` in RSpec 4.
57
+ mocks.verify_partial_doubles = true
58
+ end
59
+
60
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
61
+ # have no way to turn it off -- the option exists only for backwards
62
+ # compatibility in RSpec 3). It causes shared context metadata to be
63
+ # inherited by the metadata hash of host groups and examples, rather than
64
+ # triggering implicit auto-inclusion in groups with matching metadata.
65
+ config.shared_context_metadata_behavior = :apply_to_host_groups
66
+
67
+ # The settings below are suggested to provide a good initial experience
68
+ # with RSpec, but feel free to customize to your heart's content.
69
+ =begin
70
+ # This allows you to limit a spec run to individual examples or groups
71
+ # you care about by tagging them with `:focus` metadata. When nothing
72
+ # is tagged with `:focus`, all examples get run. RSpec also provides
73
+ # aliases for `it`, `describe`, and `context` that include `:focus`
74
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
75
+ config.filter_run_when_matching :focus
76
+
77
+ # Allows RSpec to persist some state between runs in order to support
78
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
79
+ # you configure your source control system to ignore this file.
80
+ config.example_status_persistence_file_path = "spec/examples.txt"
81
+
82
+ # Limits the available syntax to the non-monkey patched syntax that is
83
+ # recommended. For more details, see:
84
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
85
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
86
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
87
+ config.disable_monkey_patching!
88
+
89
+ # This setting enables warnings. It's recommended, but in some cases may
90
+ # be too noisy due to issues in dependencies.
91
+ config.warnings = true
92
+
93
+ # Many RSpec users commonly either run the entire suite or an individual
94
+ # file, and it's useful to allow more verbose output when running an
95
+ # individual spec file.
96
+ if config.files_to_run.one?
97
+ # Use the documentation formatter for detailed output,
98
+ # unless a formatter has already been configured
99
+ # (e.g. via a command-line flag).
100
+ config.default_formatter = "doc"
101
+ end
102
+
103
+ # Print the 10 slowest examples and example groups at the
104
+ # end of the spec run, to help surface which specs are running
105
+ # particularly slow.
106
+ config.profile_examples = 10
107
+
108
+ # Run specs in random order to surface order dependencies. If you find an
109
+ # order dependency and want to debug it, you can fix the order by providing
110
+ # the seed, which is printed after each run.
111
+ # --seed 1234
112
+ config.order = :random
113
+
114
+ # Seed global randomization in this process using the `--seed` CLI option.
115
+ # Setting this allows you to use `--seed` to deterministically reproduce
116
+ # test failures related to randomization by passing the same `--seed` value
117
+ # as the one that triggered the failure.
118
+ Kernel.srand config.seed
119
+ =end
120
+ end
@@ -0,0 +1,113 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-sandbox.getnet.com.br/auth/oauth/v2/token
6
+ body:
7
+ encoding: UTF-8
8
+ string: grant_type=client_credentials&scope=oob
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - api-sandbox.getnet.com.br
18
+ Authorization:
19
+ - Basic NzQ0Mzg4NzctZjAwYi00NTAyLTg0NTQtZGUzZDcxNjZkYzJhOjRlYWM2OTIwLTFiNTctNGNkMS04Nzk5LWQ4NzcxNzNiZmEzNw==
20
+ Content-Type:
21
+ - application/x-www-form-urlencoded
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Server:
28
+ - Apache-Coyote/1.1
29
+ Pragma:
30
+ - no-cache
31
+ Cache-Control:
32
+ - no-store
33
+ Strict-Transport-Security:
34
+ - max-age=15552000; includeSubDomains
35
+ Preload:
36
+ - ''
37
+ Content-Type:
38
+ - application/json;charset=UTF-8
39
+ X-Edgeconnect-Midmile-Rtt:
40
+ - '9'
41
+ X-Edgeconnect-Origin-Mex-Latency:
42
+ - '28'
43
+ X-Powered-By:
44
+ - '49660'
45
+ Vary:
46
+ - Accept-Encoding
47
+ Date:
48
+ - Tue, 06 Apr 2021 17:04:11 GMT
49
+ Content-Length:
50
+ - '127'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: "{\r\n \"access_token\":\"38e87c4a-4047-4791-9745-91313acf4a1a\",\r\n
56
+ \ \"token_type\":\"Bearer\",\r\n \"expires_in\":3600,\r\n \"scope\":\"oob\"\r\n}"
57
+ recorded_at: Tue, 06 Apr 2021 17:04:11 GMT
58
+ - request:
59
+ method: get
60
+ uri: https://api-sandbox.getnet.com.br/v1/some_endpoint
61
+ body:
62
+ encoding: UTF-8
63
+ string: 'null'
64
+ headers:
65
+ Accept-Encoding:
66
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
67
+ Accept:
68
+ - "*/*"
69
+ User-Agent:
70
+ - Ruby
71
+ Host:
72
+ - api-sandbox.getnet.com.br
73
+ Authorization:
74
+ - Bearer 38e87c4a-4047-4791-9745-91313acf4a1a
75
+ Content-Type:
76
+ - application/json
77
+ Seller-Id:
78
+ - 67be6e90-00c1-410d-83f5-6d75621effc8
79
+ response:
80
+ status:
81
+ code: 404
82
+ message: Not Found
83
+ headers:
84
+ Server:
85
+ - Apache-Coyote/1.1
86
+ Cache-Control:
87
+ - no-cache
88
+ Strict-Transport-Security:
89
+ - max-age=15552000; includeSubDomains
90
+ Preload:
91
+ - ''
92
+ Content-Type:
93
+ - application/json;charset=utf-8
94
+ X-Edgeconnect-Midmile-Rtt:
95
+ - '8'
96
+ X-Edgeconnect-Origin-Mex-Latency:
97
+ - '76'
98
+ X-Powered-By:
99
+ - '49661'
100
+ Vary:
101
+ - Accept-Encoding
102
+ Date:
103
+ - Tue, 06 Apr 2021 17:04:11 GMT
104
+ Content-Length:
105
+ - '196'
106
+ Connection:
107
+ - keep-alive
108
+ body:
109
+ encoding: UTF-8
110
+ string: '{"message":"Not Found","name":"GatewayClientError","status_code":404,"details":[{"status":"DENIED","error_code":"GENERIC-404","description":"Not
111
+ Found","description_detail":"Resource not found"}]}'
112
+ recorded_at: Tue, 06 Apr 2021 17:04:11 GMT
113
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-sandbox.getnet.com.br/auth/oauth/v2/token
6
+ body:
7
+ encoding: UTF-8
8
+ string: grant_type=client_credentials&scope=oob
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - api-sandbox.getnet.com.br
18
+ Authorization:
19
+ - Basic NzQ0Mzg4NzctZjAwYi00NTAyLTg0NTQtZGUzZDcxNjZkYzJhOjRlYWM2OTIwLTFiNTctNGNkMS04Nzk5LWQ4NzcxNzNiZmEzNw==
20
+ Content-Type:
21
+ - application/x-www-form-urlencoded
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Server:
28
+ - Apache-Coyote/1.1
29
+ Pragma:
30
+ - no-cache
31
+ Cache-Control:
32
+ - no-store
33
+ Strict-Transport-Security:
34
+ - max-age=15552000; includeSubDomains
35
+ Preload:
36
+ - ''
37
+ Content-Type:
38
+ - application/json;charset=UTF-8
39
+ X-Edgeconnect-Midmile-Rtt:
40
+ - '8'
41
+ X-Edgeconnect-Origin-Mex-Latency:
42
+ - '29'
43
+ X-Powered-By:
44
+ - '63123'
45
+ Vary:
46
+ - Accept-Encoding
47
+ Date:
48
+ - Tue, 06 Apr 2021 16:45:43 GMT
49
+ Content-Length:
50
+ - '127'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: "{\r\n \"access_token\":\"3e28e48b-478f-4b98-b2ca-c2e82e4d5d14\",\r\n
56
+ \ \"token_type\":\"Bearer\",\r\n \"expires_in\":3600,\r\n \"scope\":\"oob\"\r\n}"
57
+ recorded_at: Tue, 06 Apr 2021 16:45:43 GMT
58
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,110 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api-sandbox.getnet.com.br/auth/oauth/v2/token
6
+ body:
7
+ encoding: UTF-8
8
+ string: grant_type=client_credentials&scope=oob
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - api-sandbox.getnet.com.br
18
+ Authorization:
19
+ - Basic NzQ0Mzg4NzctZjAwYi00NTAyLTg0NTQtZGUzZDcxNjZkYzJhOjRlYWM2OTIwLTFiNTctNGNkMS04Nzk5LWQ4NzcxNzNiZmEzNw==
20
+ Content-Type:
21
+ - application/x-www-form-urlencoded
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Server:
28
+ - Apache-Coyote/1.1
29
+ Pragma:
30
+ - no-cache
31
+ Cache-Control:
32
+ - no-store
33
+ Strict-Transport-Security:
34
+ - max-age=15552000; includeSubDomains
35
+ Preload:
36
+ - ''
37
+ Content-Type:
38
+ - application/json;charset=UTF-8
39
+ X-Edgeconnect-Midmile-Rtt:
40
+ - '1'
41
+ X-Edgeconnect-Origin-Mex-Latency:
42
+ - '36'
43
+ X-Powered-By:
44
+ - '11711'
45
+ Vary:
46
+ - Accept-Encoding
47
+ Date:
48
+ - Fri, 09 Apr 2021 06:39:57 GMT
49
+ Content-Length:
50
+ - '127'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: "{\r\n \"access_token\":\"3f322bbc-b2b6-45aa-9faa-5f8e3b9a73a5\",\r\n
56
+ \ \"token_type\":\"Bearer\",\r\n \"expires_in\":3600,\r\n \"scope\":\"oob\"\r\n}"
57
+ recorded_at: Fri, 09 Apr 2021 06:39:57 GMT
58
+ - request:
59
+ method: post
60
+ uri: https://api-sandbox.getnet.com.br/v1/tokens/card
61
+ body:
62
+ encoding: UTF-8
63
+ string: '{"card_number":"5155901222280001"}'
64
+ headers:
65
+ Accept-Encoding:
66
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
67
+ Accept:
68
+ - "*/*"
69
+ User-Agent:
70
+ - Ruby
71
+ Host:
72
+ - api-sandbox.getnet.com.br
73
+ Authorization:
74
+ - Bearer 3f322bbc-b2b6-45aa-9faa-5f8e3b9a73a5
75
+ Content-Type:
76
+ - application/json
77
+ Seller-Id:
78
+ - 67be6e90-00c1-410d-83f5-6d75621effc8
79
+ response:
80
+ status:
81
+ code: 201
82
+ message: Created
83
+ headers:
84
+ Server:
85
+ - Apache-Coyote/1.1
86
+ Cache-Control:
87
+ - no-cache
88
+ Strict-Transport-Security:
89
+ - max-age=15552000; includeSubDomains
90
+ Preload:
91
+ - ''
92
+ Content-Type:
93
+ - application/json;charset=utf-8
94
+ Content-Length:
95
+ - '132'
96
+ X-Edgeconnect-Midmile-Rtt:
97
+ - '1'
98
+ X-Edgeconnect-Origin-Mex-Latency:
99
+ - '43'
100
+ X-Powered-By:
101
+ - '11712'
102
+ Date:
103
+ - Fri, 09 Apr 2021 06:39:57 GMT
104
+ Connection:
105
+ - keep-alive
106
+ body:
107
+ encoding: ASCII-8BIT
108
+ string: '{"number_token":"bad203f8101ee124f0fadde3c5200ab130a3ae577d3ecd687e3a8743767bf3ca36fe9b4a1f0698520de1172acda4d5aa8407f4f22035e6dc197a083a88459f9e"}'
109
+ recorded_at: Fri, 09 Apr 2021 06:39:57 GMT
110
+ recorded_with: VCR 6.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getnet_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - QW3 Software & Marketing
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -33,7 +33,9 @@ executables: []
33
33
  extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
+ - ".github/workflows/ruby.yml"
36
37
  - ".gitignore"
38
+ - ".rspec"
37
39
  - Gemfile
38
40
  - Gemfile.lock
39
41
  - LICENSE
@@ -54,6 +56,13 @@ files:
54
56
  - lib/getnet_api/payment.rb
55
57
  - lib/getnet_api/payment_cancel.rb
56
58
  - lib/getnet_api/version.rb
59
+ - spec/lib/getnet_api/base_spec.rb
60
+ - spec/lib/getnet_api/card_token_spec.rb
61
+ - spec/lib/getnet_api/configure_spec.rb
62
+ - spec/spec_helper.rb
63
+ - spec/vcr_cassettes/getnet_api/base/build_request.yml
64
+ - spec/vcr_cassettes/getnet_api/base/valid_bearer.yml
65
+ - spec/vcr_cassettes/getnet_api/cardtoken/get.yml
57
66
  homepage: https://github.com/qw3/getnet_api
58
67
  licenses:
59
68
  - MIT
@@ -73,9 +82,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
82
  - !ruby/object:Gem::Version
74
83
  version: '0'
75
84
  requirements: []
76
- rubyforge_project:
77
- rubygems_version: 2.4.8
85
+ rubygems_version: 3.0.8
78
86
  signing_key:
79
87
  specification_version: 4
80
88
  summary: Getnet API - Meios de Pagamento
81
- test_files: []
89
+ test_files:
90
+ - spec/lib/getnet_api/base_spec.rb
91
+ - spec/lib/getnet_api/card_token_spec.rb
92
+ - spec/lib/getnet_api/configure_spec.rb
93
+ - spec/spec_helper.rb
94
+ - spec/vcr_cassettes/getnet_api/base/build_request.yml
95
+ - spec/vcr_cassettes/getnet_api/base/valid_bearer.yml
96
+ - spec/vcr_cassettes/getnet_api/cardtoken/get.yml