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.



39410
39411
39412
39413
39414
39415
39416
39417
39418
39419
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39410

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :shipping_configuration, :region, :centers, :tiers, :query], '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::ExpandableCenter) ? x : ::Io::Flow::V0::Models::ExpandableCenter.from_json(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)) }
  @query = (x = opts.delete(:query); x.is_a?(::Io::Flow::V0::Models::Query) ? x : ::Io::Flow::V0::Models::Query.new(x))
end

Instance Attribute Details

#centersObject (readonly)

Returns the value of attribute centers.



39408
39409
39410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39408

def centers
  @centers
end

#idObject (readonly)

Returns the value of attribute id.



39408
39409
39410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39408

def id
  @id
end

#queryObject (readonly)

Returns the value of attribute query.



39408
39409
39410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39408

def query
  @query
end

#regionObject (readonly)

Returns the value of attribute region.



39408
39409
39410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39408

def region
  @region
end

#shipping_configurationObject (readonly)

Returns the value of attribute shipping_configuration.



39408
39409
39410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39408

def shipping_configuration
  @shipping_configuration
end

#tiersObject (readonly)

Returns the value of attribute tiers.



39408
39409
39410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39408

def tiers
  @tiers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39425
39426
39427
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39425

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

#to_hashObject



39429
39430
39431
39432
39433
39434
39435
39436
39437
39438
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39429

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 },
    :query => query.to_hash
  }
end

#to_jsonObject



39421
39422
39423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39421

def to_json
  JSON.dump(to_hash)
end