affirm-ruby 1.1.2 → 1.2.0

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
2
  SHA256:
3
- metadata.gz: 67183e4230f5af0d79d948af0cc45151a79e7b0ad5781acc2732a4869dcb7955
4
- data.tar.gz: 60122b43c022b3ee088c16ad27e6ecef53abcf5a689173124d6924054df66fa2
3
+ metadata.gz: 311a0f81d64a7f23bbfbc57366e2f174d4c80a1914fd59c225f3849a49992264
4
+ data.tar.gz: 7881f6ca2e67a47a50de4c12bbfcd53427a9084c1d68c6ff2ecb01e8f1df476f
5
5
  SHA512:
6
- metadata.gz: f23b7bd7c0b5873d0bb61768dfc4466df7d639e167274c93336a255274b5021d8c6da0e403ef135c02974771b6bf5f35189f31eaa1e2f3e6a464b7a8f882cae6
7
- data.tar.gz: d12b4ee1efe1af57fb29481280972b69a642ed79e3af528b8049559260a8b31118b53fa02634df87a3ca7ffe263867fb519833e89f8287d94d1deaa53357e1c0
6
+ metadata.gz: a861d1e63477c020271f17c8b1f4648918a4fc38b5d546bfe9554dd52246ecfc7dbaf374f75d8390433e58914949a36e3cc64e1802de00791995394f4f81e620
7
+ data.tar.gz: 2c1e55d82b904144ae5add4cafc9ab4077dd1308472cfa0d7b23581332ccff84f7d6c74ce5c0ee85811e4170a2b2bb064c1afb242da73c55f472713b5216dbb5
data/CHANGELOG.md CHANGED
@@ -4,13 +4,17 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
- ## [1.1.3][] (2020-10-30)
7
+ ## [1.1.3][] (2022-04-29)
8
+
9
+ Fixes:
10
+
11
+ - Fix error on Ruby 3 (embold-tyler in [#6](https://github.com/spectator/affirm/pull/6))
8
12
 
9
13
  ## [1.1.2][] (2021-10-30)
10
14
 
11
15
  Fixes:
12
16
 
13
- - Relax Ruby requirement (embold-tyler in [#4](https://github.com/spectator/affirm/pull/4))
17
+ - Relax Ruby requirement (embold-tyler in [#5](https://github.com/spectator/affirm/pull/5))
14
18
 
15
19
  ## [1.1.0][] (2019-09-03)
16
20
 
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- affirm-ruby (1.1.1)
4
+ affirm-ruby (1.2.0)
5
5
  faraday
6
- faraday_middleware
7
6
  virtus (~> 1.0, >= 1.0.0)
8
7
 
9
8
  GEM
@@ -13,35 +12,35 @@ GEM
13
12
  descendants_tracker (~> 0.0.4)
14
13
  ice_nine (~> 0.11.0)
15
14
  thread_safe (~> 0.3, >= 0.3.1)
16
- byebug (5.0.0)
17
- columnize (= 0.9.0)
15
+ base64 (0.1.1)
16
+ byebug (11.1.3)
18
17
  coercible (1.0.0)
19
18
  descendants_tracker (~> 0.0.1)
20
- columnize (0.9.0)
21
19
  descendants_tracker (0.0.4)
22
20
  thread_safe (~> 0.3, >= 0.3.1)
23
- diff-lcs (1.3)
21
+ diff-lcs (1.5.0)
24
22
  equalizer (0.0.11)
25
- faraday (0.15.4)
26
- multipart-post (>= 1.2, < 3)
27
- faraday_middleware (0.13.1)
28
- faraday (>= 0.7.4, < 1.0)
23
+ faraday (2.7.11)
24
+ base64
25
+ faraday-net_http (>= 2.0, < 3.1)
26
+ ruby2_keywords (>= 0.0.4)
27
+ faraday-net_http (3.0.2)
29
28
  ice_nine (0.11.2)
30
- multipart-post (2.1.1)
31
- rake (13.0.1)
32
- rspec (3.9.0)
33
- rspec-core (~> 3.9.0)
34
- rspec-expectations (~> 3.9.0)
35
- rspec-mocks (~> 3.9.0)
36
- rspec-core (3.9.1)
37
- rspec-support (~> 3.9.1)
38
- rspec-expectations (3.9.0)
29
+ rake (13.1.0)
30
+ rspec (3.12.0)
31
+ rspec-core (~> 3.12.0)
32
+ rspec-expectations (~> 3.12.0)
33
+ rspec-mocks (~> 3.12.0)
34
+ rspec-core (3.12.2)
35
+ rspec-support (~> 3.12.0)
36
+ rspec-expectations (3.12.3)
39
37
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.9.0)
41
- rspec-mocks (3.9.1)
38
+ rspec-support (~> 3.12.0)
39
+ rspec-mocks (3.12.6)
42
40
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.9.0)
44
- rspec-support (3.9.2)
41
+ rspec-support (~> 3.12.0)
42
+ rspec-support (3.12.1)
43
+ ruby2_keywords (0.0.5)
45
44
  thread_safe (0.3.6)
46
45
  virtus (1.0.5)
47
46
  axiom-types (~> 0.1)
@@ -50,7 +49,8 @@ GEM
50
49
  equalizer (~> 0.0, >= 0.0.9)
51
50
 
52
51
  PLATFORMS
53
- ruby
52
+ arm64-darwin-22
53
+ x86_64-darwin-21
54
54
 
55
55
  DEPENDENCIES
56
56
  affirm-ruby!
@@ -60,4 +60,4 @@ DEPENDENCIES
60
60
  rspec
61
61
 
62
62
  BUNDLED WITH
63
- 2.0.2
63
+ 2.4.19
data/affirm.gemspec CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = [">= 2.1", "< 4.0"]
22
22
  spec.add_dependency "faraday"
23
- spec.add_dependency "faraday_middleware"
24
23
  spec.add_dependency "virtus", "~> 1.0", ">= 1.0.0"
25
24
 
26
25
  spec.add_development_dependency "bundler"
data/lib/affirm/client.rb CHANGED
@@ -6,7 +6,7 @@ module Affirm
6
6
  private :url_prefix
7
7
 
8
8
  class << self
9
- def request(method, path, **data)
9
+ def request(method, path, data={})
10
10
  new.public_send(method, path, data)
11
11
  end
12
12
  end
@@ -14,18 +14,18 @@ module Affirm
14
14
  def initialize
15
15
  @url_prefix = "/api/v2"
16
16
  @connection = Faraday.new(Affirm.configuration.endpoint) do |conn|
17
- conn.basic_auth(basic_auth_user, basic_auth_password)
17
+ conn.request :authorization, :basic, basic_auth_user, basic_auth_password
18
18
  conn.request :json
19
19
  conn.response :json, content_type: /\bjson$/
20
20
  conn.adapter Faraday.default_adapter
21
21
  end
22
22
  end
23
23
 
24
- def get(path, **data)
24
+ def get(path, data={})
25
25
  connection.get(normalized_path(path), data)
26
26
  end
27
27
 
28
- def post(path, **data)
28
+ def post(path, data={})
29
29
  connection.post(normalized_path(path), data)
30
30
  end
31
31
 
@@ -1,3 +1,3 @@
1
1
  module Affirm
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/affirm.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require "forwardable"
2
2
 
3
3
  require "faraday"
4
- require "faraday_middleware"
5
4
  require "virtus"
6
5
 
7
6
  require "affirm/client"
data/spec/charge_spec.rb CHANGED
@@ -266,9 +266,11 @@ RSpec.describe Affirm::Charge do
266
266
  before do
267
267
  expect(Affirm::Client).to receive(:request)
268
268
  .with(:post, "charges/1/update",
269
- order_id: "XYZ-007",
270
- shipping_carrier: "FedEx",
271
- shipping_confirmation: "1ZX007")
269
+ {
270
+ order_id: "XYZ-007",
271
+ shipping_carrier: "FedEx",
272
+ shipping_confirmation: "1ZX007"
273
+ })
272
274
  .and_return(failed_response)
273
275
  end
274
276
 
@@ -310,9 +312,11 @@ RSpec.describe Affirm::Charge do
310
312
  before do
311
313
  expect(Affirm::Client).to receive(:request)
312
314
  .with(:post, "charges/1/update",
313
- order_id: "XYZ-007",
314
- shipping_carrier: "FedEx",
315
- shipping_confirmation: "1ZX007"
315
+ {
316
+ order_id: "XYZ-007",
317
+ shipping_carrier: "FedEx",
318
+ shipping_confirmation: "1ZX007"
319
+ }
316
320
  )
317
321
  .and_return(successful_response)
318
322
  end
data/spec/client_spec.rb CHANGED
@@ -1,28 +1,16 @@
1
1
  require "helper"
2
2
 
3
3
  RSpec.describe Affirm::Client do
4
- context "new instance" do
5
- it "creates Faraday connection" do
6
- expect(subject.connection).to be_an_instance_of(Faraday::Connection)
4
+ before(:all) do
5
+ Affirm.configure do |config|
6
+ config.public_api_key = "abc"
7
+ config.private_api_key = "xyz"
7
8
  end
8
9
  end
9
10
 
10
- context "with api keys set" do
11
- before do
12
- Affirm.configure do |config|
13
- config.public_api_key = "abc"
14
- config.private_api_key = "xyz"
15
- end
16
- end
17
-
18
- it "sets json handlers" do
19
- expect(
20
- subject.connection.builder.handlers
21
- ).to include(FaradayMiddleware::EncodeJson, FaradayMiddleware::ParseJson)
22
- end
23
-
24
- it "sets basic auth header" do
25
- expect(subject.connection.headers["Authorization"]).to eq("Basic YWJjOnh5eg==")
11
+ context "new instance" do
12
+ it "creates Faraday connection" do
13
+ expect(subject.connection).to be_an_instance_of(Faraday::Connection)
26
14
  end
27
15
  end
28
16
 
@@ -41,6 +29,11 @@ RSpec.describe Affirm::Client do
41
29
  subject.connection.adapter(:test, @stubs)
42
30
  end
43
31
 
32
+ it "sets basic auth header" do
33
+ response = subject.post("foo", {})
34
+ expect(response.env.request_headers["Authorization"]).to eq("Basic YWJjOnh5eg==")
35
+ end
36
+
44
37
  it "makes request to full url" do
45
38
  response = subject.post("foo", {})
46
39
  expect(response.env.url.to_s).to eq("https://api.affirm.com/api/v2/foo")
@@ -74,6 +67,11 @@ RSpec.describe Affirm::Client do
74
67
  subject.connection.adapter(:test, @stubs)
75
68
  end
76
69
 
70
+ it "sets basic auth header" do
71
+ response = subject.get("foo", {})
72
+ expect(response.env.request_headers["Authorization"]).to eq("Basic YWJjOnh5eg==")
73
+ end
74
+
77
75
  it "makes request to full url" do
78
76
  response = subject.get("foo", {})
79
77
  expect(response.env.url.to_s).to eq("https://api.affirm.com/api/v2/foo")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: affirm-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Velikanau
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-11-01 00:00:00.000000000 Z
12
+ date: 2023-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -25,20 +25,6 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: faraday_middleware
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: virtus
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
170
  - !ruby/object:Gem::Version
185
171
  version: '0'
186
172
  requirements: []
187
- rubygems_version: 3.1.2
173
+ rubygems_version: 3.3.7
188
174
  signing_key:
189
175
  specification_version: 4
190
176
  summary: Ruby wrapper for Affirm.com API