Class: ShopifyAPI::Shop

Inherits:
Base
  • Object
show all
Includes:
ActiveResource::Singleton
Defined in:
lib/shopify_api/resources/shop.rb

Overview

Shop object. Use Shop.current to receive the shop.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

activate_session, api_version, api_version=, #as_json, clear_session, early_july_pagination?, #encode, headers, init_prefix, init_prefix_explicit, #persisted?, prefix, prefix=, prefix_source, resource_prefix, resource_prefix=, version_validation!

Methods included from Countable

#count

Class Method Details

.current(options = {}) ⇒ Object


7
8
9
# File 'lib/shopify_api/resources/shop.rb', line 7

def self.current(options = {})
  find(options)
end

Instance Method Details

#add_metafield(metafield) ⇒ Object

Raises:

  • (ArgumentError)

15
16
17
18
19
# File 'lib/shopify_api/resources/shop.rb', line 15

def add_metafield(metafield)
  raise ArgumentError, "You can only add metafields to resource that has been saved" if new?
  metafield.save
  metafield
end

#eventsObject


21
22
23
# File 'lib/shopify_api/resources/shop.rb', line 21

def events
  Event.find(:all)
end

#metafields(**options) ⇒ Object


11
12
13
# File 'lib/shopify_api/resources/shop.rb', line 11

def metafields(**options)
  Metafield.find :all, params: options
end