Sha256: e1c216353f8fb64be5ee8f7689e421b30e5aebf1606cc2717aa41759385369c6

Contents?: true

Size: 531 Bytes

Versions: 10

Compression:

Stored size: 531 Bytes

Contents

module ShopifyAPI
  class Metafield < Base
    include DisablePrefixCheck

    self.prefix = "/admin/:resource/:resource_id/"
    
    # Hack to allow both Shop and other Metafields in through the same AR class
    def self.prefix(options={})
      options[:resource].nil? ? "/admin/" : "/admin/#{options[:resource]}/#{options[:resource_id]}/"
    end
            
    def value
      return if attributes["value"].nil?
      attributes["value_type"] == "integer" ? attributes["value"].to_i : attributes["value"]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shopify_api-3.1.6 lib/shopify_api/resources/metafield.rb
shopify_api-3.1.5 lib/shopify_api/resources/metafield.rb
shopify_api-3.1.3 lib/shopify_api/resources/metafield.rb
shopify_api-3.1.2 lib/shopify_api/resources/metafield.rb
shopify_api-3.0.3 lib/shopify_api/resources/metafield.rb
shopify_api-3.0.2 lib/shopify_api/resources/metafield.rb
shopify_api-3.0.1 lib/shopify_api/resources/metafield.rb
shopify_api-3.0.0 lib/shopify_api/resources/metafield.rb
shopify_api-2.3.0 lib/shopify_api/resources/metafield.rb
shopify_api-2.2.0 lib/shopify_api/resources/metafield.rb