Class: Io::Flow::V0::Models::PriceDetails

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

Overview

Detailed information for the pricing of a given item within an experience

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PriceDetails

Returns a new instance of PriceDetails.



13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13912

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:base, :local, :currency_margin, :margin, :vat, :duty, :rounding, :total], 'PriceDetails')
  @base = (x = opts.delete(:base); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @local = (x = opts.delete(:local); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @currency_margin = (x = opts.delete(:currency_margin); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @margin = (x = opts.delete(:margin); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @vat = (x = opts.delete(:vat); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @rounding = (x = opts.delete(:rounding); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



13910
13911
13912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13910

def base
  @base
end

#currency_marginObject (readonly)

Returns the value of attribute currency_margin.



13910
13911
13912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13910

def currency_margin
  @currency_margin
end

#dutyObject (readonly)

Returns the value of attribute duty.



13910
13911
13912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13910

def duty
  @duty
end

#localObject (readonly)

Returns the value of attribute local.



13910
13911
13912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13910

def local
  @local
end

#marginObject (readonly)

Returns the value of attribute margin.



13910
13911
13912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13910

def margin
  @margin
end

#roundingObject (readonly)

Returns the value of attribute rounding.



13910
13911
13912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13910

def rounding
  @rounding
end

#totalObject (readonly)

Returns the value of attribute total.



13910
13911
13912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13910

def total
  @total
end

#vatObject (readonly)

Returns the value of attribute vat.



13910
13911
13912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13910

def vat
  @vat
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13929
13930
13931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13929

def copy(incoming={})
  PriceDetails.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13933

def to_hash
  {
    :base => base.to_hash,
    :local => local.to_hash,
    :currency_margin => currency_margin.to_hash,
    :margin => margin.to_hash,
    :vat => vat.to_hash,
    :duty => duty.to_hash,
    :rounding => rounding.to_hash,
    :total => total.to_hash
  }
end

#to_jsonObject



13925
13926
13927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13925

def to_json
  JSON.dump(to_hash)
end