chargify_api_ares 1.4.5 → 1.4.6
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 +4 -4
- data/Gemfile.lock +1 -1
- data/HISTORY.md +4 -1
- data/chargify_api_ares.gemspec +2 -2
- data/gemfiles/rails_3.gemfile.lock +1 -1
- data/gemfiles/rails_4.1.gemfile.lock +1 -1
- data/gemfiles/rails_4.gemfile.lock +1 -1
- data/lib/chargify_api_ares/resources/invoice.rb +10 -2
- data/spec/resources/invoice_spec.rb +100 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b450ff8321c3113c2f706bbf48e21577293434f
|
4
|
+
data.tar.gz: 879adae29a0938d8c5fd8321f164c553fd5e4785
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc85d4a97e18585087665d7707517cbd6046e7903e27c99cb6fb20b18b5e7edd5399337257dedcb529e5ab73a3ed1d6159f9742a2fb60628f82801c8adf352f0
|
7
|
+
data.tar.gz: 06dd2b8f0f03779903a0cead6a44c87a5310070decc93a4e08bb416c8092e8b71b16f85d9a6b3486a49c560412edeb1592cc1479cfdf052b6c9f9bccada58a18
|
data/Gemfile.lock
CHANGED
data/HISTORY.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
## 1.4.6 / August 10 2016
|
2
|
+
|
3
|
+
* Allow filtering Invoices by status [PR 139] (https://github.com/chargify/chargify_api_ares/pull/139) by @speric
|
4
|
+
|
1
5
|
## 1.4.5 / July 14 2016
|
2
6
|
|
3
7
|
* Adds ability to find pdfs from invoices, show subscription invoices [PR 135] (https://github.com/chargify/chargify_api_ares/pull/135)
|
4
8
|
|
5
|
-
|
6
9
|
## 1.4.4 / Jun 3 2016
|
7
10
|
|
8
11
|
* Adds support for External Payments [PR 128](https://github.com/chargify/chargify_api_ares/pull/128)
|
data/chargify_api_ares.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.7'
|
5
5
|
|
6
6
|
s.name = 'chargify_api_ares'
|
7
|
-
s.version = '1.4.
|
8
|
-
s.date = '2016-
|
7
|
+
s.version = '1.4.6'
|
8
|
+
s.date = '2016-08-10'
|
9
9
|
s.summary = 'A Chargify API wrapper for Ruby using ActiveResource'
|
10
10
|
s.description = ''
|
11
11
|
s.authors = ["Chargify Development Team"]
|
@@ -10,11 +10,19 @@ module Chargify
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.unpaid_from_subscription(subscription_id)
|
13
|
-
|
13
|
+
status_from_subscription(subscription_id, "unpaid")
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.status_from_subscription(subscription_id, status)
|
17
|
+
find(:all, {:params => {:subscription_id => subscription_id, :status => status}})
|
14
18
|
end
|
15
19
|
|
16
20
|
def self.unpaid
|
17
|
-
|
21
|
+
find_by_status("unpaid")
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.find_by_status(status)
|
25
|
+
find(:all, {:params => {:status => status}})
|
18
26
|
end
|
19
27
|
|
20
28
|
# Returns raw PDF data. Usage example:
|
@@ -14,3 +14,103 @@ describe Chargify::Invoice, :fake_resource do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
17
|
+
|
18
|
+
describe Chargify::Invoice, "#unpaid_from_subscription", :fake_resource do
|
19
|
+
let(:invoices) do
|
20
|
+
[
|
21
|
+
{
|
22
|
+
:invoice => { :id => 99, :subscription_id => 1, :state => "unpaid" }
|
23
|
+
}
|
24
|
+
]
|
25
|
+
end
|
26
|
+
|
27
|
+
before do
|
28
|
+
FakeWeb.register_uri(
|
29
|
+
:get,
|
30
|
+
"#{test_domain}/invoices.xml?subscription_id=1&status=unpaid",
|
31
|
+
body: invoices.to_xml(root: "invoices")
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'sends the correct params to the Chargify Invoices API endpoint' do
|
36
|
+
response = Chargify::Invoice.unpaid_from_subscription(1)
|
37
|
+
expect(response.count).to eql(1)
|
38
|
+
invoice = response.first
|
39
|
+
expect(invoice.attributes).to eql({ "id" => 99, "subscription_id" => 1, "state" => "unpaid" })
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe Chargify::Invoice, "#status_from_subscription", :fake_resource do
|
44
|
+
let(:invoices) do
|
45
|
+
[
|
46
|
+
{
|
47
|
+
:invoice => { :id => 99, :subscription_id => 1, :state => "paid" }
|
48
|
+
}
|
49
|
+
]
|
50
|
+
end
|
51
|
+
|
52
|
+
before do
|
53
|
+
FakeWeb.register_uri(
|
54
|
+
:get,
|
55
|
+
"#{test_domain}/invoices.xml?subscription_id=1&status=paid",
|
56
|
+
body: invoices.to_xml(root: "invoices")
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'sends the correct params to the Chargify Invoices API endpoint' do
|
61
|
+
response = Chargify::Invoice.status_from_subscription(1, "paid")
|
62
|
+
expect(response.count).to eql(1)
|
63
|
+
invoice = response.first
|
64
|
+
expect(invoice.attributes).to eql({ "id" => 99, "subscription_id" => 1, "state" => "paid" })
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe Chargify::Invoice, "#unpaid", :fake_resource do
|
69
|
+
let(:invoices) do
|
70
|
+
[
|
71
|
+
{
|
72
|
+
:invoice => { :id => 99, :subscription_id => 1, :state => "unpaid" }
|
73
|
+
}
|
74
|
+
]
|
75
|
+
end
|
76
|
+
|
77
|
+
before do
|
78
|
+
FakeWeb.register_uri(
|
79
|
+
:get,
|
80
|
+
"#{test_domain}/invoices.xml?status=unpaid",
|
81
|
+
body: invoices.to_xml(root: "invoices")
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'sends the correct params to the Chargify Invoices API endpoint' do
|
86
|
+
response = Chargify::Invoice.unpaid
|
87
|
+
expect(response.count).to eql(1)
|
88
|
+
invoice = response.first
|
89
|
+
expect(invoice.attributes).to eql({ "id" => 99, "subscription_id" => 1, "state" => "unpaid" })
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe Chargify::Invoice, "#find_by_status", :fake_resource do
|
94
|
+
let(:invoices) do
|
95
|
+
[
|
96
|
+
{
|
97
|
+
:invoice => { :id => 99, :subscription_id => 1, :state => "partial" }
|
98
|
+
}
|
99
|
+
]
|
100
|
+
end
|
101
|
+
|
102
|
+
before do
|
103
|
+
FakeWeb.register_uri(
|
104
|
+
:get,
|
105
|
+
"#{test_domain}/invoices.xml?status=partial",
|
106
|
+
body: invoices.to_xml(root: "invoices")
|
107
|
+
)
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'sends the correct params to the Chargify Invoices API endpoint' do
|
111
|
+
response = Chargify::Invoice.find_by_status("partial")
|
112
|
+
expect(response.count).to eql(1)
|
113
|
+
invoice = response.first
|
114
|
+
expect(invoice.attributes).to eql({ "id" => 99, "subscription_id" => 1, "state" => "partial" })
|
115
|
+
end
|
116
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chargify_api_ares
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chargify Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
267
|
version: '0'
|
268
268
|
requirements: []
|
269
269
|
rubyforge_project:
|
270
|
-
rubygems_version: 2.
|
270
|
+
rubygems_version: 2.2.3
|
271
271
|
signing_key:
|
272
272
|
specification_version: 3
|
273
273
|
summary: A Chargify API wrapper for Ruby using ActiveResource
|
@@ -302,3 +302,4 @@ test_files:
|
|
302
302
|
- spec/resources/usage_spec.rb
|
303
303
|
- spec/spec_helper.rb
|
304
304
|
- spec/support/fake_resource.rb
|
305
|
+
has_rdoc:
|