stripe 1.30.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +4 -0
- data/.github/ISSUE_TEMPLATE.md +5 -0
- data/.travis.yml +3 -14
- data/Gemfile +28 -4
- data/History.txt +180 -0
- data/README.md +147 -0
- data/Rakefile +10 -0
- data/VERSION +1 -1
- data/bin/stripe-console +12 -5
- data/lib/data/ca-certificates.crt +3868 -5114
- data/lib/stripe/account.rb +43 -23
- data/lib/stripe/alipay_account.rb +20 -0
- data/lib/stripe/api_operations/create.rb +2 -2
- data/lib/stripe/api_operations/delete.rb +2 -2
- data/lib/stripe/api_operations/list.rb +2 -3
- data/lib/stripe/api_operations/request.rb +9 -3
- data/lib/stripe/api_operations/save.rb +85 -0
- data/lib/stripe/api_resource.rb +38 -5
- data/lib/stripe/apple_pay_domain.rb +12 -0
- data/lib/stripe/application_fee.rb +8 -8
- data/lib/stripe/application_fee_refund.rb +7 -3
- data/lib/stripe/balance_transaction.rb +1 -1
- data/lib/stripe/bank_account.rb +13 -4
- data/lib/stripe/bitcoin_receiver.rb +6 -6
- data/lib/stripe/bitcoin_transaction.rb +1 -1
- data/lib/stripe/card.rb +9 -5
- data/lib/stripe/charge.rb +38 -20
- data/lib/stripe/country_spec.rb +9 -0
- data/lib/stripe/coupon.rb +1 -1
- data/lib/stripe/customer.rb +12 -10
- data/lib/stripe/dispute.rb +4 -5
- data/lib/stripe/errors.rb +92 -0
- data/lib/stripe/file_upload.rb +1 -1
- data/lib/stripe/invoice.rb +7 -7
- data/lib/stripe/invoice_item.rb +1 -1
- data/lib/stripe/list_object.rb +8 -7
- data/lib/stripe/order.rb +12 -4
- data/lib/stripe/order_return.rb +9 -0
- data/lib/stripe/plan.rb +1 -1
- data/lib/stripe/product.rb +2 -10
- data/lib/stripe/recipient.rb +1 -1
- data/lib/stripe/refund.rb +1 -1
- data/lib/stripe/reversal.rb +7 -3
- data/lib/stripe/singleton_api_resource.rb +3 -3
- data/lib/stripe/sku.rb +2 -2
- data/lib/stripe/source.rb +11 -0
- data/lib/stripe/stripe_client.rb +396 -0
- data/lib/stripe/stripe_object.rb +167 -91
- data/lib/stripe/stripe_response.rb +48 -0
- data/lib/stripe/subscription.rb +15 -9
- data/lib/stripe/subscription_item.rb +12 -0
- data/lib/stripe/three_d_secure.rb +9 -0
- data/lib/stripe/transfer.rb +4 -5
- data/lib/stripe/util.rb +105 -33
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe.rb +69 -266
- data/spec/fixtures.json +1409 -0
- data/spec/fixtures.yaml +1153 -0
- data/spec/spec.json +19949 -0
- data/spec/spec.yaml +15504 -0
- data/stripe.gemspec +5 -18
- data/test/api_fixtures.rb +29 -0
- data/test/api_stub_helpers.rb +125 -0
- data/test/stripe/account_test.rb +163 -211
- data/test/stripe/alipay_account_test.rb +19 -0
- data/test/stripe/api_operations_test.rb +31 -0
- data/test/stripe/api_resource_test.rb +174 -340
- data/test/stripe/apple_pay_domain_test.rb +33 -0
- data/test/stripe/application_fee_refund_test.rb +22 -31
- data/test/stripe/application_fee_test.rb +6 -14
- data/test/stripe/balance_test.rb +3 -3
- data/test/stripe/bank_account_test.rb +41 -0
- data/test/stripe/bitcoin_receiver_test.rb +51 -42
- data/test/stripe/bitcoin_transaction_test.rb +11 -19
- data/test/stripe/charge_test.rb +39 -98
- data/test/stripe/country_spec_test.rb +20 -0
- data/test/stripe/coupon_test.rb +35 -11
- data/test/stripe/customer_card_test.rb +25 -46
- data/test/stripe/customer_test.rb +89 -61
- data/test/stripe/dispute_test.rb +28 -31
- data/test/stripe/errors_test.rb +18 -0
- data/test/stripe/file_upload_test.rb +32 -24
- data/test/stripe/invoice_item_test.rb +55 -0
- data/test/stripe/invoice_test.rb +50 -24
- data/test/stripe/list_object_test.rb +57 -45
- data/test/stripe/order_return_test.rb +21 -0
- data/test/stripe/order_test.rb +41 -34
- data/test/stripe/plan_test.rb +52 -0
- data/test/stripe/product_test.rb +31 -25
- data/test/stripe/recipient_card_test.rb +23 -40
- data/test/stripe/recipient_test.rb +50 -0
- data/test/stripe/refund_test.rb +20 -36
- data/test/stripe/reversal_test.rb +27 -31
- data/test/stripe/sku_test.rb +39 -13
- data/test/stripe/source_test.rb +43 -0
- data/test/stripe/stripe_client_test.rb +428 -0
- data/test/stripe/stripe_object_test.rb +186 -13
- data/test/stripe/stripe_response_test.rb +46 -0
- data/test/stripe/subscription_item_test.rb +54 -0
- data/test/stripe/subscription_test.rb +40 -52
- data/test/stripe/three_d_secure_test.rb +23 -0
- data/test/stripe/transfer_test.rb +38 -13
- data/test/stripe/util_test.rb +48 -16
- data/test/stripe_test.rb +25 -0
- data/test/test_data.rb +5 -621
- data/test/test_helper.rb +24 -24
- metadata +60 -139
- data/README.rdoc +0 -68
- data/gemfiles/default-with-activesupport.gemfile +0 -10
- data/gemfiles/json.gemfile +0 -12
- data/gemfiles/yajl.gemfile +0 -12
- data/lib/stripe/api_operations/update.rb +0 -58
- data/lib/stripe/errors/api_connection_error.rb +0 -4
- data/lib/stripe/errors/api_error.rb +0 -4
- data/lib/stripe/errors/authentication_error.rb +0 -4
- data/lib/stripe/errors/card_error.rb +0 -12
- data/lib/stripe/errors/invalid_request_error.rb +0 -11
- data/lib/stripe/errors/rate_limit_error.rb +0 -4
- data/lib/stripe/errors/stripe_error.rb +0 -26
- data/test/stripe/charge_refund_test.rb +0 -55
- data/test/stripe/metadata_test.rb +0 -129
data/test/test_helper.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
+
require 'committee'
|
2
|
+
require 'sinatra'
|
1
3
|
require 'stripe'
|
2
4
|
require 'test/unit'
|
3
5
|
require 'mocha/setup'
|
4
6
|
require 'stringio'
|
5
|
-
require 'shoulda'
|
6
|
-
require
|
7
|
-
|
8
|
-
# monkeypatch request methods
|
9
|
-
module Stripe
|
10
|
-
@mock_rest_client = nil
|
7
|
+
require 'shoulda/context'
|
8
|
+
require 'webmock/test_unit'
|
11
9
|
|
12
|
-
|
13
|
-
@mock_rest_client = mock_client
|
14
|
-
end
|
10
|
+
PROJECT_ROOT = File.expand_path("../../", __FILE__)
|
15
11
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
case opts[:method]
|
20
|
-
when :get then @mock_rest_client.get opts[:url], get_params, post_params
|
21
|
-
when :post then @mock_rest_client.post opts[:url], get_params, post_params
|
22
|
-
when :delete then @mock_rest_client.delete opts[:url], get_params, post_params
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
12
|
+
require File.expand_path('../api_fixtures', __FILE__)
|
13
|
+
require File.expand_path('../api_stub_helpers', __FILE__)
|
14
|
+
require File.expand_path('../test_data', __FILE__)
|
26
15
|
|
27
16
|
class Test::Unit::TestCase
|
17
|
+
include APIStubHelpers
|
28
18
|
include Stripe::TestData
|
29
19
|
include Mocha
|
30
20
|
|
21
|
+
# Fixtures are available in tests using something like:
|
22
|
+
#
|
23
|
+
# API_FIXTURES[:charge][:id]
|
24
|
+
#
|
25
|
+
API_FIXTURES = APIFixtures.new
|
26
|
+
|
31
27
|
setup do
|
32
|
-
|
33
|
-
|
34
|
-
Stripe.
|
28
|
+
Stripe.api_key = "foo"
|
29
|
+
|
30
|
+
# Stub the Stripe API with a default stub. Note that this method can be
|
31
|
+
# called again in test bodies in order to override responses on particular
|
32
|
+
# endpoints.
|
33
|
+
stub_api
|
34
|
+
|
35
|
+
stub_connect
|
35
36
|
end
|
36
37
|
|
37
38
|
teardown do
|
38
|
-
Stripe.
|
39
|
-
Stripe.api_key=nil
|
39
|
+
Stripe.api_key = nil
|
40
40
|
end
|
41
41
|
end
|
metadata
CHANGED
@@ -1,174 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Greg Brockman
|
7
|
+
- Stripe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: faraday
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - "~>"
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '1.4'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: json
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.8.1
|
19
|
+
version: '0'
|
35
20
|
type: :runtime
|
36
21
|
prerelease: false
|
37
22
|
version_requirements: !ruby/object:Gem::Requirement
|
38
23
|
requirements:
|
39
24
|
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 1.8.1
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: mocha
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 0.13.2
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 0.13.2
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: shoulda
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 3.4.0
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 3.4.0
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: test-unit
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rake
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: byebug
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: pry
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: pry-byebug
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - ">="
|
138
25
|
- !ruby/object:Gem::Version
|
139
26
|
version: '0'
|
140
27
|
description: Stripe is the easiest way to accept payments online. See https://stripe.com
|
141
28
|
for details.
|
142
|
-
email:
|
143
|
-
- boucher@stripe.com
|
144
|
-
- gdb@stripe.com
|
29
|
+
email: support@stripe.com
|
145
30
|
executables:
|
146
31
|
- stripe-console
|
147
32
|
extensions: []
|
148
33
|
extra_rdoc_files: []
|
149
34
|
files:
|
35
|
+
- ".gitattributes"
|
36
|
+
- ".github/ISSUE_TEMPLATE.md"
|
150
37
|
- ".gitignore"
|
151
38
|
- ".travis.yml"
|
152
39
|
- CONTRIBUTORS
|
153
40
|
- Gemfile
|
154
41
|
- History.txt
|
155
42
|
- LICENSE
|
156
|
-
- README.
|
43
|
+
- README.md
|
157
44
|
- Rakefile
|
158
45
|
- VERSION
|
159
46
|
- bin/stripe-console
|
160
|
-
- gemfiles/default-with-activesupport.gemfile
|
161
|
-
- gemfiles/json.gemfile
|
162
|
-
- gemfiles/yajl.gemfile
|
163
47
|
- lib/data/ca-certificates.crt
|
164
48
|
- lib/stripe.rb
|
165
49
|
- lib/stripe/account.rb
|
50
|
+
- lib/stripe/alipay_account.rb
|
166
51
|
- lib/stripe/api_operations/create.rb
|
167
52
|
- lib/stripe/api_operations/delete.rb
|
168
53
|
- lib/stripe/api_operations/list.rb
|
169
54
|
- lib/stripe/api_operations/request.rb
|
170
|
-
- lib/stripe/api_operations/
|
55
|
+
- lib/stripe/api_operations/save.rb
|
171
56
|
- lib/stripe/api_resource.rb
|
57
|
+
- lib/stripe/apple_pay_domain.rb
|
172
58
|
- lib/stripe/application_fee.rb
|
173
59
|
- lib/stripe/application_fee_refund.rb
|
174
60
|
- lib/stripe/balance.rb
|
@@ -178,22 +64,18 @@ files:
|
|
178
64
|
- lib/stripe/bitcoin_transaction.rb
|
179
65
|
- lib/stripe/card.rb
|
180
66
|
- lib/stripe/charge.rb
|
67
|
+
- lib/stripe/country_spec.rb
|
181
68
|
- lib/stripe/coupon.rb
|
182
69
|
- lib/stripe/customer.rb
|
183
70
|
- lib/stripe/dispute.rb
|
184
|
-
- lib/stripe/errors
|
185
|
-
- lib/stripe/errors/api_error.rb
|
186
|
-
- lib/stripe/errors/authentication_error.rb
|
187
|
-
- lib/stripe/errors/card_error.rb
|
188
|
-
- lib/stripe/errors/invalid_request_error.rb
|
189
|
-
- lib/stripe/errors/rate_limit_error.rb
|
190
|
-
- lib/stripe/errors/stripe_error.rb
|
71
|
+
- lib/stripe/errors.rb
|
191
72
|
- lib/stripe/event.rb
|
192
73
|
- lib/stripe/file_upload.rb
|
193
74
|
- lib/stripe/invoice.rb
|
194
75
|
- lib/stripe/invoice_item.rb
|
195
76
|
- lib/stripe/list_object.rb
|
196
77
|
- lib/stripe/order.rb
|
78
|
+
- lib/stripe/order_return.rb
|
197
79
|
- lib/stripe/plan.rb
|
198
80
|
- lib/stripe/product.rb
|
199
81
|
- lib/stripe/recipient.rb
|
@@ -201,44 +83,68 @@ files:
|
|
201
83
|
- lib/stripe/reversal.rb
|
202
84
|
- lib/stripe/singleton_api_resource.rb
|
203
85
|
- lib/stripe/sku.rb
|
86
|
+
- lib/stripe/source.rb
|
87
|
+
- lib/stripe/stripe_client.rb
|
204
88
|
- lib/stripe/stripe_object.rb
|
89
|
+
- lib/stripe/stripe_response.rb
|
205
90
|
- lib/stripe/subscription.rb
|
91
|
+
- lib/stripe/subscription_item.rb
|
92
|
+
- lib/stripe/three_d_secure.rb
|
206
93
|
- lib/stripe/token.rb
|
207
94
|
- lib/stripe/transfer.rb
|
208
95
|
- lib/stripe/util.rb
|
209
96
|
- lib/stripe/version.rb
|
97
|
+
- spec/fixtures.json
|
98
|
+
- spec/fixtures.yaml
|
99
|
+
- spec/spec.json
|
100
|
+
- spec/spec.yaml
|
210
101
|
- stripe.gemspec
|
102
|
+
- test/api_fixtures.rb
|
103
|
+
- test/api_stub_helpers.rb
|
211
104
|
- test/stripe/account_test.rb
|
105
|
+
- test/stripe/alipay_account_test.rb
|
106
|
+
- test/stripe/api_operations_test.rb
|
212
107
|
- test/stripe/api_resource_test.rb
|
108
|
+
- test/stripe/apple_pay_domain_test.rb
|
213
109
|
- test/stripe/application_fee_refund_test.rb
|
214
110
|
- test/stripe/application_fee_test.rb
|
215
111
|
- test/stripe/balance_test.rb
|
112
|
+
- test/stripe/bank_account_test.rb
|
216
113
|
- test/stripe/bitcoin_receiver_test.rb
|
217
114
|
- test/stripe/bitcoin_transaction_test.rb
|
218
|
-
- test/stripe/charge_refund_test.rb
|
219
115
|
- test/stripe/charge_test.rb
|
116
|
+
- test/stripe/country_spec_test.rb
|
220
117
|
- test/stripe/coupon_test.rb
|
221
118
|
- test/stripe/customer_card_test.rb
|
222
119
|
- test/stripe/customer_test.rb
|
223
120
|
- test/stripe/dispute_test.rb
|
121
|
+
- test/stripe/errors_test.rb
|
224
122
|
- test/stripe/file_upload_test.rb
|
123
|
+
- test/stripe/invoice_item_test.rb
|
225
124
|
- test/stripe/invoice_test.rb
|
226
125
|
- test/stripe/list_object_test.rb
|
227
|
-
- test/stripe/
|
126
|
+
- test/stripe/order_return_test.rb
|
228
127
|
- test/stripe/order_test.rb
|
128
|
+
- test/stripe/plan_test.rb
|
229
129
|
- test/stripe/product_test.rb
|
230
130
|
- test/stripe/recipient_card_test.rb
|
131
|
+
- test/stripe/recipient_test.rb
|
231
132
|
- test/stripe/refund_test.rb
|
232
133
|
- test/stripe/reversal_test.rb
|
233
134
|
- test/stripe/sku_test.rb
|
135
|
+
- test/stripe/source_test.rb
|
136
|
+
- test/stripe/stripe_client_test.rb
|
234
137
|
- test/stripe/stripe_object_test.rb
|
138
|
+
- test/stripe/stripe_response_test.rb
|
139
|
+
- test/stripe/subscription_item_test.rb
|
235
140
|
- test/stripe/subscription_test.rb
|
141
|
+
- test/stripe/three_d_secure_test.rb
|
236
142
|
- test/stripe/transfer_test.rb
|
237
143
|
- test/stripe/util_test.rb
|
238
144
|
- test/stripe_test.rb
|
239
145
|
- test/test_data.rb
|
240
146
|
- test/test_helper.rb
|
241
|
-
homepage: https://stripe.com/api
|
147
|
+
homepage: https://stripe.com/docs/api/ruby
|
242
148
|
licenses:
|
243
149
|
- MIT
|
244
150
|
metadata: {}
|
@@ -250,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
250
156
|
requirements:
|
251
157
|
- - ">="
|
252
158
|
- !ruby/object:Gem::Version
|
253
|
-
version:
|
159
|
+
version: 1.9.3
|
254
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
255
161
|
requirements:
|
256
162
|
- - ">="
|
@@ -263,31 +169,46 @@ signing_key:
|
|
263
169
|
specification_version: 4
|
264
170
|
summary: Ruby bindings for the Stripe API
|
265
171
|
test_files:
|
172
|
+
- test/api_fixtures.rb
|
173
|
+
- test/api_stub_helpers.rb
|
266
174
|
- test/stripe/account_test.rb
|
175
|
+
- test/stripe/alipay_account_test.rb
|
176
|
+
- test/stripe/api_operations_test.rb
|
267
177
|
- test/stripe/api_resource_test.rb
|
178
|
+
- test/stripe/apple_pay_domain_test.rb
|
268
179
|
- test/stripe/application_fee_refund_test.rb
|
269
180
|
- test/stripe/application_fee_test.rb
|
270
181
|
- test/stripe/balance_test.rb
|
182
|
+
- test/stripe/bank_account_test.rb
|
271
183
|
- test/stripe/bitcoin_receiver_test.rb
|
272
184
|
- test/stripe/bitcoin_transaction_test.rb
|
273
|
-
- test/stripe/charge_refund_test.rb
|
274
185
|
- test/stripe/charge_test.rb
|
186
|
+
- test/stripe/country_spec_test.rb
|
275
187
|
- test/stripe/coupon_test.rb
|
276
188
|
- test/stripe/customer_card_test.rb
|
277
189
|
- test/stripe/customer_test.rb
|
278
190
|
- test/stripe/dispute_test.rb
|
191
|
+
- test/stripe/errors_test.rb
|
279
192
|
- test/stripe/file_upload_test.rb
|
193
|
+
- test/stripe/invoice_item_test.rb
|
280
194
|
- test/stripe/invoice_test.rb
|
281
195
|
- test/stripe/list_object_test.rb
|
282
|
-
- test/stripe/
|
196
|
+
- test/stripe/order_return_test.rb
|
283
197
|
- test/stripe/order_test.rb
|
198
|
+
- test/stripe/plan_test.rb
|
284
199
|
- test/stripe/product_test.rb
|
285
200
|
- test/stripe/recipient_card_test.rb
|
201
|
+
- test/stripe/recipient_test.rb
|
286
202
|
- test/stripe/refund_test.rb
|
287
203
|
- test/stripe/reversal_test.rb
|
288
204
|
- test/stripe/sku_test.rb
|
205
|
+
- test/stripe/source_test.rb
|
206
|
+
- test/stripe/stripe_client_test.rb
|
289
207
|
- test/stripe/stripe_object_test.rb
|
208
|
+
- test/stripe/stripe_response_test.rb
|
209
|
+
- test/stripe/subscription_item_test.rb
|
290
210
|
- test/stripe/subscription_test.rb
|
211
|
+
- test/stripe/three_d_secure_test.rb
|
291
212
|
- test/stripe/transfer_test.rb
|
292
213
|
- test/stripe/util_test.rb
|
293
214
|
- test/stripe_test.rb
|
data/README.rdoc
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
= Stripe Ruby bindings {<img src="https://travis-ci.org/stripe/stripe-ruby.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/stripe/stripe-ruby]
|
2
|
-
|
3
|
-
The Stripe Ruby bindings provide a small SDK for convenient access to the
|
4
|
-
Stripe API from applications written in the Ruby language. It provides a
|
5
|
-
pre-defined set of classes for API resources that initialize themselves
|
6
|
-
dynamically from API responses which allows the bindings to tolerate a number
|
7
|
-
of different versions of the API.
|
8
|
-
|
9
|
-
The bindings also provide other features. For example:
|
10
|
-
|
11
|
-
* Easy configuration path for fast setup and use.
|
12
|
-
* Helpers for pagination.
|
13
|
-
* Tracking of "fresh" values in API resources so that partial updates can be
|
14
|
-
executed.
|
15
|
-
* Built-in mechanisms for the serialization of parameters according to the
|
16
|
-
expectations of Stripe's API.
|
17
|
-
|
18
|
-
== Documentation
|
19
|
-
|
20
|
-
{Ruby API Docs}[https://stripe.com/docs/api/ruby#intro]
|
21
|
-
|
22
|
-
== Installation
|
23
|
-
|
24
|
-
You don't need this source code unless you want to modify the gem. If
|
25
|
-
you just want to use the Stripe Ruby bindings, you should run:
|
26
|
-
|
27
|
-
gem install stripe
|
28
|
-
|
29
|
-
If you want to build the gem from source:
|
30
|
-
|
31
|
-
gem build stripe.gemspec
|
32
|
-
|
33
|
-
== Requirements
|
34
|
-
|
35
|
-
* Ruby 1.8.7 or above. (Ruby 1.8.6 may work if you load
|
36
|
-
ActiveSupport.) For Ruby versions before 1.9.2, you'll need to add this to your Gemfile:
|
37
|
-
|
38
|
-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.2')
|
39
|
-
gem 'rest-client', '~> 1.6.8'
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
* rest-client, json
|
44
|
-
|
45
|
-
== Bundler
|
46
|
-
|
47
|
-
If you are installing via bundler, you should be sure to use the https
|
48
|
-
rubygems source in your Gemfile, as any gems fetched over http could potentially be
|
49
|
-
compromised in transit and alter the code of gems fetched securely over https:
|
50
|
-
|
51
|
-
source 'https://rubygems.org'
|
52
|
-
|
53
|
-
gem 'rails'
|
54
|
-
gem 'stripe'
|
55
|
-
|
56
|
-
== Development
|
57
|
-
|
58
|
-
Run all tests:
|
59
|
-
|
60
|
-
bundle exec rake
|
61
|
-
|
62
|
-
Run a single test suite:
|
63
|
-
|
64
|
-
bundle exec ruby -Ilib/ test/stripe/util_test.rb
|
65
|
-
|
66
|
-
Run a single test:
|
67
|
-
|
68
|
-
bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.symbols/
|
@@ -1,10 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
gemspec :path => File.join(File.dirname(__FILE__), "..")
|
3
|
-
|
4
|
-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
|
5
|
-
gem 'i18n', '< 0.7'
|
6
|
-
gem 'rest-client', '~> 1.6.8'
|
7
|
-
gem 'activesupport', '~> 3.2'
|
8
|
-
else
|
9
|
-
gem 'activesupport'
|
10
|
-
end
|
data/gemfiles/json.gemfile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
gemspec :path => File.join(File.dirname(__FILE__), "..")
|
3
|
-
|
4
|
-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
|
5
|
-
gem 'i18n', '< 0.7'
|
6
|
-
gem 'rest-client', '~> 1.6.8'
|
7
|
-
gem 'activesupport', '~> 3.2'
|
8
|
-
else
|
9
|
-
gem 'activesupport'
|
10
|
-
end
|
11
|
-
|
12
|
-
gem 'json'
|
data/gemfiles/yajl.gemfile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
gemspec :path => File.join(File.dirname(__FILE__), "..")
|
3
|
-
|
4
|
-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
|
5
|
-
gem 'i18n', '< 0.7'
|
6
|
-
gem 'rest-client', '~> 1.6.8'
|
7
|
-
gem 'activesupport', '~> 3.2'
|
8
|
-
else
|
9
|
-
gem 'activesupport'
|
10
|
-
end
|
11
|
-
|
12
|
-
gem 'yajl-ruby'
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
module APIOperations
|
3
|
-
module Update
|
4
|
-
# Creates or updates an API resource.
|
5
|
-
#
|
6
|
-
# If the resource doesn't yet have an assigned ID and the resource is one
|
7
|
-
# that can be created, then the method attempts to create the resource.
|
8
|
-
# The resource is updated otherwise.
|
9
|
-
#
|
10
|
-
# ==== Attributes
|
11
|
-
#
|
12
|
-
# * +params+ - Overrides any parameters in the resource's serialized data
|
13
|
-
# and includes them in the create or update. If +:req_url:+ is included
|
14
|
-
# in the list, it overrides the update URL used for the create or
|
15
|
-
# update.
|
16
|
-
def save(params={})
|
17
|
-
# Let the caller override the URL but avoid serializing it.
|
18
|
-
req_url = params.delete(:req_url) || save_url
|
19
|
-
|
20
|
-
# We started unintentionally (sort of) allowing attributes send to
|
21
|
-
# +save+ to override values used during the update. So as not to break
|
22
|
-
# the API, this makes that official here.
|
23
|
-
update_attributes(params)
|
24
|
-
|
25
|
-
# Now remove any parameters that look like object attributes.
|
26
|
-
params = params.reject { |k, _| respond_to?(k) }
|
27
|
-
|
28
|
-
values = self.class.serialize_params(self).merge(params)
|
29
|
-
|
30
|
-
if values.length > 0
|
31
|
-
# note that id gets removed here our call to #url above has already
|
32
|
-
# generated a uri for this object with an identifier baked in
|
33
|
-
values.delete(:id)
|
34
|
-
|
35
|
-
response, opts = request(:post, req_url, values)
|
36
|
-
initialize_from(response, opts)
|
37
|
-
end
|
38
|
-
self
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def save_url
|
44
|
-
# This switch essentially allows us "upsert"-like functionality. If the
|
45
|
-
# API resource doesn't have an ID set (suggesting that it's new) and
|
46
|
-
# its class responds to .create (which comes from
|
47
|
-
# Stripe::APIOperations::Create), then use the URL to create a new
|
48
|
-
# resource. Otherwise, generate a URL based on the object's identifier
|
49
|
-
# for a normal update.
|
50
|
-
if self[:id] == nil && self.class.respond_to?(:create)
|
51
|
-
self.class.url
|
52
|
-
else
|
53
|
-
url
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class CardError < StripeError
|
3
|
-
attr_reader :param, :code
|
4
|
-
|
5
|
-
def initialize(message, param, code, http_status=nil, http_body=nil, json_body=nil,
|
6
|
-
http_headers=nil)
|
7
|
-
super(message, http_status, http_body, json_body, http_headers)
|
8
|
-
@param = param
|
9
|
-
@code = code
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class InvalidRequestError < StripeError
|
3
|
-
attr_accessor :param
|
4
|
-
|
5
|
-
def initialize(message, param, http_status=nil, http_body=nil, json_body=nil,
|
6
|
-
http_headers=nil)
|
7
|
-
super(message, http_status, http_body, json_body, http_headers)
|
8
|
-
@param = param
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Stripe
|
2
|
-
class StripeError < StandardError
|
3
|
-
attr_reader :message
|
4
|
-
attr_reader :http_status
|
5
|
-
attr_reader :http_body
|
6
|
-
attr_reader :http_headers
|
7
|
-
attr_reader :request_id
|
8
|
-
attr_reader :json_body
|
9
|
-
|
10
|
-
def initialize(message=nil, http_status=nil, http_body=nil, json_body=nil,
|
11
|
-
http_headers=nil)
|
12
|
-
@message = message
|
13
|
-
@http_status = http_status
|
14
|
-
@http_body = http_body
|
15
|
-
@http_headers = http_headers || {}
|
16
|
-
@json_body = json_body
|
17
|
-
@request_id = @http_headers[:request_id]
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_s
|
21
|
-
status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
|
22
|
-
id_string = @request_id.nil? ? "" : "(Request #{@request_id}) "
|
23
|
-
"#{status_string}#{id_string}#{@message}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|