Class: Io::Flow::V0::Models::ShippingLaneSummary

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

Returns a new instance of ShippingLaneSummary.



61991
61992
61993
61994
61995
61996
61997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61991

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:shipping_lane_id, :region, :centers], 'ShippingLaneSummary')
  @shipping_lane_id = HttpClient::Preconditions.assert_class('shipping_lane_id', opts.delete(:shipping_lane_id), String)
  @region = HttpClient::Preconditions.assert_class('region', opts.delete(:region), String)
  @centers = HttpClient::Preconditions.assert_class('centers', opts.delete(:centers), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ExpandableCenter) ? x : ::Io::Flow::V0::Models::ExpandableCenter.from_json(x)) }
end

Instance Attribute Details

#centersObject (readonly)

Returns the value of attribute centers.



61989
61990
61991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61989

def centers
  @centers
end

#regionObject (readonly)

Returns the value of attribute region.



61989
61990
61991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61989

def region
  @region
end

#shipping_lane_idObject (readonly)

Returns the value of attribute shipping_lane_id.



61989
61990
61991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61989

def shipping_lane_id
  @shipping_lane_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



62003
62004
62005
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62003

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

#to_hashObject



62007
62008
62009
62010
62011
62012
62013
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62007

def to_hash
  {
    :shipping_lane_id => shipping_lane_id,
    :region => region,
    :centers => centers.map { |o| o.to_hash }
  }
end

#to_jsonObject



61999
62000
62001
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 61999

def to_json
  JSON.dump(to_hash)
end