Class: Io::Flow::V0::Models::DeliveryWindowComponentsV2

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

Returns a new instance of DeliveryWindowComponentsV2.



29991
29992
29993
29994
29995
29996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29991

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:processing_estimates, :transit_estimates], 'DeliveryWindowComponentsV2')
  @processing_estimates = HttpClient::Preconditions.assert_class('processing_estimates', opts.delete(:processing_estimates), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ProcessingEstimate) ? x : ::Io::Flow::V0::Models::ProcessingEstimate.new(x)) }
  @transit_estimates = HttpClient::Preconditions.assert_class('transit_estimates', opts.delete(:transit_estimates), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::TransitEstimate) ? x : ::Io::Flow::V0::Models::TransitEstimate.new(x)) }
end

Instance Attribute Details

#processing_estimatesObject (readonly)

Returns the value of attribute processing_estimates.



29989
29990
29991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29989

def processing_estimates
  @processing_estimates
end

#transit_estimatesObject (readonly)

Returns the value of attribute transit_estimates.



29989
29990
29991
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29989

def transit_estimates
  @transit_estimates
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30002
30003
30004
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30002

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

#to_hashObject



30006
30007
30008
30009
30010
30011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30006

def to_hash
  {
    :processing_estimates => processing_estimates.map { |o| o.to_hash },
    :transit_estimates => transit_estimates.map { |o| o.to_hash }
  }
end

#to_jsonObject



29998
29999
30000
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29998

def to_json
  JSON.dump(to_hash)
end