Class: Io::Flow::V0::Models::SurchargeSetting

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

Returns a new instance of SurchargeSetting.



64381
64382
64383
64384
64385
64386
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64381

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key, :responsible_party], 'SurchargeSetting')
  @key = (x = opts.delete(:key); x.is_a?(::Io::Flow::V0::Models::DeliveryOptionCostDetailComponentKey) ? x : ::Io::Flow::V0::Models::DeliveryOptionCostDetailComponentKey.apply(x))
  @responsible_party = (x = opts.delete(:responsible_party); x.is_a?(::Io::Flow::V0::Models::SurchargeResponsibleParty) ? x : ::Io::Flow::V0::Models::SurchargeResponsibleParty.apply(x))
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



64379
64380
64381
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64379

def key
  @key
end

#responsible_partyObject (readonly)

Returns the value of attribute responsible_party.



64379
64380
64381
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64379

def responsible_party
  @responsible_party
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



64392
64393
64394
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64392

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

#to_hashObject



64396
64397
64398
64399
64400
64401
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64396

def to_hash
  {
    :key => key.value,
    :responsible_party => responsible_party.value
  }
end

#to_jsonObject



64388
64389
64390
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64388

def to_json
  JSON.dump(to_hash)
end