Class: Io::Flow::V0::Models::ShippingLabelHopSummary

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

Returns a new instance of ShippingLabelHopSummary.



61653
61654
61655
61656
61657
61658
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61653

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:lane, :cost], 'ShippingLabelHopSummary')
  @lane = (x = opts.delete(:lane); x.is_a?(::Io::Flow::V0::Models::ShippingLabelLaneSummary) ? x : ::Io::Flow::V0::Models::ShippingLabelLaneSummary.new(x))
  @cost = (x = opts.delete(:cost); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))
end

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost.



61651
61652
61653
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61651

def cost
  @cost
end

#laneObject (readonly)

Returns the value of attribute lane.



61651
61652
61653
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61651

def lane
  @lane
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



61664
61665
61666
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61664

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

#to_hashObject



61668
61669
61670
61671
61672
61673
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61668

def to_hash
  {
    :lane => lane.to_hash,
    :cost => cost.to_hash
  }
end

#to_jsonObject



61660
61661
61662
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61660

def to_json
  JSON.dump(to_hash)
end