apruve 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/apruve/resources/invoice.rb +4 -3
- data/lib/apruve/resources/shipment.rb +6 -0
- data/lib/apruve/version.rb +1 -1
- data/spec/apruve/resources/invoice_spec.rb +2 -0
- data/spec/apruve/resources/shipment_spec.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4906c25ab5dd9bc57bd845ebf10600e090d3d1d
|
4
|
+
data.tar.gz: 317335e6592dca30ad63ef08792a29b5a155bfee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 429f35de4d1c7ec5a0b9e3981fa92037f2ebf37e5d0fbe8b2eb7f89941a8cf5077ab5af1a00a375ced3f090eb0d2eea2dec8b5dfb6607f61beebd6d4fe6b075e
|
7
|
+
data.tar.gz: 7470ba178ce9f27264125f51e36a1299cf3845cae3cc104212ed7cfb44b8ea2995289f20eb0089a7997fd8656f26be37642f3f1f886158550efd31abea95915c
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Apruve
|
2
2
|
class Invoice < Apruve::ApruveObject
|
3
|
-
attr_accessor :id, :order_id, :status, :amount_cents, :currency, :merchant_notes, :merchant_invoice_id,
|
4
|
-
:tax_cents, :invoice_items, :payments, :created_at, :opened_at, :due_at,
|
3
|
+
attr_accessor :id, :order_id, :status, :amount_cents, :currency, :merchant_notes, :merchant_invoice_id,
|
4
|
+
:shipping_cents, :tax_cents, :invoice_items, :payments, :created_at, :opened_at, :due_at,
|
5
|
+
:final_state_at, :issue_on_create, :links, :issued_at, :amount_due
|
5
6
|
|
6
7
|
def self.find(id)
|
7
8
|
response = Apruve.get("invoices/#{id}")
|
@@ -66,4 +67,4 @@ module Apruve
|
|
66
67
|
self.status
|
67
68
|
end
|
68
69
|
end
|
69
|
-
end
|
70
|
+
end
|
@@ -9,6 +9,12 @@ module Apruve
|
|
9
9
|
Shipment.new(response.body)
|
10
10
|
end
|
11
11
|
|
12
|
+
def self.find_all(invoice_id)
|
13
|
+
response = Apruve.get("invoices/#{invoice_id}/shipments")
|
14
|
+
logger.debug response.body
|
15
|
+
response.body.map { |shipment| Shipment.new(shipment) }
|
16
|
+
end
|
17
|
+
|
12
18
|
def initialize(params)
|
13
19
|
super
|
14
20
|
# hydrate payment items if appropriate
|
data/lib/apruve/version.rb
CHANGED
@@ -31,6 +31,8 @@ describe Apruve::Invoice do
|
|
31
31
|
it { should respond_to(:due_at) }
|
32
32
|
it { should respond_to(:final_state_at) }
|
33
33
|
it { should respond_to(:links) }
|
34
|
+
it { should respond_to(:issued_at) }
|
35
|
+
it { should respond_to(:amount_due) }
|
34
36
|
|
35
37
|
describe '#to_json' do
|
36
38
|
let(:expected) do
|
@@ -103,6 +103,35 @@ describe Apruve::Shipment do
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
+
describe '#find_all' do
|
107
|
+
context 'successful response' do
|
108
|
+
let (:invoice_id) { '91ac96c0ffc9577ecb634ad726b1874e' }
|
109
|
+
let! (:stubs) do
|
110
|
+
faraday_stubs do |stub|
|
111
|
+
stub.get("/api/v4/invoices/#{invoice_id}/shipments") { [200, {}, '[]'] }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
it 'should get all shipments associated with an invoice' do
|
115
|
+
Apruve::Shipment.find_all(invoice_id)
|
116
|
+
stubs.verify_stubbed_calls
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context 'with invalid invoice id' do
|
121
|
+
let (:invoice_id) { 'not-a-valid-apruve-invoice-id' }
|
122
|
+
|
123
|
+
let! (:stubs) do
|
124
|
+
faraday_stubs do |stub|
|
125
|
+
stub.get("/api/v4/invoices/#{invoice_id}/shipments") { [404, {}, 'Not Found'] }
|
126
|
+
end
|
127
|
+
end
|
128
|
+
it 'should return a not found response' do
|
129
|
+
expect { Apruve::Shipment.find_all(invoice_id) }.to raise_error(Apruve::NotFound)
|
130
|
+
stubs.verify_stubbed_calls
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
106
135
|
describe '#save' do
|
107
136
|
let (:id) { '89ea2488fe0a5c7bb38aa7f9b088874a' }
|
108
137
|
let (:invoice_id) { '91ac96c0ffc9577ecb634ad726b1874e' }
|
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: 1.1.
|
4
|
+
version: 1.1.7
|
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: 2017-
|
12
|
+
date: 2017-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|