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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 723b8cdb25dbd053853fe820e298d98d535ee211258c04d511c43712c0e51370
4
- data.tar.gz: 3306effb209ba7893725cc2b8d56556318db3bea0c7c47916acb58e2df9799e3
3
+ metadata.gz: 804a52526373349e4da9f5249ff582dd1db990d90d7c5fad2e8d9b583e2f6aec
4
+ data.tar.gz: bbb77f50eb52c41e5bfed274031a35c1547a0c583880329410e7c27c647fa15b
5
5
  SHA512:
6
- metadata.gz: f42c91932eac35091ffa52485df0c82718f79a8945668bd72fdb33cbd0c0c3ca8c71daa2296b0166fbf305892a4789cdabef4356ae3b0b582bf85db68def7695
7
- data.tar.gz: f4f530f8e6af923ccfc199136dc29a6ee0c82539aad6c1eb182f6bcceb1d230aa1690e6ba2043e19f1cb5d7cbd11a62a10b792f38643a9872b50504331bc2a0b
6
+ metadata.gz: 861c10b52c476d337c0e67e07e60275953af8e2bc33ac3f7e5aa95b1855af38f01b1b0d98c27d7a84f004f31781bd09a3cbb2296e0e16c1a49fd5b444e73424c
7
+ data.tar.gz: af892a01443315e9091723538fa0b6010d4fe3807f9171e5818c3b778c2b6b4296a0326f77aa9483fceb9e2fd5a4ff59bdaa9fc8867415ada92a05648a46ebfd
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
- sudo: false
3
2
 
4
3
  rvm:
5
4
  - 2.4.6
@@ -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
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "9.0.4"
2
+ VERSION = "9.1.0"
3
3
  end
@@ -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", ">= 0.9.8")
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")
@@ -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)
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'minitest/autorun'
3
3
  require 'webmock/minitest'
4
4
  require_relative 'lib/webmock_extensions/last_request'
5
- require 'mocha/setup'
5
+ require 'mocha/minitest'
6
6
  require 'pry'
7
7
 
8
8
  $LOAD_PATH.unshift(File.dirname(__FILE__))
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
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-03-20 00:00:00.000000000 Z
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: 0.9.8
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: 0.9.8
74
+ version: 1.4.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: webmock
77
77
  requirement: !ruby/object:Gem::Requirement