Sha256: e989b598b3aadf4e24b5c18c96cb4767330ee3da56aee47ab4c53929594f4e67

Contents?: true

Size: 472 Bytes

Versions: 50

Compression:

Stored size: 472 Bytes

Contents

module ShopifyAPI
  module Metafields
    def metafields
      Metafield.find(:all, :params => {:resource => self.class.collection_name, :resource_id => id})
    end

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

      metafield.prefix_options = {
        :resource => self.class.collection_name,
        :resource_id => id
      }
      metafield.save
      metafield
    end
  end
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
shopify_api-4.7.0 lib/shopify_api/metafields.rb
shopify_api-4.6.0 lib/shopify_api/metafields.rb
shopify_api-4.5.0 lib/shopify_api/metafields.rb
shopify_api-4.4.0 lib/shopify_api/metafields.rb
shopify_api-4.3.9 lib/shopify_api/metafields.rb
shopify_api-4.3.8 lib/shopify_api/metafields.rb
shopify_api-4.3.7 lib/shopify_api/metafields.rb
shopify_api-4.3.6 lib/shopify_api/metafields.rb
shopify_api-4.3.5 lib/shopify_api/metafields.rb
shopify_api-4.3.4 lib/shopify_api/metafields.rb
shopify_api-4.3.3 lib/shopify_api/metafields.rb
shopify_api-4.3.2 lib/shopify_api/metafields.rb
shopify_api-4.3.1 lib/shopify_api/metafields.rb
shopify_api-4.3.0 lib/shopify_api/metafields.rb
shopify_api-4.2.2 lib/shopify_api/metafields.rb
shopify_api-4.2.1 lib/shopify_api/metafields.rb
shopify_api-4.2.0 lib/shopify_api/metafields.rb
shopify_api-4.1.1 lib/shopify_api/metafields.rb
shopify_api-4.1.0 lib/shopify_api/metafields.rb
shopify_api-4.0.7 lib/shopify_api/metafields.rb