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 +5 -5
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/stripe/stripe_object.rb +1 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/stripe_object_test.rb +34 -17
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f9f926c6f2c902aefeba870c1c7b3bdfac27b394a391096e17c0834d5016d3d1
|
4
|
+
data.tar.gz: 3e10d1311e66dcc34c67e3c75316cf6979725e6b05f362058a8138ae05d2fc70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
3.9.2
|
data/lib/stripe/stripe_object.rb
CHANGED
@@ -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|
|
data/lib/stripe/version.rb
CHANGED
@@ -115,23 +115,40 @@ module Stripe
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
id:
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
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.
|
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:
|
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.
|
185
|
+
rubygems_version: 2.7.4
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Ruby bindings for the Stripe API
|