Sha256: c558fc7002d663caeac7234f62ddf0c119e13d998f3eec4ea048fec87fd1e333

Contents?: true

Size: 554 Bytes

Versions: 5

Compression:

Stored size: 554 Bytes

Contents

module ShopifyAPI
  # Shop object. Use Shop.current to receive 
  # the shop.
  class Shop < Base
    def self.current(options={})
      find(:one, options.merge({from: "/admin/shop.#{format.extension}"}))
    end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shopify_api-4.10.0 lib/shopify_api/resources/shop.rb
shopify_api-4.9.1 lib/shopify_api/resources/shop.rb
shopify_api-4.9.0 lib/shopify_api/resources/shop.rb
shopify_api-4.8.0 lib/shopify_api/resources/shop.rb
shopify_api-4.7.1 lib/shopify_api/resources/shop.rb