apruve 2.0.10 → 2.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf00b87f637dce42b6bb981a10e7ef040de2fe1d
4
- data.tar.gz: 8de4eb775d19af56fbc703b436f9e36141a614b4
3
+ metadata.gz: 986ddd4329b39e0d3cbc1555ffdddcd18cd8db95
4
+ data.tar.gz: 4e90482de25d69b82413a0cb14b57f845fe8408e
5
5
  SHA512:
6
- metadata.gz: be3efa2b92ace9a408670ff96bc4f0857abe8e0d871c296c2d1a060a9a9af193929531123180c6965267c4f307f81dfb7c39662035b788e5ffeb2fae578d9e27
7
- data.tar.gz: 27d5d9bbce27e63d050ba588ae2bc4558db7fa122f17d56144682720447d4c342487e0ab62da5589975e9d11ed0d37bbe245d76a4cf9820234dd7b2b54363f81
6
+ metadata.gz: 6bd71a880490c120675929ef5b16eef295b2fda0045981509585deaccec36ce1a020fda6e45e3076d94252a17c6f19610c7fbb1c607ec3f7dd1bac280ef94cb6
7
+ data.tar.gz: f13e45ba5b514294a0e451a8fc8a331c3f211419dc5c0cc79a4cd9201d18383857de660b3ccce938504d36cd9d8b8864c0039df755bba13d4c39dc9841f19ccb
data/Gemfile CHANGED
@@ -10,7 +10,7 @@ gem 'json'
10
10
  gem 'ffi', '~> 1.10'
11
11
 
12
12
  group :development do
13
- gem 'yard'
13
+ gem "yard", ">= 0.9.20"
14
14
  gem 'guard', '~> 1.6.2'
15
15
  gem 'listen', '~> 1.3.1' # 2.x requires celluloid, not 1.8.7 friendly
16
16
  gem 'guard-rspec', '~> 2.4.1'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apruve (2.0.10)
4
+ apruve (2.0.11)
5
5
  addressable (~> 2.3)
6
6
  faraday (>= 0.8.6, <= 0.9.0)
7
7
  faraday_middleware (~> 0.9)
@@ -97,7 +97,7 @@ GEM
97
97
  addressable (>= 2.3.6)
98
98
  crack (>= 0.3.2)
99
99
  win32console (1.3.2-x86-mingw32)
100
- yard (0.9.12)
100
+ yard (0.9.20)
101
101
 
102
102
  PLATFORMS
103
103
  ruby
@@ -123,7 +123,7 @@ DEPENDENCIES
123
123
  simplecov
124
124
  vcr
125
125
  webmock
126
- yard
126
+ yard (>= 0.9.20)
127
127
 
128
128
  BUNDLED WITH
129
129
  1.17.3
@@ -2,7 +2,8 @@ module Apruve
2
2
  class Invoice < Apruve::ApruveObject
3
3
  attr_accessor :id, :order_id, :status, :amount_cents, :currency, :merchant_notes, :merchant_invoice_id,
4
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
+ :final_state_at, :issue_on_create, :links, :issued_at, :amount_due,
6
+ :bill_to_address, :fiscal_representative, :remittance_address, :ship_to_address, :sold_to_address
6
7
 
7
8
  def self.find(id)
8
9
  response = Apruve.get("invoices/#{id}")
@@ -1,3 +1,3 @@
1
1
  module Apruve
2
- VERSION = '2.0.10'
2
+ VERSION = '2.0.11'
3
3
  end
@@ -33,12 +33,53 @@ describe Apruve::Invoice do
33
33
  it { should respond_to(:links) }
34
34
  it { should respond_to(:issued_at) }
35
35
  it { should respond_to(:amount_due) }
36
+ it { should respond_to(:bill_to_address) }
36
37
 
37
38
  describe '#to_json' do
38
39
  let(:expected) do
39
40
  '{"order_id":"9999","amount_cents":12340,"invoice_items":[],"currency":"USD"}'
40
41
  end
41
42
  its(:to_json) { should eq expected }
43
+
44
+ context 'with addresses' do
45
+ let(:address) do
46
+ {
47
+ address_1: '8995 Creola Ville',
48
+ address_2: 'Apt. 945',
49
+ city: 'Friesentown',
50
+ state: 'MN',
51
+ postal_code: '62685',
52
+ country_code: 'US',
53
+ phone_number: '6123456789',
54
+ fax_number: '6123456789',
55
+ contact_name: 'Zelda Pagac',
56
+ name: 'Jacobson, Conn and Kreiger',
57
+ notes: 'Est corrupti quis cumque.'
58
+ }
59
+ end
60
+ before do
61
+ [:bill_to_address, :fiscal_representative, :remittance_address, :ship_to_address, :sold_to_address].each do |addr|
62
+ invoice.send("#{addr.to_s}=", address)
63
+ end
64
+ end
65
+ it 'jsonifies the address' do
66
+ parsed_invoice = JSON.parse(subject.to_json)
67
+ [:bill_to_address, :fiscal_representative, :remittance_address, :ship_to_address, :sold_to_address].each do |addr|
68
+ parsed_addr = parsed_invoice.fetch addr.to_s
69
+ expect(parsed_addr['address_1']).to eq '8995 Creola Ville'
70
+ expect(parsed_addr['address_2']).to eq 'Apt. 945'
71
+ expect(parsed_addr['city']).to eq 'Friesentown'
72
+ expect(parsed_addr['state']).to eq 'MN'
73
+ expect(parsed_addr['postal_code']).to eq '62685'
74
+ expect(parsed_addr['country_code']).to eq 'US'
75
+ expect(parsed_addr['phone_number']).to eq '6123456789'
76
+ expect(parsed_addr['fax_number']).to eq '6123456789'
77
+ expect(parsed_addr['contact_name']).to eq 'Zelda Pagac'
78
+ expect(parsed_addr['name']).to eq 'Jacobson, Conn and Kreiger'
79
+ expect(parsed_addr['notes']).to eq 'Est corrupti quis cumque.'
80
+ end
81
+ end
82
+ end
42
83
  end
43
84
 
44
85
  describe '#validate' do
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.10
4
+ version: 2.0.11
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-06-06 00:00:00.000000000 Z
12
+ date: 2019-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler