Class: Shopifydev::Shop
- Inherits:
-
Object
- Object
- Shopifydev::Shop
- Defined in:
- lib/shopifydev/shop.rb
Instance Attribute Summary collapse
-
#credentials ⇒ Object
Returns the value of attribute credentials.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
Instance Method Summary collapse
- #asset(path) ⇒ Object
-
#initialize(credentials) ⇒ Shop
constructor
A new instance of Shop.
- #template ⇒ Object
Constructor Details
#initialize(credentials) ⇒ Shop
Returns a new instance of Shop.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/shopifydev/shop.rb', line 8 def initialize(credentials) @credentials = credentials @logger = Logger.new(STDOUT) ShopifyAPI::Base.clear_session if credentials['token'] session = ShopifyAPI::Session.new(credentials['url'], credentials['token']) session.valid? # returns true ShopifyAPI::Base.activate_session(session) else ShopifyAPI::Base.site = "https://" + credentials['api_key'] + ':' + credentials['password'] + '@' + credentials['url'] + '/admin' logger.debug("set shopify site to #{ShopifyAPI::Base.site}") end end |
Instance Attribute Details
#credentials ⇒ Object
Returns the value of attribute credentials.
6 7 8 |
# File 'lib/shopifydev/shop.rb', line 6 def credentials @credentials end |
#logger ⇒ Object
Returns the value of attribute logger.
6 7 8 |
# File 'lib/shopifydev/shop.rb', line 6 def logger @logger end |
#project_root ⇒ Object
Returns the value of attribute project_root.
6 7 8 |
# File 'lib/shopifydev/shop.rb', line 6 def project_root @project_root end |