stripe 3.26.0 → 3.26.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a8e4c5dabe1fd48d0cfeddea151a30bee86c8547
4
- data.tar.gz: 726a6104b5ecdf200bd80c0b453257304be359c8
2
+ SHA256:
3
+ metadata.gz: 4ac82de8d5c93956f56ab752a21fbd5470aa3f2452c7360c8bad21b62437f1de
4
+ data.tar.gz: 4c03b8ed0e4d03a24a4b18e6668147b7c88e4ae1977cbb5d7d6319ff4c0535f0
5
5
  SHA512:
6
- metadata.gz: 7f9c83449bc4558dbd2a89b6a41cfa4e4ab35b985c073eb278039114bca94b0c21fe1167a55c68098a40f0cd87f37a742d7ca181aaf2d940efed372b20e55b9a
7
- data.tar.gz: 935f38cfdbfd7edfbd84f72ece0b89db1cd8a3198ee0a6cafb52d7d9058f4e64374e25e2454795afbcbc63415bea8ae465ed03ffbc99d5a95143126aade66a15
6
+ metadata.gz: 3094e2f430018ebba15fe8f78c6b9e28480c8f47ec5aeb3185296a5c7f27357673b3436f1631c76bdc5b09535bdd6885794de7a5b24c6cfe4d6d2fb16e1c68b5
7
+ data.tar.gz: ef354896a762a5cb3fd34028f9f04413bf1b576b44d040167b2e51fd6724164cb72821a2f4be02679c16ea4663738409b6a83ffd8426a4de2191832f397ed250
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.26.1 - 2018-09-14
4
+ * [#688](https://github.com/stripe/stripe-ruby/pull/688) Fix hash equality on `StripeObject`
5
+
3
6
  ## 3.26.0 - 2018-09-05
4
7
  * [#681](https://github.com/stripe/stripe-ruby/pull/681) Add support for reporting resources
5
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.26.0
1
+ 3.26.1
@@ -96,6 +96,17 @@ module Stripe
96
96
  other.is_a?(StripeObject) && @values == other.instance_variable_get(:@values)
97
97
  end
98
98
 
99
+ # Hash equality. As with ==, we consider two equivalent Stripe objects equal.
100
+ def eql?(other)
101
+ self == other
102
+ end
103
+
104
+ # As for equality, we hash to Stripe objects to the same value if they're
105
+ # equivalent objects.
106
+ def hash
107
+ @values.hash
108
+ end
109
+
99
110
  # Indicates whether or not the resource has been deleted on the server.
100
111
  # Note that some, but not all, resources can indicate whether they have
101
112
  # been deleted.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "3.26.0".freeze
4
+ VERSION = "3.26.1".freeze
5
5
  end
@@ -117,6 +117,46 @@ module Stripe
117
117
  end
118
118
  end
119
119
 
120
+ context "#eql?" do
121
+ should "produce the true for two equivalent Stripe objects" do
122
+ obj1 = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
123
+ obj2 = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
124
+ assert obj1.eql?(obj2)
125
+ end
126
+
127
+ should "produce false for non-equivalent Stripe objects" do
128
+ obj1 = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
129
+ obj2 = Stripe::StripeObject.construct_from(id: 2, name: "Stripe")
130
+ refute obj1.eql?(obj2)
131
+ end
132
+
133
+ should "produce false for different types" do
134
+ obj1 = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
135
+ obj2 = 7
136
+ refute obj1.eql?(obj2)
137
+ end
138
+ end
139
+
140
+ context "#hash" do
141
+ should "produce the same hash for two equivalent Stripe objects" do
142
+ obj1 = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
143
+ obj2 = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
144
+ assert_equal obj1.hash, obj2.hash
145
+ end
146
+
147
+ should "produce different hashes for non-equivalent Stripe objects" do
148
+ obj1 = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
149
+ obj2 = Stripe::StripeObject.construct_from(id: 2, name: "Stripe")
150
+ refute_equal obj1.hash, obj2.hash
151
+ end
152
+
153
+ should "produce different hashes for different types" do
154
+ obj1 = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")
155
+ obj2 = 7
156
+ refute_equal obj1.hash, obj2.hash
157
+ end
158
+ end
159
+
120
160
  context "#to_hash" do
121
161
  should "skip calling to_hash on nil" do
122
162
  module NilWithToHash
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.26.0
4
+ version: 3.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-05 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  requirements: []
213
213
  rubyforge_project:
214
- rubygems_version: 2.6.14
214
+ rubygems_version: 2.7.7
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Ruby bindings for the Stripe API