Sha256: a070536b37b35bd2b1b291f85be3fec02d53ad24fc1f3b0a71dc880f7cddb6f3

Contents?: true

Size: 528 Bytes

Versions: 11

Compression:

Stored size: 528 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

11 entries across 11 versions & 1 rubygems

Version Path
shopify_api-6.0.0 lib/shopify_api/resources/shop.rb
shopify_api-5.2.4 lib/shopify_api/resources/shop.rb
shopify_api-5.2.3 lib/shopify_api/resources/shop.rb
shopify_api-5.2.2 lib/shopify_api/resources/shop.rb
shopify_api-5.2.1 lib/shopify_api/resources/shop.rb
shopify_api-5.2.0 lib/shopify_api/resources/shop.rb
shopify_api-5.1.0 lib/shopify_api/resources/shop.rb
shopify_api-5.0.0 lib/shopify_api/resources/shop.rb
shopify_api-4.13.0 lib/shopify_api/resources/shop.rb
shopify_api-4.12.0 lib/shopify_api/resources/shop.rb
shopify_api-4.11.0 lib/shopify_api/resources/shop.rb