metafield.rb 499 B

123456789101112131415
  1. module ShopifyAPI
  2. class Metafield < Base
  3. self.prefix = "/admin/:resource/:resource_id/"
  4. # Hack to allow both Shop and other Metafields in through the same AR class
  5. def self.prefix(options={})
  6. options[:resource].nil? ? "/admin/" : "/admin/#{options[:resource]}/#{options[:resource_id]}/"
  7. end
  8. def value
  9. return if attributes["value"].nil?
  10. attributes["value_type"] == "integer" ? attributes["value"].to_i : attributes["value"]
  11. end
  12. end
  13. end