class Io::Flow::V0::Models::ShopifyPrice

Attributes

amount[R]
cents[R]
currency[R]
includes[R]
label[R]
local[R]
name[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68285
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name, :amount, :cents, :currency, :label], 'ShopifyPrice')
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric)
  @cents = HttpClient::Preconditions.assert_class('cents', opts.delete(:cents), Numeric)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String)
  @includes = (x = opts.delete(:includes); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::IncludedLevies) ? x : ::Io::Flow::V0::Models::IncludedLevies.new(x)))
  @local = (x = opts.delete(:local); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShopifyLocalPriceMetadata) ? x : ::Io::Flow::V0::Models::ShopifyLocalPriceMetadata.new(x)))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68301
def copy(incoming={})
  ShopifyPrice.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68305
def to_hash
  {
    :name => name,
    :amount => amount,
    :cents => cents,
    :currency => currency,
    :label => label,
    :includes => includes.nil? ? nil : includes.to_hash,
    :local => local.nil? ? nil : local.to_hash
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 68297
def to_json
  JSON.dump(to_hash)
end