shopify_api 9.0.4 → 9.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +4 -0
- data/lib/shopify_api/session.rb +16 -0
- data/lib/shopify_api/version.rb +1 -1
- data/shopify_api.gemspec +1 -1
- data/test/session_test.rb +121 -0
- data/test/test_helper.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 804a52526373349e4da9f5249ff582dd1db990d90d7c5fad2e8d9b583e2f6aec
|
4
|
+
data.tar.gz: bbb77f50eb52c41e5bfed274031a35c1547a0c583880329410e7c27c647fa15b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 861c10b52c476d337c0e67e07e60275953af8e2bc33ac3f7e5aa95b1855af38f01b1b0d98c27d7a84f004f31781bd09a3cbb2296e0e16c1a49fd5b444e73424c
|
7
|
+
data.tar.gz: af892a01443315e9091723538fa0b6010d4fe3807f9171e5818c3b778c2b6b4296a0326f77aa9483fceb9e2fd5a4ff59bdaa9fc8867415ada92a05648a46ebfd
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## Version 9.1.0
|
2
|
+
|
3
|
+
* Implements equality operator on `Session` [#714](https://github.com/Shopify/shopify_api/pull/714)
|
4
|
+
|
1
5
|
## Version 9.0.4
|
2
6
|
|
3
7
|
* Contains [#708](https://github.com/Shopify/shopify_api/pull/708) which is a revert for [#655](https://github.com/shopify/shopify_api/pull/655) due to the deprecated inventory parameters not being removed correctly in some cases
|
data/lib/shopify_api/session.rb
CHANGED
@@ -149,6 +149,22 @@ module ShopifyAPI
|
|
149
149
|
expires_in <= 0
|
150
150
|
end
|
151
151
|
|
152
|
+
def hash
|
153
|
+
state.hash
|
154
|
+
end
|
155
|
+
|
156
|
+
def ==(other)
|
157
|
+
self.class == other.class && state == other.state
|
158
|
+
end
|
159
|
+
|
160
|
+
alias_method :eql?, :==
|
161
|
+
|
162
|
+
protected
|
163
|
+
|
164
|
+
def state
|
165
|
+
[domain, token, api_version, extra]
|
166
|
+
end
|
167
|
+
|
152
168
|
private
|
153
169
|
|
154
170
|
def parameterize(params)
|
data/lib/shopify_api/version.rb
CHANGED
data/shopify_api.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_runtime_dependency("rack")
|
32
32
|
s.add_runtime_dependency("graphql-client")
|
33
33
|
|
34
|
-
s.add_development_dependency("mocha", ">=
|
34
|
+
s.add_development_dependency("mocha", ">= 1.4.0")
|
35
35
|
s.add_development_dependency("webmock")
|
36
36
|
s.add_development_dependency("minitest", ">= 4.0")
|
37
37
|
s.add_development_dependency("rake")
|
data/test/session_test.rb
CHANGED
@@ -346,6 +346,127 @@ class SessionTest < Test::Unit::TestCase
|
|
346
346
|
assert_equal('testshop.myshopify.com', session.url)
|
347
347
|
end
|
348
348
|
|
349
|
+
test "#hash returns the same value for equal Sessions" do
|
350
|
+
session = ShopifyAPI::Session.new(
|
351
|
+
domain: "http://testshop.myshopify.com",
|
352
|
+
token: "any-token",
|
353
|
+
api_version: '2019-01',
|
354
|
+
extra: { foo: "bar" }
|
355
|
+
)
|
356
|
+
other_session = ShopifyAPI::Session.new(
|
357
|
+
domain: "http://testshop.myshopify.com",
|
358
|
+
token: "any-token",
|
359
|
+
api_version: '2019-01',
|
360
|
+
extra: { foo: "bar" }
|
361
|
+
)
|
362
|
+
assert_equal(session.hash, other_session.hash)
|
363
|
+
end
|
364
|
+
|
365
|
+
test "equality verifies domain" do
|
366
|
+
session = ShopifyAPI::Session.new(
|
367
|
+
domain: "http://testshop.myshopify.com",
|
368
|
+
token: "any-token",
|
369
|
+
api_version: '2019-01',
|
370
|
+
extra: { foo: "bar" }
|
371
|
+
)
|
372
|
+
other_session = ShopifyAPI::Session.new(
|
373
|
+
domain: "http://testshop.myshopify.com",
|
374
|
+
token: "any-token",
|
375
|
+
api_version: '2019-01',
|
376
|
+
extra: { foo: "bar" }
|
377
|
+
)
|
378
|
+
different_session = ShopifyAPI::Session.new(
|
379
|
+
domain: "http://another_testshop.myshopify.com",
|
380
|
+
token: "any-token",
|
381
|
+
api_version: '2019-01',
|
382
|
+
extra: { foo: "bar" }
|
383
|
+
)
|
384
|
+
assert_equal(session, other_session)
|
385
|
+
refute_equal(session, different_session)
|
386
|
+
end
|
387
|
+
|
388
|
+
test "equality verifies token" do
|
389
|
+
session = ShopifyAPI::Session.new(
|
390
|
+
domain: "http://testshop.myshopify.com",
|
391
|
+
token: "any-token",
|
392
|
+
api_version: '2019-01',
|
393
|
+
extra: { foo: "bar" }
|
394
|
+
)
|
395
|
+
different_session = ShopifyAPI::Session.new(
|
396
|
+
domain: "http://testshop.myshopify.com",
|
397
|
+
token: "very-different-token",
|
398
|
+
api_version: '2019-01',
|
399
|
+
extra: { foo: "bar" }
|
400
|
+
)
|
401
|
+
refute_equal(session, different_session)
|
402
|
+
end
|
403
|
+
|
404
|
+
test "equality verifies api_version" do
|
405
|
+
session = ShopifyAPI::Session.new(
|
406
|
+
domain: "http://testshop.myshopify.com",
|
407
|
+
token: "any-token",
|
408
|
+
api_version: '2019-01',
|
409
|
+
extra: { foo: "bar" }
|
410
|
+
)
|
411
|
+
different_session = ShopifyAPI::Session.new(
|
412
|
+
domain: "http://testshop.myshopify.com",
|
413
|
+
token: "any-token",
|
414
|
+
api_version: :unstable,
|
415
|
+
extra: { foo: "bar" }
|
416
|
+
)
|
417
|
+
refute_equal(session, different_session)
|
418
|
+
end
|
419
|
+
|
420
|
+
test "equality verifies extra" do
|
421
|
+
session = ShopifyAPI::Session.new(
|
422
|
+
domain: "http://testshop.myshopify.com",
|
423
|
+
token: "any-token",
|
424
|
+
api_version: '2019-01',
|
425
|
+
extra: { foo: "bar" }
|
426
|
+
)
|
427
|
+
different_session = ShopifyAPI::Session.new(
|
428
|
+
domain: "http://testshop.myshopify.com",
|
429
|
+
token: "any-token",
|
430
|
+
api_version: '2019-01',
|
431
|
+
extra: { bar: "other-bar" }
|
432
|
+
)
|
433
|
+
refute_equal(session, different_session)
|
434
|
+
end
|
435
|
+
|
436
|
+
test "equality verifies other is a Session" do
|
437
|
+
session = ShopifyAPI::Session.new(
|
438
|
+
domain: "http://testshop.myshopify.com",
|
439
|
+
token: "any-token",
|
440
|
+
api_version: '2019-01',
|
441
|
+
extra: { foo: "bar" }
|
442
|
+
)
|
443
|
+
different_session = nil
|
444
|
+
refute_equal(session, different_session)
|
445
|
+
end
|
446
|
+
|
447
|
+
test "#eql? and #hash are implemented" do
|
448
|
+
session = ShopifyAPI::Session.new(
|
449
|
+
domain: "http://testshop.myshopify.com",
|
450
|
+
token: "any-token",
|
451
|
+
api_version: '2019-01',
|
452
|
+
extra: { foo: "bar" }
|
453
|
+
)
|
454
|
+
other_session = ShopifyAPI::Session.new(
|
455
|
+
domain: "http://testshop.myshopify.com",
|
456
|
+
token: "any-token",
|
457
|
+
api_version: '2019-01',
|
458
|
+
extra: { foo: "bar" }
|
459
|
+
)
|
460
|
+
different_session = ShopifyAPI::Session.new(
|
461
|
+
domain: "http://another_testshop.myshopify.com",
|
462
|
+
token: "any-token",
|
463
|
+
api_version: '2019-01',
|
464
|
+
extra: { foo: "bar" }
|
465
|
+
)
|
466
|
+
|
467
|
+
assert_equal([session, different_session], [session, other_session, different_session].uniq)
|
468
|
+
end
|
469
|
+
|
349
470
|
private
|
350
471
|
|
351
472
|
def make_sorted_params(params)
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.0
|
4
|
+
version: 9.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 1.4.0
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: 1.4.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: webmock
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|