stripe 1.14.0 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +5 -0
- data/History.txt +5 -0
- data/Rakefile +5 -13
- data/VERSION +1 -1
- data/gemfiles/default-with-activesupport.gemfile +7 -1
- data/gemfiles/json.gemfile +9 -2
- data/gemfiles/yajl.gemfile +9 -2
- data/lib/stripe.rb +1 -0
- data/lib/stripe/application_fee_refund.rb +14 -0
- data/lib/stripe/refund.rb +1 -0
- data/lib/stripe/stripe_object.rb +5 -2
- data/lib/stripe/util.rb +2 -1
- data/lib/stripe/version.rb +1 -1
- data/stripe.gemspec +1 -1
- data/test/stripe/application_fee_refund_test.rb +47 -0
- data/test/stripe/stripe_object_test.rb +7 -0
- data/test/test_helper.rb +23 -1
- metadata +16 -23
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjY0ZDhkYjEyMTQyYTc0Y2Q3ZDYxZDk0ZjI3YWU4NGRmMjA0YTQ5Yg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MGZhN2E0NzAwOTA0MmJkNDcyYzFjZDgzZWVjOGEzOTczOTA0NGI0YQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZWNiNzc5YTk2MThkNmIwZDlmNjg4YjI2ZmQ4ZGE4MTk0OGZjYmU4N2M4Zjdm
|
10
|
+
MzEyMjJiNjkwMTQ4NjkyYjFmNWE4YzI0MjY2ZTA5NTE4ODE5ZGVjNmNiMDBi
|
11
|
+
MThhNDQyYTUyM2I1NjVhZjc5ZjdjNjAzZTAyZjI1NjE3ZjEyNmU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Y2U1NTk4ZGJlMWVmYjI0ZTgzOWIyYzg5MzIwYTdlNGI4NDU0YTA0ZWMxZjU0
|
14
|
+
YjNjMzlmYTBkMWRiN2M4YTEzNmE3MzUyMDViNzkyNGUyZTE3MDdmZDU3OTNj
|
15
|
+
ZGUzNjI1ZWQ2YzMzMGJiODBjM2VkNjYxYjA2ZGYzNzEzMTI2YmE=
|
data/Gemfile
CHANGED
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -1,15 +1,7 @@
|
|
1
|
-
|
1
|
+
require 'rake/testtask'
|
2
2
|
|
3
|
-
task :test
|
4
|
-
ret = true
|
5
|
-
Dir["test/**/*_test.rb"].each do |f|
|
6
|
-
ret = ret && ruby(f, '')
|
7
|
-
end
|
8
|
-
end
|
3
|
+
task :default => [:test]
|
9
4
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Rake::Task["test"].reenable
|
14
|
-
Rake::Task["test"].invoke
|
15
|
-
end
|
5
|
+
Rake::TestTask.new do |t|
|
6
|
+
t.pattern = './test/**/*_test.rb'
|
7
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.15.0
|
@@ -1,3 +1,9 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
gemspec :path => File.join(File.dirname(__FILE__), "..")
|
3
|
-
|
3
|
+
|
4
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
|
5
|
+
gem 'rest-client', '~> 1.6.8'
|
6
|
+
gem 'activesupport', '~> 3.2'
|
7
|
+
else
|
8
|
+
gem 'activesupport'
|
9
|
+
end
|
data/gemfiles/json.gemfile
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
gemspec :path => File.join(File.dirname(__FILE__), "..")
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
|
5
|
+
gem 'rest-client', '~> 1.6.8'
|
6
|
+
gem 'activesupport', '~> 3.2'
|
7
|
+
else
|
8
|
+
gem 'activesupport'
|
9
|
+
end
|
10
|
+
|
11
|
+
gem 'json'
|
data/gemfiles/yajl.gemfile
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
gemspec :path => File.join(File.dirname(__FILE__), "..")
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
|
5
|
+
gem 'rest-client', '~> 1.6.8'
|
6
|
+
gem 'activesupport', '~> 3.2'
|
7
|
+
else
|
8
|
+
gem 'activesupport'
|
9
|
+
end
|
10
|
+
|
11
|
+
gem 'yajl-ruby'
|
data/lib/stripe.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Stripe
|
2
|
+
class ApplicationFeeRefund < APIResource
|
3
|
+
include Stripe::APIOperations::Update
|
4
|
+
include Stripe::APIOperations::List
|
5
|
+
|
6
|
+
def url
|
7
|
+
"#{ApplicationFee.url}/#{CGI.escape(fee)}/refunds/#{CGI.escape(id)}"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.retrieve(id, api_key=nil)
|
11
|
+
raise NotImplementedError.new("Refunds cannot be retrieved without an application fee ID. Retrieve a refund using appfee.refunds.retrieve('refund_id')")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/stripe/refund.rb
CHANGED
data/lib/stripe/stripe_object.rb
CHANGED
@@ -95,7 +95,10 @@ module Stripe
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def to_hash
|
98
|
-
@values
|
98
|
+
@values.inject({}) do |acc, (key, value)|
|
99
|
+
acc[key] = value.respond_to?(:to_hash) ? value.to_hash : value
|
100
|
+
acc
|
101
|
+
end
|
99
102
|
end
|
100
103
|
|
101
104
|
def each(&blk)
|
@@ -181,7 +184,7 @@ module Stripe
|
|
181
184
|
end
|
182
185
|
|
183
186
|
def respond_to_missing?(symbol, include_private = false)
|
184
|
-
@values.has_key?(symbol) || super
|
187
|
+
@values && @values.has_key?(symbol) || super
|
185
188
|
end
|
186
189
|
end
|
187
190
|
end
|
data/lib/stripe/util.rb
CHANGED
data/lib/stripe/version.rb
CHANGED
data/stripe.gemspec
CHANGED
@@ -13,7 +13,7 @@ spec = Gem::Specification.new do |s|
|
|
13
13
|
s.license = 'MIT'
|
14
14
|
|
15
15
|
s.add_dependency('rest-client', '~> 1.4')
|
16
|
-
s.add_dependency('mime-types', '
|
16
|
+
s.add_dependency('mime-types', '>= 1.25', '< 3.0')
|
17
17
|
s.add_dependency('json', '~> 1.8.1')
|
18
18
|
|
19
19
|
s.add_development_dependency('mocha', '~> 0.13.2')
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class ApplicationFeeRefundTest < Test::Unit::TestCase
|
5
|
+
should "refunds should be listable" do
|
6
|
+
@mock.expects(:get).once.returns(test_response(test_application_fee))
|
7
|
+
|
8
|
+
application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
|
9
|
+
|
10
|
+
assert application_fee.refunds.first.kind_of?(Stripe::ApplicationFeeRefund)
|
11
|
+
end
|
12
|
+
|
13
|
+
should "refunds should be refreshable" do
|
14
|
+
@mock.expects(:get).twice.returns(test_response(test_application_fee), test_response(test_application_fee_refund(:id => 'refreshed_refund')))
|
15
|
+
|
16
|
+
application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
|
17
|
+
refund = application_fee.refunds.first
|
18
|
+
refund.refresh
|
19
|
+
|
20
|
+
assert_equal 'refreshed_refund', refund.id
|
21
|
+
end
|
22
|
+
|
23
|
+
should "refunds should be updateable" do
|
24
|
+
@mock.expects(:get).once.returns(test_response(test_application_fee))
|
25
|
+
@mock.expects(:post).once.returns(test_response(test_application_fee_refund(:metadata => {'key' => 'value'})))
|
26
|
+
|
27
|
+
application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
|
28
|
+
refund = application_fee.refunds.first
|
29
|
+
|
30
|
+
assert_equal nil, refund.metadata['key']
|
31
|
+
|
32
|
+
refund.metadata['key'] = 'valu'
|
33
|
+
refund.save
|
34
|
+
|
35
|
+
assert_equal 'value', refund.metadata['key']
|
36
|
+
end
|
37
|
+
|
38
|
+
should "create should return a new refund" do
|
39
|
+
@mock.expects(:get).once.returns(test_response(test_application_fee))
|
40
|
+
@mock.expects(:post).once.returns(test_response(test_application_fee_refund(:id => 'test_new_refund')))
|
41
|
+
|
42
|
+
application_fee = Stripe::ApplicationFee.retrieve('test_application_fee')
|
43
|
+
refund = application_fee.refunds.create(:amount => 20)
|
44
|
+
assert_equal 'test_new_refund', refund.id
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -16,5 +16,12 @@ module Stripe
|
|
16
16
|
assert_equal 'Stripe', m.name
|
17
17
|
assert_equal 'apikey', m.api_key
|
18
18
|
end
|
19
|
+
|
20
|
+
should "recursively call to_hash on its values" do
|
21
|
+
nested = Stripe::StripeObject.construct_from({ :id => 7, :foo => 'bar' })
|
22
|
+
obj = Stripe::StripeObject.construct_from({ :id => 1, :nested => nested })
|
23
|
+
expected_hash = { :id => 1, :nested => { :id => 7, :foo => 'bar' } }
|
24
|
+
assert_equal expected_hash, obj.to_hash
|
25
|
+
end
|
19
26
|
end
|
20
27
|
end
|
data/test/test_helper.rb
CHANGED
@@ -71,20 +71,34 @@ def test_balance_transaction_array
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_application_fee(params={})
|
74
|
+
id = params[:id] || 'fee_test_fee'
|
74
75
|
{
|
75
76
|
:refunded => false,
|
76
77
|
:amount => 100,
|
77
78
|
:application => "ca_test_application",
|
78
79
|
:user => "acct_test_user",
|
79
80
|
:charge => "ch_test_charge",
|
80
|
-
:id =>
|
81
|
+
:id => id,
|
81
82
|
:livemode => false,
|
82
83
|
:currency => "usd",
|
83
84
|
:object => "application_fee",
|
85
|
+
:refunds => test_application_fee_refund_array(id),
|
84
86
|
:created => 1304114826
|
85
87
|
}.merge(params)
|
86
88
|
end
|
87
89
|
|
90
|
+
def test_application_fee_refund(params = {})
|
91
|
+
{
|
92
|
+
:object => 'fee_refund',
|
93
|
+
:amount => 30,
|
94
|
+
:currency => "usd",
|
95
|
+
:created => 1308595038,
|
96
|
+
:id => "ref_test_app_fee_refund",
|
97
|
+
:fee => "ca_test_application",
|
98
|
+
:metadata => {}
|
99
|
+
}.merge(params)
|
100
|
+
end
|
101
|
+
|
88
102
|
def test_application_fee_array
|
89
103
|
{
|
90
104
|
:data => [test_application_fee, test_application_fee, test_application_fee],
|
@@ -93,6 +107,14 @@ def test_application_fee_array
|
|
93
107
|
}
|
94
108
|
end
|
95
109
|
|
110
|
+
def test_application_fee_refund_array(fee_id)
|
111
|
+
{
|
112
|
+
:data => [test_application_fee_refund, test_application_fee_refund, test_application_fee_refund],
|
113
|
+
:object => 'list',
|
114
|
+
:url => '/v1/application_fees/' + fee_id + '/refunds'
|
115
|
+
}
|
116
|
+
end
|
117
|
+
|
96
118
|
def test_customer(params={})
|
97
119
|
id = params[:id] || 'c_test_customer'
|
98
120
|
{
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.15.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ross Boucher
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2014-
|
12
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rest-client
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,7 +21,6 @@ dependencies:
|
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
@@ -31,23 +28,26 @@ dependencies:
|
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: mime-types
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - ! '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '1.25'
|
35
|
+
- - <
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.0'
|
39
38
|
type: :runtime
|
40
39
|
prerelease: false
|
41
40
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
41
|
requirements:
|
44
|
-
- -
|
42
|
+
- - ! '>='
|
45
43
|
- !ruby/object:Gem::Version
|
46
44
|
version: '1.25'
|
45
|
+
- - <
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
47
48
|
- !ruby/object:Gem::Dependency
|
48
49
|
name: json
|
49
50
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
@@ -55,7 +55,6 @@ dependencies:
|
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
58
|
requirements:
|
60
59
|
- - ~>
|
61
60
|
- !ruby/object:Gem::Version
|
@@ -63,7 +62,6 @@ dependencies:
|
|
63
62
|
- !ruby/object:Gem::Dependency
|
64
63
|
name: mocha
|
65
64
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
65
|
requirements:
|
68
66
|
- - ~>
|
69
67
|
- !ruby/object:Gem::Version
|
@@ -71,7 +69,6 @@ dependencies:
|
|
71
69
|
type: :development
|
72
70
|
prerelease: false
|
73
71
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
72
|
requirements:
|
76
73
|
- - ~>
|
77
74
|
- !ruby/object:Gem::Version
|
@@ -79,7 +76,6 @@ dependencies:
|
|
79
76
|
- !ruby/object:Gem::Dependency
|
80
77
|
name: shoulda
|
81
78
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
79
|
requirements:
|
84
80
|
- - ~>
|
85
81
|
- !ruby/object:Gem::Version
|
@@ -87,7 +83,6 @@ dependencies:
|
|
87
83
|
type: :development
|
88
84
|
prerelease: false
|
89
85
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
86
|
requirements:
|
92
87
|
- - ~>
|
93
88
|
- !ruby/object:Gem::Version
|
@@ -95,7 +90,6 @@ dependencies:
|
|
95
90
|
- !ruby/object:Gem::Dependency
|
96
91
|
name: test-unit
|
97
92
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
93
|
requirements:
|
100
94
|
- - ! '>='
|
101
95
|
- !ruby/object:Gem::Version
|
@@ -103,7 +97,6 @@ dependencies:
|
|
103
97
|
type: :development
|
104
98
|
prerelease: false
|
105
99
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
100
|
requirements:
|
108
101
|
- - ! '>='
|
109
102
|
- !ruby/object:Gem::Version
|
@@ -111,7 +104,6 @@ dependencies:
|
|
111
104
|
- !ruby/object:Gem::Dependency
|
112
105
|
name: rake
|
113
106
|
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
107
|
requirements:
|
116
108
|
- - ! '>='
|
117
109
|
- !ruby/object:Gem::Version
|
@@ -119,7 +111,6 @@ dependencies:
|
|
119
111
|
type: :development
|
120
112
|
prerelease: false
|
121
113
|
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
114
|
requirements:
|
124
115
|
- - ! '>='
|
125
116
|
- !ruby/object:Gem::Version
|
@@ -156,6 +147,7 @@ files:
|
|
156
147
|
- lib/stripe/api_operations/update.rb
|
157
148
|
- lib/stripe/api_resource.rb
|
158
149
|
- lib/stripe/application_fee.rb
|
150
|
+
- lib/stripe/application_fee_refund.rb
|
159
151
|
- lib/stripe/balance.rb
|
160
152
|
- lib/stripe/balance_transaction.rb
|
161
153
|
- lib/stripe/card.rb
|
@@ -186,6 +178,7 @@ files:
|
|
186
178
|
- stripe.gemspec
|
187
179
|
- test/stripe/account_test.rb
|
188
180
|
- test/stripe/api_resource_test.rb
|
181
|
+
- test/stripe/application_fee_refund_test.rb
|
189
182
|
- test/stripe/application_fee_test.rb
|
190
183
|
- test/stripe/certificate_blacklist_test.rb
|
191
184
|
- test/stripe/charge_test.rb
|
@@ -205,31 +198,31 @@ files:
|
|
205
198
|
homepage: https://stripe.com/api
|
206
199
|
licenses:
|
207
200
|
- MIT
|
201
|
+
metadata: {}
|
208
202
|
post_install_message:
|
209
203
|
rdoc_options: []
|
210
204
|
require_paths:
|
211
205
|
- lib
|
212
206
|
required_ruby_version: !ruby/object:Gem::Requirement
|
213
|
-
none: false
|
214
207
|
requirements:
|
215
208
|
- - ! '>='
|
216
209
|
- !ruby/object:Gem::Version
|
217
210
|
version: '0'
|
218
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
|
-
none: false
|
220
212
|
requirements:
|
221
213
|
- - ! '>='
|
222
214
|
- !ruby/object:Gem::Version
|
223
215
|
version: '0'
|
224
216
|
requirements: []
|
225
217
|
rubyforge_project:
|
226
|
-
rubygems_version:
|
218
|
+
rubygems_version: 2.2.2
|
227
219
|
signing_key:
|
228
|
-
specification_version:
|
220
|
+
specification_version: 4
|
229
221
|
summary: Ruby bindings for the Stripe API
|
230
222
|
test_files:
|
231
223
|
- test/stripe/account_test.rb
|
232
224
|
- test/stripe/api_resource_test.rb
|
225
|
+
- test/stripe/application_fee_refund_test.rb
|
233
226
|
- test/stripe/application_fee_test.rb
|
234
227
|
- test/stripe/certificate_blacklist_test.rb
|
235
228
|
- test/stripe/charge_test.rb
|