Sha256: 21b0dbc3e89c7e0dd3a76e6f72bc6385c4a63c5b4a9b13324f4ee3360665c06f

Contents?: true

Size: 499 Bytes

Versions: 3

Compression:

Stored size: 499 Bytes

Contents

module ShopifyAPI
  class Metafield < Base
    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

3 entries across 3 versions & 2 rubygems

Version Path
shopify_api-2.1.0 lib/shopify_api/resources/metafield.rb
shopify_api-2.0.0 lib/shopify_api/resources/metafield.rb
th_shopify_api-1.2.6.pre lib/shopify_api/resources/metafield.rb