Class: Io::Flow::V0::Models::TransitEstimate
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TransitEstimate
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#max_date ⇒ Object
readonly
Returns the value of attribute max_date.
-
#min_date ⇒ Object
readonly
Returns the value of attribute min_date.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TransitEstimate
constructor
A new instance of TransitEstimate.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TransitEstimate
Returns a new instance of TransitEstimate.
33085 33086 33087 33088 33089 33090 33091 33092 33093 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33085 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:origin, :destination, :min_date, :max_date, :source], 'TransitEstimate') @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::DeliveryWindowLocation) ? x : ::Io::Flow::V0::Models::DeliveryWindowLocation.apply(x)) @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::DeliveryWindowLocation) ? x : ::Io::Flow::V0::Models::DeliveryWindowLocation.apply(x)) @min_date = HttpClient::Preconditions.assert_class('min_date', HttpClient::Helper.to_date_time_iso8601(opts.delete(:min_date)), DateTime) @max_date = HttpClient::Preconditions.assert_class('max_date', HttpClient::Helper.to_date_time_iso8601(opts.delete(:max_date)), DateTime) @source = (x = opts.delete(:source); x.is_a?(::Io::Flow::V0::Models::DeliveryWindowComponentSource) ? x : ::Io::Flow::V0::Models::DeliveryWindowComponentSource.apply(x)) end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
33083 33084 33085 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33083 def destination @destination end |
#max_date ⇒ Object (readonly)
Returns the value of attribute max_date.
33083 33084 33085 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33083 def max_date @max_date end |
#min_date ⇒ Object (readonly)
Returns the value of attribute min_date.
33083 33084 33085 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33083 def min_date @min_date end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
33083 33084 33085 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33083 def origin @origin end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
33083 33084 33085 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33083 def source @source end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
33099 33100 33101 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33099 def copy(incoming={}) TransitEstimate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
33103 33104 33105 33106 33107 33108 33109 33110 33111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33103 def to_hash { :origin => origin.value, :destination => destination.value, :min_date => min_date, :max_date => max_date, :source => source.value } end |
#to_json ⇒ Object
33095 33096 33097 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33095 def to_json JSON.dump(to_hash) end |