Class: Io::Flow::V0::Models::DeliveryWindowComponents

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Components and information taken into account when calculating a final delivery window.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ DeliveryWindowComponents

Returns a new instance of DeliveryWindowComponents.



24106
24107
24108
24109
24110
24111
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24106

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:shipment_estimate, :transit_estimate], 'DeliveryWindowComponents')
  @shipment_estimate = (x = opts.delete(:shipment_estimate); x.is_a?(::Io::Flow::V0::Models::DeliveryWindowComponent) ? x : ::Io::Flow::V0::Models::DeliveryWindowComponent.new(x))
  @transit_estimate = (x = opts.delete(:transit_estimate); x.is_a?(::Io::Flow::V0::Models::DeliveryWindowComponent) ? x : ::Io::Flow::V0::Models::DeliveryWindowComponent.new(x))
end

Instance Attribute Details

#shipment_estimateObject (readonly)

Returns the value of attribute shipment_estimate.



24104
24105
24106
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24104

def shipment_estimate
  @shipment_estimate
end

#transit_estimateObject (readonly)

Returns the value of attribute transit_estimate.



24104
24105
24106
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24104

def transit_estimate
  @transit_estimate
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



24117
24118
24119
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24117

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

#to_hashObject



24121
24122
24123
24124
24125
24126
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24121

def to_hash
  {
    :shipment_estimate => shipment_estimate.to_hash,
    :transit_estimate => transit_estimate.to_hash
  }
end

#to_jsonObject



24113
24114
24115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24113

def to_json
  JSON.dump(to_hash)
end