Class: ShopifyAPI::Metafield

Inherits:
Base show all
Includes:
DisablePrefixCheck
Defined in:
lib/shopify_api/resources/metafield.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Countable

#count

Methods inherited from ActiveResource::Base

#encode

Class Method Details

.prefix(options = {}) ⇒ Object

Hack to allow both Shop and other Metafields in through the same AR class



8
9
10
# File 'lib/shopify_api/resources/metafield.rb', line 8

def self.prefix(options={})
  options[:resource].nil? ? "/admin/" : "/admin/#{options[:resource]}/#{options[:resource_id]}/"
end

Instance Method Details

#valueObject



12
13
14
15
# File 'lib/shopify_api/resources/metafield.rb', line 12

def value
  return if attributes["value"].nil?
  attributes["value_type"] == "integer" ? attributes["value"].to_i : attributes["value"]
end