stripe 3.9.1 → 3.9.2

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
- SHA1:
3
- metadata.gz: 723bba8860a5b21cabb16483d47c3fc049db0c18
4
- data.tar.gz: e586b7a2d24c7197a3b16e62766b6203cc9c38e4
2
+ SHA256:
3
+ metadata.gz: f9f926c6f2c902aefeba870c1c7b3bdfac27b394a391096e17c0834d5016d3d1
4
+ data.tar.gz: 3e10d1311e66dcc34c67e3c75316cf6979725e6b05f362058a8138ae05d2fc70
5
5
  SHA512:
6
- metadata.gz: e47a259ec4ed3e5ff6bea20e220617de06e6e1beacdd0682e78640d06ff7e13110a0d9f9d01474eec8192d821027fd24be8c307ddf87992a9705db845c6aaf46
7
- data.tar.gz: 8683583d898179e103d59ba325806b1d4c806cf2863fdc22948a41dd159646427374466ad17a2d57c313f9cce43273a07e859de9c515bf68174b3033b4f8c94b
6
+ metadata.gz: 510a4b49893fc8ee4b7c056b4f4bcd64d17381beb83c1cb58618401353530533b7fec730be4af96d1d44f72e03b13dee69667132ea6b51acc8475066cc618a78
7
+ data.tar.gz: cd6192e48881e068b8e9fc70fd77a13decb94fcffd2016710b5d11b247515c33852e0fe2bd2afb41926419e8222611dd4f272678b8b5b0176312bb81e0a1cc32
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.9.2 - 2018-02-12
4
+ * [#625](https://github.com/stripe/stripe-ruby/pull/625) Skip calling `to_hash` for `nil`
5
+
3
6
  ## 3.9.1 - 2017-12-15
4
7
  * [#616](https://github.com/stripe/stripe-ruby/pull/616) Support all file-like objects for uploads with duck typed checks on `path` and `read` (we previously whitelisted only certain classes)
5
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.9.1
1
+ 3.9.2
@@ -116,7 +116,7 @@ module Stripe
116
116
 
117
117
  def to_hash
118
118
  maybe_to_hash = lambda do |value|
119
- value.respond_to?(:to_hash) ? value.to_hash : value
119
+ value && value.respond_to?(:to_hash) ? value.to_hash : value
120
120
  end
121
121
 
122
122
  @values.each_with_object({}) do |(key, value), acc|
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = "3.9.1".freeze
2
+ VERSION = "3.9.2".freeze
3
3
  end
@@ -115,23 +115,40 @@ module Stripe
115
115
  end
116
116
  end
117
117
 
118
- should "recursively call to_hash on its values" do
119
- # deep nested hash (when contained in an array) or StripeObject
120
- nested_hash = { id: 7, foo: "bar" }
121
- nested = Stripe::StripeObject.construct_from(nested_hash)
122
-
123
- obj = Stripe::StripeObject.construct_from(id: 1,
124
- # simple hash that contains a StripeObject to help us test deep
125
- # recursion
126
- nested: { object: "list", data: [nested] },
127
- list: [nested])
128
-
129
- expected_hash = {
130
- id: 1,
131
- nested: { object: "list", data: [nested_hash] },
132
- list: [nested_hash],
133
- }
134
- assert_equal expected_hash, obj.to_hash
118
+ context "#to_hash" do
119
+ should "skip calling to_hash on nil" do
120
+ module NilWithToHash
121
+ def to_hash
122
+ raise "Can't call to_hash on nil"
123
+ end
124
+ end
125
+ # include is private in Ruby 2.0
126
+ NilClass.send(:include, NilWithToHash)
127
+
128
+ hash_with_nil = { id: 3, foo: nil }
129
+ obj = StripeObject.construct_from(hash_with_nil)
130
+ expected_hash = { id: 3, foo: nil }
131
+ assert_equal expected_hash, obj.to_hash
132
+ end
133
+
134
+ should "recursively call to_hash on its values" do
135
+ # deep nested hash (when contained in an array) or StripeObject
136
+ nested_hash = { id: 7, foo: "bar" }
137
+ nested = Stripe::StripeObject.construct_from(nested_hash)
138
+
139
+ obj = Stripe::StripeObject.construct_from(id: 1,
140
+ # simple hash that contains a StripeObject to help us test deep
141
+ # recursion
142
+ nested: { object: "list", data: [nested] },
143
+ list: [nested])
144
+
145
+ expected_hash = {
146
+ id: 1,
147
+ nested: { object: "list", data: [nested_hash] },
148
+ list: [nested_hash],
149
+ }
150
+ assert_equal expected_hash, obj.to_hash
151
+ end
135
152
  end
136
153
 
137
154
  should "assign question mark accessors for booleans" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.1
4
+ version: 3.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-15 00:00:00.000000000 Z
11
+ date: 2018-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  requirements: []
184
184
  rubyforge_project:
185
- rubygems_version: 2.6.14
185
+ rubygems_version: 2.7.4
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: Ruby bindings for the Stripe API