shopify_app 7.0.2 → 7.0.4
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 +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG +10 -0
- data/lib/shopify_app/scripttags_manager.rb +7 -20
- data/lib/shopify_app/scripttags_manager_job.rb +5 -6
- data/lib/shopify_app/version.rb +1 -1
- data/lib/shopify_app/webhooks_manager.rb +7 -20
- data/lib/shopify_app/webhooks_manager_job.rb +5 -6
- data/shopify_app.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24adcdf60d551e803f895d21e59cc2a8d1e3568c
|
4
|
+
data.tar.gz: b06241bf4f3ab38210efec82139536297009eb94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01fb498f9ec1a9d5c379dfb9c13b6739c31acf4ea5358e9dfcfbfc4632731f321d967838b59763c6202ca32aa82fe570a7e49e9edb4e8d4373c36f01306af317
|
7
|
+
data.tar.gz: b911f97a9d859fc2fa1b4bf58a97b870e66d74780a5b622795f930acb4e7c004a3c87468e4691ad386ca0534923bae9f74e7e5cd1b033dce0f86649f5aa48064
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -2,12 +2,8 @@ module ShopifyApp
|
|
2
2
|
class ScripttagsManager
|
3
3
|
class CreationFailed < StandardError; end
|
4
4
|
|
5
|
-
def self.queue(
|
6
|
-
ShopifyApp::ScripttagsManagerJob.perform_later(
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize(shop_name, token)
|
10
|
-
@shop_name, @token = shop_name, token
|
5
|
+
def self.queue(shop_domain, shop_token)
|
6
|
+
ShopifyApp::ScripttagsManagerJob.perform_later(shop_domain: shop_domain, shop_token: shop_token)
|
11
7
|
end
|
12
8
|
|
13
9
|
def recreate_scripttags!
|
@@ -18,19 +14,16 @@ module ShopifyApp
|
|
18
14
|
def create_scripttags
|
19
15
|
return unless required_scripttags.present?
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
create_scripttag(scripttag) unless scripttag_exists?(scripttag[:src])
|
24
|
-
end
|
17
|
+
required_scripttags.each do |scripttag|
|
18
|
+
create_scripttag(scripttag) unless scripttag_exists?(scripttag[:src])
|
25
19
|
end
|
26
20
|
end
|
27
21
|
|
28
22
|
def destroy_scripttags
|
29
|
-
|
30
|
-
ShopifyAPI::ScriptTag.
|
31
|
-
ShopifyAPI::ScriptTag.delete(scripttag.id) if is_required_scripttag?(scripttag)
|
32
|
-
end
|
23
|
+
ShopifyAPI::ScriptTag.all.each do |scripttag|
|
24
|
+
ShopifyAPI::ScriptTag.delete(scripttag.id) if is_required_scripttag?(scripttag)
|
33
25
|
end
|
26
|
+
|
34
27
|
@current_scripttags = nil
|
35
28
|
end
|
36
29
|
|
@@ -44,12 +37,6 @@ module ShopifyApp
|
|
44
37
|
required_scripttags.map{ |w| w[:src] }.include? scripttag.src
|
45
38
|
end
|
46
39
|
|
47
|
-
def with_shopify_session
|
48
|
-
ShopifyAPI::Session.temp(@shop_name, @token) do
|
49
|
-
yield
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
40
|
def create_scripttag(attributes)
|
54
41
|
attributes.reverse_merge!(format: 'json')
|
55
42
|
scripttag = ShopifyAPI::ScriptTag.create(attributes)
|
@@ -1,11 +1,10 @@
|
|
1
1
|
module ShopifyApp
|
2
2
|
class ScripttagsManagerJob < ActiveJob::Base
|
3
|
-
def perform(
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
manager.create_scripttags
|
3
|
+
def perform(shop_domain:, shop_token:)
|
4
|
+
ShopifyAPI::Session.temp(shop_domain, shop_token) do
|
5
|
+
manager = ScripttagsManager.new
|
6
|
+
manager.create_scripttags
|
7
|
+
end
|
9
8
|
end
|
10
9
|
end
|
11
10
|
end
|
data/lib/shopify_app/version.rb
CHANGED
@@ -2,12 +2,8 @@ module ShopifyApp
|
|
2
2
|
class WebhooksManager
|
3
3
|
class CreationFailed < StandardError; end
|
4
4
|
|
5
|
-
def self.queue(
|
6
|
-
ShopifyApp::WebhooksManagerJob.perform_later(
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize(shop_name, token)
|
10
|
-
@shop_name, @token = shop_name, token
|
5
|
+
def self.queue(shop_domain, shop_token)
|
6
|
+
ShopifyApp::WebhooksManagerJob.perform_later(shop_domain: shop_domain, shop_token: shop_token)
|
11
7
|
end
|
12
8
|
|
13
9
|
def recreate_webhooks!
|
@@ -18,19 +14,16 @@ module ShopifyApp
|
|
18
14
|
def create_webhooks
|
19
15
|
return unless required_webhooks.present?
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
create_webhook(webhook) unless webhook_exists?(webhook[:topic])
|
24
|
-
end
|
17
|
+
required_webhooks.each do |webhook|
|
18
|
+
create_webhook(webhook) unless webhook_exists?(webhook[:topic])
|
25
19
|
end
|
26
20
|
end
|
27
21
|
|
28
22
|
def destroy_webhooks
|
29
|
-
|
30
|
-
ShopifyAPI::Webhook.
|
31
|
-
ShopifyAPI::Webhook.delete(webhook.id) if is_required_webhook?(webhook)
|
32
|
-
end
|
23
|
+
ShopifyAPI::Webhook.all.each do |webhook|
|
24
|
+
ShopifyAPI::Webhook.delete(webhook.id) if is_required_webhook?(webhook)
|
33
25
|
end
|
26
|
+
|
34
27
|
@current_webhooks = nil
|
35
28
|
end
|
36
29
|
|
@@ -44,12 +37,6 @@ module ShopifyApp
|
|
44
37
|
required_webhooks.map{ |w| w[:address] }.include? webhook.address
|
45
38
|
end
|
46
39
|
|
47
|
-
def with_shopify_session
|
48
|
-
ShopifyAPI::Session.temp(@shop_name, @token) do
|
49
|
-
yield
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
40
|
def create_webhook(attributes)
|
54
41
|
attributes.reverse_merge!(format: 'json')
|
55
42
|
webhook = ShopifyAPI::Webhook.create(attributes)
|
@@ -1,11 +1,10 @@
|
|
1
1
|
module ShopifyApp
|
2
2
|
class WebhooksManagerJob < ActiveJob::Base
|
3
|
-
def perform(
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
manager.create_webhooks
|
3
|
+
def perform(shop_domain:, shop_token:)
|
4
|
+
ShopifyAPI::Session.temp(shop_domain, shop_token) do
|
5
|
+
manager = WebhooksManager.new
|
6
|
+
manager.create_webhooks
|
7
|
+
end
|
9
8
|
end
|
10
9
|
end
|
11
10
|
end
|
data/shopify_app.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.author = "Shopify"
|
9
9
|
s.summary = %q{This gem is used to get quickly started with the Shopify API}
|
10
10
|
|
11
|
-
s.add_dependency('rails', '>= 4.2', '< 5.0')
|
11
|
+
s.add_dependency('rails', '>= 4.2.6', '< 5.0')
|
12
12
|
|
13
|
-
s.add_runtime_dependency('shopify_api', '~> 4.
|
13
|
+
s.add_runtime_dependency('shopify_api', '~> 4.2')
|
14
14
|
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 1.1.11')
|
15
15
|
|
16
16
|
s.add_development_dependency('rake')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.6
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '5.0'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.2.6
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.0'
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 4.
|
39
|
+
version: '4.2'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 4.
|
46
|
+
version: '4.2'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: omniauth-shopify-oauth2
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|