stripe 1.29.1 → 1.30.0

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: 0b9e8f6bee77355210ab7840518f5431fa5f6d64
4
- data.tar.gz: 41d8c8947f222064f0828654a4c50a427e4e1c1c
3
+ metadata.gz: 061c68a3e8fbf7b2adfa0a93489b1b124b08cb37
4
+ data.tar.gz: 4fda58089700ad1f39ab8a084b09982679b4e9a1
5
5
  SHA512:
6
- metadata.gz: 1a8cb17d34c2059cea9e03130a8f866bf69f97e50c7b7a9db0d7996e303dad9a6513cd912aac2f761201564b1bd00796dda984244d88bc843f6c544662eead7b
7
- data.tar.gz: 424ec01caad2a38b43e2655381ccad190fba4e7fc8bfb1e46111b181d364273de0215e07b6bd6773a1557b9267eb054d0d91b1ae464c68b726fa2f1573c1edca
6
+ metadata.gz: b2f3f7dff2c30038b9608f825f542061eccb6461bb1c0a9bebfb754ac5d7031c00e4df16e0a753edf92c5934435dcd1bfe191dfd2bdd5744c67ffdc268f3e16c
7
+ data.tar.gz: b68dfc54c11b18e6081a5794c89d717812607f334c60744f7b0cf0ba2a65a337f8f0465c4e092471cb3709e30df8fc62267550b73d255857914b40c1d9f32c47
@@ -1,3 +1,9 @@
1
+ === 1.30.0 2015-10-09
2
+
3
+ * Add `StripeObject#deleted?` for a reliable way to check whether an object is alive
4
+ * Deprecate `StripeObject#refresh_from`
5
+ * New parameter encoding scheme that doesn't use `URI.escape`
6
+
1
7
  === 1.29.1 2015-10-06
2
8
 
3
9
  * Fix bug where ampersands were not being properly encoded
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.29.1
1
+ 1.30.0
@@ -64,6 +64,7 @@ require 'stripe/errors/rate_limit_error'
64
64
 
65
65
  module Stripe
66
66
  DEFAULT_CA_BUNDLE_PATH = File.dirname(__FILE__) + '/data/ca-certificates.crt'
67
+
67
68
  @api_base = 'https://api.stripe.com'
68
69
  @connect_base = 'https://connect.stripe.com'
69
70
  @uploads_base = 'https://uploads.stripe.com'
@@ -120,13 +121,13 @@ module Stripe
120
121
  case method.to_s.downcase.to_sym
121
122
  when :get, :head, :delete
122
123
  # Make params into GET parameters
123
- url += "#{URI.parse(url).query ? '&' : '?'}#{uri_encode(params)}" if params && params.any?
124
+ url += "#{URI.parse(url).query ? '&' : '?'}#{Util.encode_parameters(params)}" if params && params.any?
124
125
  payload = nil
125
126
  else
126
127
  if headers[:content_type] && headers[:content_type] == "multipart/form-data"
127
128
  payload = params
128
129
  else
129
- payload = uri_encode(params)
130
+ payload = Util.encode_parameters(params)
130
131
  end
131
132
  end
132
133
 
@@ -205,10 +206,13 @@ module Stripe
205
206
  "uname lookup failed"
206
207
  end
207
208
 
208
-
209
+ # DEPRECATED. Use `Util#encode_parameters` instead.
209
210
  def self.uri_encode(params)
210
- Util.flatten_params(params).
211
- map { |k,v| "#{k}=#{Util.url_encode(v)}" }.join('&')
211
+ Util.encode_parameters(params)
212
+ end
213
+ class << self
214
+ extend Gem::Deprecate
215
+ deprecate :uri_encode, "Stripe::Util#encode_parameters", 2016, 01
212
216
  end
213
217
 
214
218
  def self.request_headers(api_key)
@@ -36,7 +36,7 @@ module Stripe
36
36
  end
37
37
 
38
38
  def legal_entity=(_)
39
- raise NoMethodError.new('Overridding legal_entity can cause cause serious issues. Instead, set the individual fields of legal_entity like blah.legal_entity.first_name = \'Blah\'')
39
+ raise NoMethodError.new('Overridding legal_entity can cause serious issues. Instead, set the individual fields of legal_entity like blah.legal_entity.first_name = \'Blah\'')
40
40
  end
41
41
 
42
42
  def deauthorize(client_id, opts={})
@@ -4,7 +4,7 @@ module Stripe
4
4
  def delete(params={}, opts={})
5
5
  opts = Util.normalize_opts(opts)
6
6
  response, opts = request(:delete, url, params, opts)
7
- refresh_from(response, opts)
7
+ initialize_from(response, opts)
8
8
  end
9
9
  end
10
10
  end
@@ -20,7 +20,7 @@ module Stripe
20
20
  # We started unintentionally (sort of) allowing attributes send to
21
21
  # +save+ to override values used during the update. So as not to break
22
22
  # the API, this makes that official here.
23
- update_attributes_with_options(params, :raise_error => false)
23
+ update_attributes(params)
24
24
 
25
25
  # Now remove any parameters that look like object attributes.
26
26
  params = params.reject { |k, _| respond_to?(k) }
@@ -33,7 +33,7 @@ module Stripe
33
33
  values.delete(:id)
34
34
 
35
35
  response, opts = request(:post, req_url, values)
36
- refresh_from(response, opts)
36
+ initialize_from(response, opts)
37
37
  end
38
38
  self
39
39
  end
@@ -22,7 +22,7 @@ module Stripe
22
22
 
23
23
  def refresh
24
24
  response, opts = request(:get, url, @retrieve_params)
25
- refresh_from(response, opts)
25
+ initialize_from(response, opts)
26
26
  end
27
27
 
28
28
  def self.retrieve(id, opts={})
@@ -8,7 +8,7 @@ module Stripe
8
8
 
9
9
  def refund(params={}, opts={})
10
10
  response, opts = request(:post, refund_url, params, opts)
11
- refresh_from(response, opts)
11
+ initialize_from(response, opts)
12
12
  end
13
13
 
14
14
  private
@@ -6,23 +6,23 @@ module Stripe
6
6
 
7
7
  def refund(params={}, opts={})
8
8
  response, opts = request(:post, refund_url, params, opts)
9
- refresh_from(response, opts)
9
+ initialize_from(response, opts)
10
10
  end
11
11
 
12
12
  def capture(params={}, opts={})
13
13
  response, opts = request(:post, capture_url, params, opts)
14
- refresh_from(response, opts)
14
+ initialize_from(response, opts)
15
15
  end
16
16
 
17
17
  def update_dispute(params={}, opts={})
18
18
  response, opts = request(:post, dispute_url, params, opts)
19
- refresh_from({ :dispute => response }, opts, true)
19
+ initialize_from({ :dispute => response }, opts, true)
20
20
  dispute
21
21
  end
22
22
 
23
23
  def close_dispute(params={}, opts={})
24
24
  response, opts = request(:post, close_dispute_url, params, opts)
25
- refresh_from(response, opts)
25
+ initialize_from(response, opts)
26
26
  end
27
27
 
28
28
  def mark_as_fraudulent
@@ -30,7 +30,7 @@ module Stripe
30
30
  :fraud_details => { :user_report => 'fraudulent' }
31
31
  }
32
32
  response, opts = request(:post, url, params)
33
- refresh_from(response, opts)
33
+ initialize_from(response, opts)
34
34
  end
35
35
 
36
36
  def mark_as_safe
@@ -38,7 +38,7 @@ module Stripe
38
38
  :fraud_details => { :user_report => 'safe' }
39
39
  }
40
40
  response, opts = request(:post, url, params)
41
- refresh_from(response, opts)
41
+ initialize_from(response, opts)
42
42
  end
43
43
 
44
44
  private
@@ -37,25 +37,25 @@ module Stripe
37
37
 
38
38
  def cancel_subscription(params={}, opts={})
39
39
  response, opts = request(:delete, subscription_url, params, opts)
40
- refresh_from({ :subscription => response }, opts, true)
40
+ initialize_from({ :subscription => response }, opts, true)
41
41
  subscription
42
42
  end
43
43
 
44
44
  def update_subscription(params={}, opts={})
45
45
  response, opts = request(:post, subscription_url, params, opts)
46
- refresh_from({ :subscription => response }, opts, true)
46
+ initialize_from({ :subscription => response }, opts, true)
47
47
  subscription
48
48
  end
49
49
 
50
50
  def create_subscription(params={}, opts={})
51
51
  response, opts = request(:post, subscriptions_url, params, opts)
52
- refresh_from({ :subscription => response }, opts, true)
52
+ initialize_from({ :subscription => response }, opts, true)
53
53
  subscription
54
54
  end
55
55
 
56
56
  def delete_discount
57
57
  _, opts = request(:delete, discount_url)
58
- refresh_from({ :discount => nil }, opts, true)
58
+ initialize_from({ :discount => nil }, opts, true)
59
59
  end
60
60
 
61
61
  private
@@ -6,7 +6,7 @@ module Stripe
6
6
 
7
7
  def close(params={}, opts={})
8
8
  response, opts = request(:post, close_url, params, opts)
9
- refresh_from(response, opts)
9
+ initialize_from(response, opts)
10
10
  end
11
11
 
12
12
  def close_url
@@ -11,7 +11,7 @@ module Stripe
11
11
 
12
12
  def pay(opts={})
13
13
  response, opts = request(:post, pay_url, {}, opts)
14
- refresh_from(response, opts)
14
+ initialize_from(response, opts)
15
15
  end
16
16
 
17
17
  private
@@ -6,7 +6,7 @@ module Stripe
6
6
 
7
7
  def pay(params, opts={})
8
8
  response, opts = request(:post, pay_url, params, opts)
9
- refresh_from(response, opts)
9
+ initialize_from(response, opts)
10
10
  end
11
11
 
12
12
  private
@@ -22,7 +22,9 @@ module Stripe
22
22
 
23
23
  def self.construct_from(values, opts={})
24
24
  values = Stripe::Util.symbolize_names(values)
25
- self.new(values[:id]).refresh_from(values, opts)
25
+
26
+ # work around protected #initialize_from for now
27
+ self.new(values[:id]).send(:initialize_from, values, opts)
26
28
  end
27
29
 
28
30
  # Determines the equality of two Stripe objects. Stripe objects are
@@ -32,6 +34,13 @@ module Stripe
32
34
  @values == other.instance_variable_get(:@values)
33
35
  end
34
36
 
37
+ # Indicates whether or not the resource has been deleted on the server.
38
+ # Note that some, but not all, resources can indicate whether they have
39
+ # been deleted.
40
+ def deleted?
41
+ @values.fetch(:deleted, false)
42
+ end
43
+
35
44
  def to_s(*args)
36
45
  JSON.pretty_generate(@values)
37
46
  end
@@ -41,40 +50,36 @@ module Stripe
41
50
  "#<#{self.class}:0x#{self.object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(@values)
42
51
  end
43
52
 
53
+ # Re-initializes the object based on a hash of values (usually one that's
54
+ # come back from an API call). Adds or removes value accessors as necessary
55
+ # and updates the state of internal data.
56
+ #
57
+ # Please don't use this method. If you're trying to do mass assignment, try
58
+ # #initialize_from instead.
44
59
  def refresh_from(values, opts, partial=false)
45
- @opts = Util.normalize_opts(opts)
46
- @original_values = Marshal.load(Marshal.dump(values)) # deep copy
47
-
48
- removed = partial ? Set.new : Set.new(@values.keys - values.keys)
49
- added = Set.new(values.keys - @values.keys)
50
-
51
- # Wipe old state before setting new. This is useful for e.g. updating a
52
- # customer, where there is no persistent card parameter. Mark those values
53
- # which don't persist as transient
54
-
55
- instance_eval do
56
- remove_accessors(removed)
57
- add_accessors(added, values)
58
- end
59
-
60
- removed.each do |k|
61
- @values.delete(k)
62
- @transient_values.add(k)
63
- @unsaved_values.delete(k)
64
- end
65
-
66
- update_attributes_with_options(values, :opts => opts)
67
- values.each do |k, _|
68
- @transient_values.delete(k)
69
- @unsaved_values.delete(k)
70
- end
71
-
72
- return self
60
+ initialize_from(values, opts, partial)
73
61
  end
62
+ extend Gem::Deprecate
63
+ deprecate :refresh_from, "#update_attributes", 2016, 01
74
64
 
75
65
  # Mass assigns attributes on the model.
76
- def update_attributes(values)
77
- update_attributes_with_options(values, {})
66
+ #
67
+ # This is a version of +update_attributes+ that takes some extra options
68
+ # for internal use.
69
+ #
70
+ # ==== Attributes
71
+ #
72
+ # * +values+ - Hash of values to use to update the current attributes of
73
+ # the object.
74
+ #
75
+ # ==== Options
76
+ #
77
+ # * +:opts+ Options for StripeObject like an API key.
78
+ def update_attributes(values, opts = {})
79
+ values.each do |k, v|
80
+ @values[k] = Util.convert_to_stripe_object(v, opts)
81
+ @unsaved_values.add(k)
82
+ end
78
83
  end
79
84
 
80
85
  def [](k)
@@ -294,6 +299,49 @@ module Stripe
294
299
  @values && @values.has_key?(symbol) || super
295
300
  end
296
301
 
302
+ # Re-initializes the object based on a hash of values (usually one that's
303
+ # come back from an API call). Adds or removes value accessors as necessary
304
+ # and updates the state of internal data.
305
+ #
306
+ # Protected on purpose! Please do not expose.
307
+ #
308
+ # ==== Options
309
+ #
310
+ # * +:values:+ Hash used to update accessors and values.
311
+ # * +:opts:+ Options for StripeObject like an API key.
312
+ # * +:partial:+ Indicates that the re-initialization should not attempt to
313
+ # remove accessors.
314
+ def initialize_from(values, opts, partial=false)
315
+ @opts = Util.normalize_opts(opts)
316
+ @original_values = Marshal.load(Marshal.dump(values)) # deep copy
317
+
318
+ removed = partial ? Set.new : Set.new(@values.keys - values.keys)
319
+ added = Set.new(values.keys - @values.keys)
320
+
321
+ # Wipe old state before setting new. This is useful for e.g. updating a
322
+ # customer, where there is no persistent card parameter. Mark those values
323
+ # which don't persist as transient
324
+
325
+ instance_eval do
326
+ remove_accessors(removed)
327
+ add_accessors(added, values)
328
+ end
329
+
330
+ removed.each do |k|
331
+ @values.delete(k)
332
+ @transient_values.add(k)
333
+ @unsaved_values.delete(k)
334
+ end
335
+
336
+ update_attributes(values, :opts => opts)
337
+ values.each do |k, _|
338
+ @transient_values.delete(k)
339
+ @unsaved_values.delete(k)
340
+ end
341
+
342
+ self
343
+ end
344
+
297
345
  # Mass assigns attributes on the model.
298
346
  #
299
347
  # This is a version of +update_attributes+ that takes some extra options
@@ -13,7 +13,7 @@ module Stripe
13
13
 
14
14
  def delete_discount
15
15
  response, opts = request(:delete, discount_url)
16
- refresh_from({ :discount => nil }, opts, true)
16
+ initialize_from({ :discount => nil }, opts, true)
17
17
  end
18
18
 
19
19
  private
@@ -6,7 +6,7 @@ module Stripe
6
6
 
7
7
  def cancel
8
8
  response, api_key = Stripe.request(:post, cancel_url, @api_key)
9
- refresh_from(response, api_key)
9
+ initialize_from(response, api_key)
10
10
  end
11
11
 
12
12
  def cancel_url
@@ -1,3 +1,5 @@
1
+ require "cgi"
2
+
1
3
  module Stripe
2
4
  module Util
3
5
  def self.objects_to_ids(h)
@@ -92,14 +94,30 @@ module Stripe
92
94
  end
93
95
  end
94
96
 
97
+ # Encodes a hash of parameters in a way that's suitable for use as query
98
+ # parameters in a URI or as form parameters in a request body. This mainly
99
+ # involves escaping special characters from parameter keys and values (e.g.
100
+ # `&`).
101
+ def self.encode_parameters(params)
102
+ Util.flatten_params(params).
103
+ map { |k,v| "#{url_encode(k)}=#{url_encode(v)}" }.join('&')
104
+ end
105
+
106
+ # Encodes a string in a way that makes it suitable for use in a set of
107
+ # query parameters in a URI or in a set of form parameters in a request
108
+ # body.
95
109
  def self.url_encode(key)
96
- URI.escape(key.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
110
+ CGI.escape(key.to_s).
111
+ # Don't use strict form encoding by changing the square bracket control
112
+ # characters back to their literals. This is fine by the server, and
113
+ # makes these parameter strings easier to read.
114
+ gsub('%5B', '[').gsub('%5D', ']')
97
115
  end
98
116
 
99
117
  def self.flatten_params(params, parent_key=nil)
100
118
  result = []
101
119
  params.each do |key, value|
102
- calculated_key = parent_key ? "#{parent_key}[#{url_encode(key)}]" : url_encode(key)
120
+ calculated_key = parent_key ? "#{parent_key}[#{key}]" : "#{key}"
103
121
  if value.is_a?(Hash)
104
122
  result += flatten_params(value, calculated_key)
105
123
  elsif value.is_a?(Array)
@@ -108,7 +126,12 @@ module Stripe
108
126
  result << [calculated_key, value]
109
127
  end
110
128
  end
111
- result
129
+
130
+ # The #sort_by call here is mostly so that we can get some stability in
131
+ # our 1.8.7 test suite where Hash key order is not preserved.
132
+ #
133
+ # https://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
134
+ result.sort_by { |(k, _)| k }
112
135
  end
113
136
 
114
137
  def self.flatten_params_array(value, calculated_key)
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = '1.29.1'
2
+ VERSION = '1.30.0'
3
3
  end
@@ -68,7 +68,7 @@ module Stripe
68
68
 
69
69
  @mock.expects(:post).
70
70
  once.
71
- with('https://api.stripe.com/v1/accounts/acct_foo', nil, 'legal_entity[first_name]=Bob&legal_entity[address][line1]=2%20Three%20Four').
71
+ with('https://api.stripe.com/v1/accounts/acct_foo', nil, 'legal_entity[address][line1]=2+Three+Four&legal_entity[first_name]=Bob').
72
72
  returns(make_response(resp))
73
73
 
74
74
  a = Stripe::Account.retrieve('acct_foo')
@@ -230,7 +230,7 @@ module Stripe
230
230
 
231
231
  should "urlencode values in GET params" do
232
232
  response = make_response(make_charge_array)
233
- @mock.expects(:get).with("#{Stripe.api_base}/v1/charges?customer=test%20customer", nil, nil).returns(response)
233
+ @mock.expects(:get).with("#{Stripe.api_base}/v1/charges?customer=test+customer", nil, nil).returns(response)
234
234
  charges = Stripe::Charge.list(:customer => 'test customer').data
235
235
  assert charges.kind_of? Array
236
236
  end
@@ -60,7 +60,7 @@ module Stripe
60
60
 
61
61
  if is_greater_than_ruby_1_9?
62
62
  check_metadata({:metadata => {:initial => 'true'}},
63
- 'metadata[uuid]=6735&metadata[initial]=',
63
+ 'metadata[initial]=&metadata[uuid]=6735',
64
64
  update_actions)
65
65
  end
66
66
  end
@@ -93,7 +93,7 @@ module Stripe
93
93
  obj.metadata['uuid'] = '6735'
94
94
  end
95
95
  params = {:metadata => {'type' => 'summer', 'uuid' => '6735'}}
96
- curl_args = Stripe.uri_encode(params)
96
+ curl_args = Stripe::Util.encode_parameters(params)
97
97
  check_metadata({:metadata => {'type' => 'christmas'}},
98
98
  curl_args,
99
99
  update_actions)
@@ -11,6 +11,17 @@ module Stripe
11
11
  refute obj1 == obj3
12
12
  end
13
13
 
14
+ should "implement #deleted?" do
15
+ obj = Stripe::StripeObject.construct_from({})
16
+ refute obj.deleted?
17
+
18
+ obj = Stripe::StripeObject.construct_from({ :deleted => false })
19
+ refute obj.deleted?
20
+
21
+ obj = Stripe::StripeObject.construct_from({ :deleted => true })
22
+ assert obj.deleted?
23
+ end
24
+
14
25
  should "implement #respond_to" do
15
26
  obj = Stripe::StripeObject.construct_from({ :id => 1, :foo => 'bar' })
16
27
  assert obj.respond_to?(:id)
@@ -53,10 +64,25 @@ module Stripe
53
64
  obj.update_attributes(:name => 'STRIPE')
54
65
  assert_equal "STRIPE", obj.name
55
66
 
56
- e = assert_raises(ArgumentError) do
57
- obj.update_attributes(:foo => 'bar')
67
+ # unfortunately, we even assign unknown properties to duplicate the
68
+ # behavior that we currently have via magic accessors with
69
+ # method_missing
70
+ obj.update_attributes(:unknown => 'foo')
71
+ assert_equal "foo", obj.unknown
72
+ end
73
+
74
+ should "warn that #refresh_from is deprecated" do
75
+ old_stderr = $stderr
76
+ $stderr = StringIO.new
77
+ begin
78
+ obj = Stripe::StripeObject.construct_from({})
79
+ obj.refresh_from({}, {})
80
+ message = "NOTE: Stripe::StripeObject#refresh_from is " +
81
+ "deprecated; use #update_attributes instead"
82
+ assert_match Regexp.new(message), $stderr.string
83
+ ensure
84
+ $stderr = old_stderr
58
85
  end
59
- assert_equal "foo is not an attribute that can be assigned on this object", e.message
60
86
  end
61
87
  end
62
88
  end
@@ -2,7 +2,48 @@ require File.expand_path('../../test_helper', __FILE__)
2
2
 
3
3
  module Stripe
4
4
  class UtilTest < Test::Unit::TestCase
5
- should "symbolize_names should convert names to symbols" do
5
+ should "#encode_parameters should prepare parameters for an HTTP request" do
6
+ params = {
7
+ :a => 3,
8
+ :b => "+foo?",
9
+ :c => "bar&baz",
10
+ :d => { :a => "a", :b => "b" },
11
+ :e => [0, 1],
12
+ }
13
+ assert_equal(
14
+ "a=3&b=%2Bfoo%3F&c=bar%26baz&d[a]=a&d[b]=b&e[]=0&e[]=1",
15
+ Stripe::Util.encode_parameters(params)
16
+ )
17
+ end
18
+
19
+ should "#url_encode should prepare strings for HTTP" do
20
+ assert_equal "foo", Stripe::Util.url_encode("foo")
21
+ assert_equal "foo", Stripe::Util.url_encode(:foo)
22
+ assert_equal "foo%2B", Stripe::Util.url_encode("foo+")
23
+ assert_equal "foo%26", Stripe::Util.url_encode("foo&")
24
+ assert_equal "foo[bar]", Stripe::Util.url_encode("foo[bar]")
25
+ end
26
+
27
+ should "#flatten_params should encode parameters according to Rails convention" do
28
+ params = {
29
+ :a => 3,
30
+ :b => "foo?",
31
+ :c => "bar&baz",
32
+ :d => { :a => "a", :b => "b" },
33
+ :e => [0, 1],
34
+ }
35
+ assert_equal([
36
+ ["a", 3],
37
+ ["b", "foo?"],
38
+ ["c", "bar&baz"],
39
+ ["d[a]", "a"],
40
+ ["d[b]", "b"],
41
+ ["e[]", 0],
42
+ ["e[]", 1],
43
+ ], Stripe::Util.flatten_params(params))
44
+ end
45
+
46
+ should "#symbolize_names should convert names to symbols" do
6
47
  start = {
7
48
  'foo' => 'bar',
8
49
  'array' => [{ 'foo' => 'bar' }],
@@ -26,7 +67,7 @@ module Stripe
26
67
  assert_equal(finish, symbolized)
27
68
  end
28
69
 
29
- should "normalize_opts should reject nil keys" do
70
+ should "#normalize_opts should reject nil keys" do
30
71
  assert_raise { Stripe::Util.normalize_opts(nil) }
31
72
  assert_raise { Stripe::Util.normalize_opts(:api_key => nil) }
32
73
  end
@@ -0,0 +1,16 @@
1
+ require File.expand_path('../test_helper', __FILE__)
2
+
3
+ class StripeTest < Test::Unit::TestCase
4
+ should "warn that #refresh_from is deprecated" do
5
+ old_stderr = $stderr
6
+ $stderr = StringIO.new
7
+ begin
8
+ Stripe.uri_encode({})
9
+ message = "NOTE: Stripe.uri_encode is deprecated; use " +
10
+ "Stripe::Util#encode_parameters instead"
11
+ assert_match Regexp.new(message), $stderr.string
12
+ ensure
13
+ $stderr = old_stderr
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.29.1
4
+ version: 1.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Boucher
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-06 00:00:00.000000000 Z
12
+ date: 2015-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -193,6 +193,7 @@ files:
193
193
  - test/stripe/subscription_test.rb
194
194
  - test/stripe/transfer_test.rb
195
195
  - test/stripe/util_test.rb
196
+ - test/stripe_test.rb
196
197
  - test/test_data.rb
197
198
  - test/test_helper.rb
198
199
  homepage: https://stripe.com/api
@@ -247,6 +248,7 @@ test_files:
247
248
  - test/stripe/subscription_test.rb
248
249
  - test/stripe/transfer_test.rb
249
250
  - test/stripe/util_test.rb
251
+ - test/stripe_test.rb
250
252
  - test/test_data.rb
251
253
  - test/test_helper.rb
252
254
  has_rdoc: