lucidimagination-chargify 0.2.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +26 -0
- data/LICENSE +20 -0
- data/README.markdown +31 -0
- data/Rakefile +15 -0
- data/VERSION +1 -0
- data/changelog.md +21 -0
- data/lib/chargify.rb +13 -0
- data/lib/chargify/client.rb +237 -0
- data/lucidimagination-chargify.gemspec +82 -0
- data/test/chargify_test.rb +432 -0
- data/test/fixtures/customer.json +12 -0
- data/test/fixtures/customers.json +12 -0
- data/test/fixtures/deleted_subscription.json +1 -0
- data/test/fixtures/invalid_subscription.json +48 -0
- data/test/fixtures/new_customer.json +12 -0
- data/test/fixtures/product.json +17 -0
- data/test/fixtures/products.json +17 -0
- data/test/fixtures/subscription.json +49 -0
- data/test/fixtures/subscription_not_found.json +1 -0
- data/test/fixtures/subscriptions.json +49 -0
- data/test/helper.rb +52 -0
- metadata +203 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"created_at":"Tue Jan 26 18:40:32 -0600 2010","activated_at":"Tue Jan 26 18:40:33 -0600 2010","expires_at":null,"cancellation_message":"Optional message","trial_ended_at":null,"updated_at":"Tue Jan 26 18:40:35 -0600 2010","credit_card":{"card_type":"bogus","expiration_year":2013,"masked_card_number":"XXXX-XXXX-XXXX-1","expiration_month":3,"last_name":"Indicisive","first_name":"John"},"id":3642,"current_period_ends_at":"Fri Feb 26 18:40:32 -0600 2010","product":{"product_family":{"name":"ZipZoomAuto","handle":"zipzoomauto","accounting_code":null,"id":268,"description":""},"name":"Basic Plan","handle":"basic","price_in_cents":5000,"accounting_code":"","id":689,"interval":1,"description":"","interval_unit":"month"},"success?":true,"customer":{"reference":"11654","created_at":"Tue Jan 26 18:40:32 -0600 2010","updated_at":"Tue Jan 26 18:40:32 -0600 2010","id":3546,"last_name":"Indicisive","organization":null,"email":"john@doe.com","first_name":"John"},"trial_started_at":null,"balance_in_cents":0,"current_period_started_at":"Tue Jan 26 18:40:32 -0600 2010","state":"canceled"}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"subscription": {
|
2
|
+
"customer": {
|
3
|
+
"reference": "bradleyjoyce",
|
4
|
+
"updated_at": "2009-10-07T11:10:27-04:00",
|
5
|
+
"id": 16,
|
6
|
+
"organization": "Squeejee",
|
7
|
+
"first_name": "Bradley",
|
8
|
+
"last_name": "Joyce",
|
9
|
+
"email": "bradley@squeejee.com",
|
10
|
+
"created_at": "2009-10-07T11:10:27-04:00"
|
11
|
+
},
|
12
|
+
"cancellation_message": null,
|
13
|
+
"updated_at": "2009-10-07T11:10:56-04:00",
|
14
|
+
"expires_at": null,
|
15
|
+
"activated_at": "2009-10-23T16:16:59-04:00",
|
16
|
+
"current_period_started_at": "2009-11-14T11:10:56-05:00",
|
17
|
+
"credit_card": {
|
18
|
+
"card_type": "bogus",
|
19
|
+
"expiration_year": 2015,
|
20
|
+
"masked_card_number": "XXXX-XXXX-XXXX-1",
|
21
|
+
"first_name": "Bradley",
|
22
|
+
"last_name": "Joyce",
|
23
|
+
"expiration_month": 7
|
24
|
+
},
|
25
|
+
"trial_ended_at": "2009-10-14T11:10:56-04:00",
|
26
|
+
"id": 14,
|
27
|
+
"product": {
|
28
|
+
"price_in_cents": 500,
|
29
|
+
"name": "Monthly",
|
30
|
+
"handle": "monthly",
|
31
|
+
"id": 8,
|
32
|
+
"accounting_code": "TSMO",
|
33
|
+
"product_family": {
|
34
|
+
"name": "TweetSaver",
|
35
|
+
"handle": "tweetsaver",
|
36
|
+
"id": 7,
|
37
|
+
"accounting_code": null
|
38
|
+
},
|
39
|
+
"interval_unit": "month",
|
40
|
+
"interval": 1
|
41
|
+
},
|
42
|
+
"current_period_ends_at": "2009-12-14T11:10:56-05:00",
|
43
|
+
"trial_started_at": "2009-10-07T11:10:56-04:00",
|
44
|
+
"balance_in_cents": 0,
|
45
|
+
"state": "active",
|
46
|
+
"created_at": "2009-10-07T11:10:56-04:00"
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"customer": {
|
3
|
+
"created_at": "2009-11-18T10:56:22-05:00",
|
4
|
+
"email": "wynn.netherland@gmail.com",
|
5
|
+
"first_name": "Wynn",
|
6
|
+
"id": 333,
|
7
|
+
"last_name": "Netherland",
|
8
|
+
"organization": null,
|
9
|
+
"reference": null,
|
10
|
+
"updated_at": "2009-11-18T10:56:22-05:00"
|
11
|
+
}
|
12
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"product": {
|
3
|
+
"price_in_cents": 500,
|
4
|
+
"name": "Monthly",
|
5
|
+
"handle": "monthly",
|
6
|
+
"id": 8,
|
7
|
+
"accounting_code": "TSMO",
|
8
|
+
"product_family": {
|
9
|
+
"name": "TweetSaver",
|
10
|
+
"handle": "tweetsaver",
|
11
|
+
"id": 7,
|
12
|
+
"accounting_code": null
|
13
|
+
},
|
14
|
+
"interval_unit": "month",
|
15
|
+
"interval": 1
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
[{
|
2
|
+
"product": {
|
3
|
+
"price_in_cents": 500,
|
4
|
+
"name": "Monthly",
|
5
|
+
"handle": "monthly",
|
6
|
+
"id": 8,
|
7
|
+
"accounting_code": "TSMO",
|
8
|
+
"product_family": {
|
9
|
+
"name": "TweetSaver",
|
10
|
+
"handle": "tweetsaver",
|
11
|
+
"id": 7,
|
12
|
+
"accounting_code": null
|
13
|
+
},
|
14
|
+
"interval_unit": "month",
|
15
|
+
"interval": 1
|
16
|
+
}
|
17
|
+
}]
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"subscription": {
|
3
|
+
"customer": {
|
4
|
+
"reference": "bradleyjoyce",
|
5
|
+
"updated_at": "2009-10-07T11:10:27-04:00",
|
6
|
+
"id": 16,
|
7
|
+
"organization": "Squeejee",
|
8
|
+
"first_name": "Bradley",
|
9
|
+
"last_name": "Joyce",
|
10
|
+
"email": "bradley@squeejee.com",
|
11
|
+
"created_at": "2009-10-07T11:10:27-04:00"
|
12
|
+
},
|
13
|
+
"cancellation_message": null,
|
14
|
+
"updated_at": "2009-10-07T11:10:56-04:00",
|
15
|
+
"expires_at": null,
|
16
|
+
"activated_at": "2009-10-23T16:16:59-04:00",
|
17
|
+
"current_period_started_at": "2009-11-14T11:10:56-05:00",
|
18
|
+
"credit_card": {
|
19
|
+
"card_type": "bogus",
|
20
|
+
"expiration_year": 2015,
|
21
|
+
"masked_card_number": "XXXX-XXXX-XXXX-1",
|
22
|
+
"first_name": "Bradley",
|
23
|
+
"last_name": "Joyce",
|
24
|
+
"expiration_month": 7
|
25
|
+
},
|
26
|
+
"trial_ended_at": "2009-10-14T11:10:56-04:00",
|
27
|
+
"id": 14,
|
28
|
+
"product": {
|
29
|
+
"price_in_cents": 500,
|
30
|
+
"name": "Monthly",
|
31
|
+
"handle": "monthly",
|
32
|
+
"id": 8,
|
33
|
+
"accounting_code": "TSMO",
|
34
|
+
"product_family": {
|
35
|
+
"name": "TweetSaver",
|
36
|
+
"handle": "tweetsaver",
|
37
|
+
"id": 7,
|
38
|
+
"accounting_code": null
|
39
|
+
},
|
40
|
+
"interval_unit": "month",
|
41
|
+
"interval": 1
|
42
|
+
},
|
43
|
+
"current_period_ends_at": "2009-12-14T11:10:56-05:00",
|
44
|
+
"trial_started_at": "2009-10-07T11:10:56-04:00",
|
45
|
+
"balance_in_cents": 0,
|
46
|
+
"state": "active",
|
47
|
+
"created_at": "2009-10-07T11:10:56-04:00"
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
\r\n
|
@@ -0,0 +1,49 @@
|
|
1
|
+
[{
|
2
|
+
"subscription": {
|
3
|
+
"customer": {
|
4
|
+
"reference": "bradleyjoyce",
|
5
|
+
"updated_at": "2009-10-07T11:10:27-04:00",
|
6
|
+
"id": 16,
|
7
|
+
"organization": "Squeejee",
|
8
|
+
"first_name": "Bradley",
|
9
|
+
"last_name": "Joyce",
|
10
|
+
"email": "bradley@squeejee.com",
|
11
|
+
"created_at": "2009-10-07T11:10:27-04:00"
|
12
|
+
},
|
13
|
+
"cancellation_message": null,
|
14
|
+
"updated_at": "2009-10-07T11:10:56-04:00",
|
15
|
+
"expires_at": null,
|
16
|
+
"activated_at": "2009-10-23T16:16:59-04:00",
|
17
|
+
"current_period_started_at": "2009-11-14T11:10:56-05:00",
|
18
|
+
"credit_card": {
|
19
|
+
"card_type": "bogus",
|
20
|
+
"expiration_year": 2015,
|
21
|
+
"masked_card_number": "XXXX-XXXX-XXXX-1",
|
22
|
+
"first_name": "Bradley",
|
23
|
+
"last_name": "Joyce",
|
24
|
+
"expiration_month": 7
|
25
|
+
},
|
26
|
+
"trial_ended_at": "2009-10-14T11:10:56-04:00",
|
27
|
+
"id": 14,
|
28
|
+
"product": {
|
29
|
+
"price_in_cents": 500,
|
30
|
+
"name": "Monthly",
|
31
|
+
"handle": "monthly",
|
32
|
+
"id": 8,
|
33
|
+
"accounting_code": "TSMO",
|
34
|
+
"product_family": {
|
35
|
+
"name": "TweetSaver",
|
36
|
+
"handle": "tweetsaver",
|
37
|
+
"id": 7,
|
38
|
+
"accounting_code": null
|
39
|
+
},
|
40
|
+
"interval_unit": "month",
|
41
|
+
"interval": 1
|
42
|
+
},
|
43
|
+
"current_period_ends_at": "2009-12-14T11:10:56-05:00",
|
44
|
+
"trial_started_at": "2009-10-07T11:10:56-04:00",
|
45
|
+
"balance_in_cents": 0,
|
46
|
+
"state": "active",
|
47
|
+
"created_at": "2009-10-07T11:10:56-04:00"
|
48
|
+
}
|
49
|
+
}]
|
data/test/helper.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
require 'shoulda'
|
5
|
+
require 'matchy'
|
6
|
+
require 'mocha'
|
7
|
+
require 'fakeweb'
|
8
|
+
require 'redgreen'
|
9
|
+
|
10
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
11
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
12
|
+
require 'chargify'
|
13
|
+
|
14
|
+
class Test::Unit::TestCase
|
15
|
+
end
|
16
|
+
|
17
|
+
FakeWeb.allow_net_connect = false
|
18
|
+
|
19
|
+
def fixture_file(filename)
|
20
|
+
return '' if filename == ''
|
21
|
+
file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
|
22
|
+
File.read(file_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def stub_get(url, filename, status=nil)
|
27
|
+
options = {:body => fixture_file(filename)}
|
28
|
+
options.merge!({:status => status}) unless status.nil?
|
29
|
+
|
30
|
+
FakeWeb.register_uri(:get, url, options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def stub_post(url, filename, status=nil)
|
34
|
+
options = {:body => fixture_file(filename)}
|
35
|
+
options.merge!({:status => status}) unless status.nil?
|
36
|
+
|
37
|
+
FakeWeb.register_uri(:post, url, options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def stub_put(url, filename, status=nil)
|
41
|
+
options = {:body => fixture_file(filename)}
|
42
|
+
options.merge!({:status => status}) unless status.nil?
|
43
|
+
|
44
|
+
FakeWeb.register_uri(:put, url, options)
|
45
|
+
end
|
46
|
+
|
47
|
+
def stub_delete(url, filename, status=nil)
|
48
|
+
options = {:body => fixture_file(filename)}
|
49
|
+
options.merge!({:status => status}) unless status.nil?
|
50
|
+
|
51
|
+
FakeWeb.register_uri(:delete, url, options)
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lucidimagination-chargify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 71
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 7
|
10
|
+
- 2
|
11
|
+
version: 0.2.7.2
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- Wynn Netherland
|
15
|
+
- Nash Kabbara
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2010-05-24 00:00:00 -07:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
name: hashie
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 29
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
- 1
|
35
|
+
- 3
|
36
|
+
version: 0.1.3
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: httparty
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 15
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
- 5
|
51
|
+
- 2
|
52
|
+
version: 0.5.2
|
53
|
+
type: :runtime
|
54
|
+
version_requirements: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: shoulda
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 37
|
64
|
+
segments:
|
65
|
+
- 2
|
66
|
+
- 10
|
67
|
+
- 1
|
68
|
+
version: 2.10.1
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id003
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: jnunemaker-matchy
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - "="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 15
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
- 4
|
83
|
+
- 0
|
84
|
+
version: 0.4.0
|
85
|
+
type: :development
|
86
|
+
version_requirements: *id004
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: mocha
|
89
|
+
prerelease: false
|
90
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ~>
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
hash: 43
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
- 9
|
99
|
+
- 8
|
100
|
+
version: 0.9.8
|
101
|
+
type: :development
|
102
|
+
version_requirements: *id005
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: fakeweb
|
105
|
+
prerelease: false
|
106
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
hash: 21
|
112
|
+
segments:
|
113
|
+
- 1
|
114
|
+
- 2
|
115
|
+
- 5
|
116
|
+
version: 1.2.5
|
117
|
+
type: :development
|
118
|
+
version_requirements: *id006
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: redgreen
|
121
|
+
prerelease: false
|
122
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 27
|
128
|
+
segments:
|
129
|
+
- 1
|
130
|
+
- 2
|
131
|
+
- 2
|
132
|
+
version: 1.2.2
|
133
|
+
type: :development
|
134
|
+
version_requirements: *id007
|
135
|
+
description: Ruby wrapper for the chargify.com SAAS and billing API
|
136
|
+
email: wynn.netherland@gmail.com
|
137
|
+
executables: []
|
138
|
+
|
139
|
+
extensions: []
|
140
|
+
|
141
|
+
extra_rdoc_files:
|
142
|
+
- LICENSE
|
143
|
+
- README.markdown
|
144
|
+
files:
|
145
|
+
- .document
|
146
|
+
- .gitignore
|
147
|
+
- LICENSE
|
148
|
+
- README.markdown
|
149
|
+
- Rakefile
|
150
|
+
- VERSION
|
151
|
+
- changelog.md
|
152
|
+
- lucidimagination-chargify.gemspec
|
153
|
+
- lib/chargify.rb
|
154
|
+
- lib/chargify/client.rb
|
155
|
+
- test/fixtures/customer.json
|
156
|
+
- test/fixtures/customers.json
|
157
|
+
- test/fixtures/deleted_subscription.json
|
158
|
+
- test/fixtures/invalid_subscription.json
|
159
|
+
- test/fixtures/new_customer.json
|
160
|
+
- test/fixtures/product.json
|
161
|
+
- test/fixtures/products.json
|
162
|
+
- test/fixtures/subscription.json
|
163
|
+
- test/fixtures/subscription_not_found.json
|
164
|
+
- test/fixtures/subscriptions.json
|
165
|
+
- test/helper.rb
|
166
|
+
- test/chargify_test.rb
|
167
|
+
has_rdoc: true
|
168
|
+
homepage: http://github.com/pengwynn/chargify
|
169
|
+
licenses: []
|
170
|
+
|
171
|
+
post_install_message:
|
172
|
+
rdoc_options:
|
173
|
+
- --charset=UTF-8
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
hash: 3
|
182
|
+
segments:
|
183
|
+
- 0
|
184
|
+
version: "0"
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
hash: 3
|
191
|
+
segments:
|
192
|
+
- 0
|
193
|
+
version: "0"
|
194
|
+
requirements: []
|
195
|
+
|
196
|
+
rubyforge_project:
|
197
|
+
rubygems_version: 1.6.2
|
198
|
+
signing_key:
|
199
|
+
specification_version: 3
|
200
|
+
summary: Ruby wrapper for the chargify.com SAAS and billing API
|
201
|
+
test_files:
|
202
|
+
- test/helper.rb
|
203
|
+
- test/chargify_test.rb
|