Class: Shopify
Overview
Class: Shopify Usage:
shop = Shopify.new(host, api_key, password)
shop.orders
Defined Under Namespace
Classes: Article, CustomCollection, ShopifyModel
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Instance Method Summary collapse
-
#initialize(host, api_key = nil, password = nil) ⇒ Shopify
constructor
A new instance of Shopify.
- #needs_authorization? ⇒ Boolean
- #options(opts = {}) ⇒ Object
Constructor Details
#initialize(host, api_key = nil, password = nil) ⇒ Shopify
Returns a new instance of Shopify.
18 19 20 21 22 23 24 |
# File 'lib/shopify.rb', line 18 def initialize(host, api_key=nil, password=nil) host.gsub!(/https?:\/\//, '') # remove http(s):// @host = host.include?('.') ? host : "#{host}.myshopify.com" # extend url to myshopify.com if no host is given @api_key = api_key @password = password setup end |
Instance Attribute Details
#base_uri ⇒ Object
Returns the value of attribute base_uri.
16 17 18 |
# File 'lib/shopify.rb', line 16 def base_uri @base_uri end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
13 14 15 |
# File 'lib/shopify.rb', line 13 def host @host end |
Instance Method Details
#needs_authorization? ⇒ Boolean
26 27 28 |
# File 'lib/shopify.rb', line 26 def ![@host, @api_key, @password].all? end |
#options(opts = {}) ⇒ Object
39 40 41 |
# File 'lib/shopify.rb', line 39 def (opts={}) {:base_uri => @base_uri, :basic_auth => @basic_auth, :format => @format}.merge(opts) end |