Class: Io::Flow::V0::Models::LocalPriceDetails

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 = {}) ⇒ LocalPriceDetails

Returns a new instance of LocalPriceDetails.



45416
45417
45418
45419
45420
45421
45422
45423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45416

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:base, :local], 'LocalPriceDetails')
  @base = (x = opts.delete(:base); x.is_a?(::Io::Flow::V0::Models::PriceDetails) ? x : ::Io::Flow::V0::Models::PriceDetails.new(x))
  @local = (x = opts.delete(:local); x.is_a?(::Io::Flow::V0::Models::PriceDetails) ? x : ::Io::Flow::V0::Models::PriceDetails.new(x))
  @discount = (x = opts.delete(:discount); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceDetail) ? x : ::Io::Flow::V0::Models::PriceDetail.new(x)))
  @local_before_discount = (x = opts.delete(:local_before_discount); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceDetail) ? x : ::Io::Flow::V0::Models::PriceDetail.new(x)))
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



45414
45415
45416
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45414

def base
  @base
end

#discountObject (readonly)

Returns the value of attribute discount.



45414
45415
45416
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45414

def discount
  @discount
end

#localObject (readonly)

Returns the value of attribute local.



45414
45415
45416
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45414

def local
  @local
end

#local_before_discountObject (readonly)

Returns the value of attribute local_before_discount.



45414
45415
45416
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45414

def local_before_discount
  @local_before_discount
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45429
45430
45431
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45429

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

#to_hashObject



45433
45434
45435
45436
45437
45438
45439
45440
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45433

def to_hash
  {
    :base => base.to_hash,
    :local => local.to_hash,
    :discount => discount.nil? ? nil : discount.to_hash,
    :local_before_discount => local_before_discount.nil? ? nil : local_before_discount.to_hash
  }
end

#to_jsonObject



45425
45426
45427
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45425

def to_json
  JSON.dump(to_hash)
end