Class: Io::Flow::V0::Models::ShopifyPrice

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ShopifyPrice

Returns a new instance of ShopifyPrice.



68285
68286
68287
68288
68289
68290
68291
68292
68293
68294
68295
# 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

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



68283
68284
68285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68283

def amount
  @amount
end

#centsObject (readonly)

Returns the value of attribute cents.



68283
68284
68285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68283

def cents
  @cents
end

#currencyObject (readonly)

Returns the value of attribute currency.



68283
68284
68285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68283

def currency
  @currency
end

#includesObject (readonly)

Returns the value of attribute includes.



68283
68284
68285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68283

def includes
  @includes
end

#labelObject (readonly)

Returns the value of attribute label.



68283
68284
68285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68283

def label
  @label
end

#localObject (readonly)

Returns the value of attribute local.



68283
68284
68285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68283

def local
  @local
end

#nameObject (readonly)

Returns the value of attribute name.



68283
68284
68285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68283

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



68301
68302
68303
# 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_hashObject



68305
68306
68307
68308
68309
68310
68311
68312
68313
68314
68315
# 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_jsonObject



68297
68298
68299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68297

def to_json
  JSON.dump(to_hash)
end