Class: ShopifyAPI::Shop

Inherits:
Base show all
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 included from Countable

#count

Methods inherited from ActiveResource::Base

#encode

Class Method Details

.currentObject



5
6
7
# File 'lib/shopify_api/resources/shop.rb', line 5

def self.current
  find(:one, :from => "/admin/shop.#{format.extension}")
end

Instance Method Details

#add_metafield(metafield) ⇒ Object

Raises:

  • (ArgumentError)


13
14
15
16
17
# File 'lib/shopify_api/resources/shop.rb', line 13

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

#eventsObject



19
20
21
# File 'lib/shopify_api/resources/shop.rb', line 19

def events
  Event.find(:all)
end

#metafieldsObject



9
10
11
# File 'lib/shopify_api/resources/shop.rb', line 9

def metafields
  Metafield.find(:all)
end