Class: Io::Flow::V0::Models::DeliveryOptionSummary

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

Returns a new instance of DeliveryOptionSummary.



15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15564

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :cost, :delivered_duty, :price, :service, :tier, :window], 'DeliveryOptionSummary')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @cost = (x = opts.delete(:cost); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @delivered_duty = (x = opts.delete(:delivered_duty); x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x))
  @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
  @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::ServiceReference) ? x : ::Io::Flow::V0::Models::ServiceReference.new(x))
  @tier = (x = opts.delete(:tier); x.is_a?(::Io::Flow::V0::Models::TierReference) ? x : ::Io::Flow::V0::Models::TierReference.new(x))
  @window = (x = opts.delete(:window); x.is_a?(::Io::Flow::V0::Models::DatetimeRange) ? x : ::Io::Flow::V0::Models::DatetimeRange.new(x))
end

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost.



15562
15563
15564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15562

def cost
  @cost
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



15562
15563
15564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15562

def delivered_duty
  @delivered_duty
end

#idObject (readonly)

Returns the value of attribute id.



15562
15563
15564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15562

def id
  @id
end

#priceObject (readonly)

Returns the value of attribute price.



15562
15563
15564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15562

def price
  @price
end

#serviceObject (readonly)

Returns the value of attribute service.



15562
15563
15564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15562

def service
  @service
end

#tierObject (readonly)

Returns the value of attribute tier.



15562
15563
15564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15562

def tier
  @tier
end

#windowObject (readonly)

Returns the value of attribute window.



15562
15563
15564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15562

def window
  @window
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15580
15581
15582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15580

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

#to_hashObject



15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15584

def to_hash
  {
    :id => id,
    :cost => cost.to_hash,
    :delivered_duty => delivered_duty.value,
    :price => price.to_hash,
    :service => service.to_hash,
    :tier => tier.to_hash,
    :window => window.to_hash
  }
end

#to_jsonObject



15576
15577
15578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15576

def to_json
  JSON.dump(to_hash)
end