Class: Io::Flow::V0::Models::DeliveryWindowComponentsV2
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DeliveryWindowComponentsV2
- 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
-
#processing_estimates ⇒ Object
readonly
Returns the value of attribute processing_estimates.
-
#transit_estimates ⇒ Object
readonly
Returns the value of attribute transit_estimates.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeliveryWindowComponentsV2
constructor
A new instance of DeliveryWindowComponentsV2.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DeliveryWindowComponentsV2
Returns a new instance of DeliveryWindowComponentsV2.
36165 36166 36167 36168 36169 36170 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36165 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_estimates ⇒ Object (readonly)
Returns the value of attribute processing_estimates.
36163 36164 36165 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36163 def processing_estimates @processing_estimates end |
#transit_estimates ⇒ Object (readonly)
Returns the value of attribute transit_estimates.
36163 36164 36165 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36163 def transit_estimates @transit_estimates end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
36176 36177 36178 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36176 def copy(incoming={}) DeliveryWindowComponentsV2.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
36180 36181 36182 36183 36184 36185 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36180 def to_hash { :processing_estimates => processing_estimates.map { |o| o.to_hash }, :transit_estimates => transit_estimates.map { |o| o.to_hash } } end |
#to_json ⇒ Object
36172 36173 36174 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36172 def to_json JSON.dump(to_hash) end |