Class: Io::Flow::V0::Models::ShippingLane

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

Returns a new instance of ShippingLane.



35135
35136
35137
35138
35139
35140
35141
35142
35143
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35135

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :shipping_configuration, :region, :centers, :tiers], 'ShippingLane')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @shipping_configuration = (x = opts.delete(:shipping_configuration); x.is_a?(::Io::Flow::V0::Models::ShippingConfigurationReference) ? x : ::Io::Flow::V0::Models::ShippingConfigurationReference.new(x))
  @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::CenterReference) ? x : ::Io::Flow::V0::Models::CenterReference.new(x)) }
  @tiers = HttpClient::Preconditions.assert_class('tiers', opts.delete(:tiers), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Tier) ? x : ::Io::Flow::V0::Models::Tier.new(x)) }
end

Instance Attribute Details

#centersObject (readonly)

Returns the value of attribute centers.



35133
35134
35135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133

def centers
  @centers
end

#idObject (readonly)

Returns the value of attribute id.



35133
35134
35135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133

def id
  @id
end

#regionObject (readonly)

Returns the value of attribute region.



35133
35134
35135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133

def region
  @region
end

#shipping_configurationObject (readonly)

Returns the value of attribute shipping_configuration.



35133
35134
35135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133

def shipping_configuration
  @shipping_configuration
end

#tiersObject (readonly)

Returns the value of attribute tiers.



35133
35134
35135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35133

def tiers
  @tiers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35149
35150
35151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35149

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

#to_hashObject



35153
35154
35155
35156
35157
35158
35159
35160
35161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35153

def to_hash
  {
    :id => id,
    :shipping_configuration => shipping_configuration.to_hash,
    :region => region,
    :centers => centers.map { |o| o.to_hash },
    :tiers => tiers.map { |o| o.to_hash }
  }
end

#to_jsonObject



35145
35146
35147
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35145

def to_json
  JSON.dump(to_hash)
end