Class: ShopifyApp::ScripttagsManager
- Inherits:
-
Object
- Object
- ShopifyApp::ScripttagsManager
- Defined in:
- lib/shopify_app/scripttags_manager.rb
Defined Under Namespace
Classes: CreationFailed
Instance Attribute Summary collapse
-
#required_scripttags ⇒ Object
readonly
Returns the value of attribute required_scripttags.
Class Method Summary collapse
Instance Method Summary collapse
- #create_scripttags ⇒ Object
- #destroy_scripttags ⇒ Object
-
#initialize(scripttags) ⇒ ScripttagsManager
constructor
A new instance of ScripttagsManager.
- #recreate_scripttags! ⇒ Object
Constructor Details
#initialize(scripttags) ⇒ ScripttagsManager
Returns a new instance of ScripttagsManager.
15 16 17 |
# File 'lib/shopify_app/scripttags_manager.rb', line 15 def initialize() @required_scripttags = end |
Instance Attribute Details
#required_scripttags ⇒ Object (readonly)
Returns the value of attribute required_scripttags.
13 14 15 |
# File 'lib/shopify_app/scripttags_manager.rb', line 13 def @required_scripttags end |
Class Method Details
.queue(shop_domain, shop_token, scripttags) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/shopify_app/scripttags_manager.rb', line 5 def self.queue(shop_domain, shop_token, ) ShopifyApp::ScripttagsManagerJob.perform_later( shop_domain: shop_domain, shop_token: shop_token, scripttags: ) end |
Instance Method Details
#create_scripttags ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/shopify_app/scripttags_manager.rb', line 24 def return unless .present? .each do |scripttag| create_scripttag(scripttag) unless scripttag_exists?(scripttag[:src]) end end |
#destroy_scripttags ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/shopify_app/scripttags_manager.rb', line 32 def ShopifyAPI::ScriptTag.all.each do |scripttag| ShopifyAPI::ScriptTag.delete(scripttag.id) if is_required_scripttag?(scripttag) end @current_scripttags = nil end |
#recreate_scripttags! ⇒ Object
19 20 21 22 |
# File 'lib/shopify_app/scripttags_manager.rb', line 19 def end |