apruve 2.0.8 → 2.0.9

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
  SHA1:
3
- metadata.gz: 94ca66c1957512f49063d74a45a5f3320a29a854
4
- data.tar.gz: 54629775100a24264e51b634ecf117b884b15197
3
+ metadata.gz: a2e75dc4e8b17ef75b8ef23dac8d9346af562cc8
4
+ data.tar.gz: 642389dc07f10a8fe2d34127522ac38e366b2e1a
5
5
  SHA512:
6
- metadata.gz: c4af6b63ebb85b7deb3ddbced1ee0c4710648f184babaf5c5755725219ecff7e50725285c9a472516634c9b740ac2d52a64adbe191ad1e142ea7f1c42761bab4
7
- data.tar.gz: aba12f29d0ffc7457f04f1cb20e9501b5d5e0cc5afc4362ff826657809ec1b00dfc978f7d87cb7082c4b299443fd251ac647fec0f6cd65b756a381f6c67476e0
6
+ metadata.gz: 4ed7d8ab196f786920b229a195678200b0ef81ee85df9ff9d99c93296f77a24ff4818cb045e29e1feac2bcad1bd41cdedcbd9d9e6cb22ebafc810e96b8641432
7
+ data.tar.gz: b1e01981fa592148e1dccdf733e0df1d533241400dd4203e0366c3e4ab735d05305d23db8fec63cd761a5cb612aae4a1b8163bdeac40d45d8229e6b7edb519d8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apruve (2.0.7)
4
+ apruve (2.0.9)
5
5
  addressable (~> 2.3)
6
6
  faraday (>= 0.8.6, <= 0.9.0)
7
7
  faraday_middleware (~> 0.9)
@@ -2,7 +2,7 @@ module Apruve
2
2
  class Order < Apruve::ApruveObject
3
3
  attr_accessor :id, :merchant_id, :shopper_id, :merchant_order_id, :status, :amount_cents, :currency, :tax_cents,
4
4
  :shipping_cents, :expire_at, :order_items, :accepts_payments_via, :accepts_payment_terms,
5
- :payment_term, :po_number, :created_at, :updated_at, :final_state_at, :default_payment_method, :links,
5
+ :payment_terms, :po_number, :created_at, :updated_at, :final_state_at, :default_payment_method, :links,
6
6
  :finalize_on_create, :invoice_on_create, :secure_hash
7
7
 
8
8
  def self.find(id)
@@ -103,5 +103,15 @@ module Apruve
103
103
  end
104
104
  Digest::SHA256.hexdigest(Apruve.client.api_key+value_string)
105
105
  end
106
+
107
+ # The field is actually named 'payment_terms', but some integrations are currently using 'payment_term'. Pass
108
+ # those requests through to the correct attribute.
109
+ def payment_term
110
+ self.payment_terms
111
+ end
112
+
113
+ def payment_term=(pt)
114
+ self.payment_terms=pt
115
+ end
106
116
  end
107
117
  end
@@ -1,3 +1,3 @@
1
1
  module Apruve
2
- VERSION = '2.0.8'
2
+ VERSION = '2.0.9'
3
3
  end
@@ -41,7 +41,7 @@ describe Apruve::Order do
41
41
  order_items: order_items,
42
42
  finalize_on_create: false,
43
43
  invoice_on_create: false,
44
- payment_term: payment_term,
44
+ payment_terms: payment_term,
45
45
  secure_hash: 'fffd123'
46
46
  )
47
47
  end
@@ -61,13 +61,15 @@ describe Apruve::Order do
61
61
  it { should respond_to(:invoice_on_create) }
62
62
  it { should respond_to(:secure_hash) }
63
63
  it { should respond_to(:po_number) }
64
+ it { should respond_to(:payment_term) }
65
+ it { should respond_to(:payment_terms) }
64
66
 
65
67
  describe '#to_json' do
66
68
  let(:expected) do
67
69
  "{\"merchant_id\":\"9a9c3389fdc281b5c6c8d542a7e91ff6\",\"shopper_id\":\"9bc388fd08ce2835cfeb2e630316f7f1\",\"merchant_order_id\":\"ABC\","\
68
70
  "\"amount_cents\":12340,\"tax_cents\":0,\"shipping_cents\":0,\"order_items\":[{\"title\":\"line 1\",\"price_ea_cents\":\"123\",\"quantity\":10,"\
69
71
  "\"description\":\"A line item\",\"variant_info\":\"small\",\"sku\":\"LINE1SKU\",\"vendor\":\"acme, inc.\",\"view_product_url\":\"http://www.apruve.com/doc\""\
70
- "},{\"title\":\"line 2\",\"price_ea_cents\":\"40\"}],\"finalize_on_create\":false,\"invoice_on_create\":false,\"payment_term\":{\"corporate_account_id\":\"612e5383e4acc6c2213f3cae6208e868\"},\"secure_hash\":\"fffd123\"}"
72
+ "},{\"title\":\"line 2\",\"price_ea_cents\":\"40\"}],\"finalize_on_create\":false,\"invoice_on_create\":false,\"payment_terms\":{\"corporate_account_id\":\"612e5383e4acc6c2213f3cae6208e868\"},\"secure_hash\":\"fffd123\"}"
71
73
  end
72
74
  its(:to_json) { should eq expected }
73
75
  end
@@ -274,7 +276,7 @@ describe Apruve::Order do
274
276
 
275
277
  describe '#update' do
276
278
  let (:id) { '89ea2488fe0a5c7bb38aa7f9b088874a' }
277
- let (:order) { Apruve::Order.new id: id, merchant_id: 9999, payment_term: payment_term }
279
+ let (:order) { Apruve::Order.new id: id, merchant_id: 9999, payment_terms: payment_term }
278
280
  describe 'success' do
279
281
  let! (:stubs) do
280
282
  faraday_stubs do |stub|
@@ -298,5 +300,22 @@ describe Apruve::Order do
298
300
  stubs.verify_stubbed_calls
299
301
  end
300
302
  end
303
+
304
+ describe '#payment_term' do
305
+ let (:order) { Apruve::Order.new id: id, merchant_id: 9999, payment_terms: payment_term }
306
+
307
+ it 'returns payment_terms' do
308
+ expect(order.payment_term).to be order.payment_terms
309
+ end
310
+ end
311
+
312
+ describe '#payment_term=' do
313
+ let (:order) { Apruve::Order.new id: id, merchant_id: 9999 }
314
+
315
+ it 'sets payment_terms' do
316
+ order.payment_term = payment_term
317
+ expect(order.payment_terms).to be payment_term
318
+ end
319
+ end
301
320
  end
302
321
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apruve
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apruve, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-20 00:00:00.000000000 Z
12
+ date: 2019-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler