stripe 1.5.26 → 1.6.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.
Files changed (3) hide show
  1. data/lib/stripe.rb +14 -42
  2. data/lib/stripe/version.rb +1 -1
  3. metadata +6 -6
@@ -53,7 +53,8 @@ module Stripe
53
53
  'invoiceitem' => InvoiceItem,
54
54
  'invoice' => Invoice,
55
55
  'plan' => Plan,
56
- 'coupon' => Coupon
56
+ 'coupon' => Coupon,
57
+ 'event' => Event
57
58
  }
58
59
  case resp
59
60
  when Array
@@ -149,7 +150,6 @@ module Stripe
149
150
 
150
151
  attr_accessor :api_key
151
152
  @@permanent_attributes = Set.new([:api_key])
152
- @@ignored_attributes = Set.new([:id, :api_key, :object])
153
153
 
154
154
  # The default :id method is deprecated and isn't useful to us
155
155
  if method_defined?(:id)
@@ -172,37 +172,11 @@ module Stripe
172
172
  obj
173
173
  end
174
174
 
175
- def to_s(*args); inspect(*args); end
176
- def inspect(verbose=false, nested=false)
177
- str = ["#<#{self.class}"]
178
- if (desc = ident.compact).length > 0
179
- str << "[#{desc.join(', ')}]"
180
- end
181
-
182
- if !verbose and nested
183
- str << ' ...'
184
- else
185
- content = @values.keys.sort { |a, b| a.to_s <=> b.to_s }.map do |k|
186
- if @@ignored_attributes.include?(k)
187
- nil
188
- else
189
- v = @values[k]
190
- v = v.kind_of?(StripeObject) ? v.inspect(verbose, true) : v.inspect
191
- v = @unsaved_values.include?(k) ? "#{v} (unsaved)" : v
192
- "#{k}=#{v}"
193
- end
194
- end.compact.join(', ')
195
-
196
- str << ' '
197
- if content.length > 0
198
- str << content
199
- else
200
- str << '(no attributes)'
201
- end
202
- end
175
+ def to_s(*args); JSON.pretty_generate(@values); end
203
176
 
204
- str << ">"
205
- str.join
177
+ def inspect()
178
+ id_string = (self.respond_to?(:id) && !self.id.nil?) ? " id=#{self.id}" : ""
179
+ "#<#{self.class}:0x#{self.object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(@values)
206
180
  end
207
181
 
208
182
  def refresh_from(values, api_key, partial=false)
@@ -245,10 +219,6 @@ module Stripe
245
219
 
246
220
  protected
247
221
 
248
- def ident
249
- [@values[:object], @values[:id]]
250
- end
251
-
252
222
  def metaclass
253
223
  class << self; self; end
254
224
  end
@@ -272,7 +242,7 @@ module Stripe
272
242
  define_method(k) { @values[k] }
273
243
  define_method(k_eq) do |v|
274
244
  @values[k] = v
275
- @unsaved_values.add(k) unless @@ignored_attributes.include?(k)
245
+ @unsaved_values.add(k)
276
246
  end
277
247
  end
278
248
  end
@@ -283,7 +253,7 @@ module Stripe
283
253
  if name.to_s.end_with?('=')
284
254
  attr = name.to_s[0...-1].to_sym
285
255
  @values[attr] = args[0]
286
- @unsaved_values.add(attr) unless @@ignored_attributes.include?(attr)
256
+ @unsaved_values.add(attr)
287
257
  add_accessors([attr])
288
258
  return
289
259
  else
@@ -329,10 +299,6 @@ module Stripe
329
299
  end
330
300
 
331
301
  protected
332
-
333
- def ident
334
- [@values[:id]]
335
- end
336
302
  end
337
303
 
338
304
  class Customer < APIResource
@@ -401,6 +367,7 @@ module Stripe
401
367
  class Charge < APIResource
402
368
  include Stripe::APIOperations::List
403
369
  include Stripe::APIOperations::Create
370
+ include Stripe::APIOperations::Update
404
371
 
405
372
  def refund(params={})
406
373
  response, api_key = Stripe.request(:post, refund_url, @api_key, params)
@@ -458,6 +425,11 @@ module Stripe
458
425
  @http_body = http_body
459
426
  @json_body = json_body
460
427
  end
428
+
429
+ def to_s
430
+ status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
431
+ "#{status_string}#{@message}"
432
+ end
461
433
  end
462
434
 
463
435
  class APIError < StripeError; end
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = '1.5.26'
2
+ VERSION = '1.6.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 5
9
- - 26
10
- version: 1.5.26
8
+ - 6
9
+ - 0
10
+ version: 1.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ross Boucher
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-01-27 00:00:00 Z
19
+ date: 2012-01-30 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rest-client
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  requirements: []
125
125
 
126
126
  rubyforge_project:
127
- rubygems_version: 1.8.8
127
+ rubygems_version: 1.8.11
128
128
  signing_key:
129
129
  specification_version: 3
130
130
  summary: Ruby bindings for the Stripe API