Class: Io::Flow::V0::Models::EstimatedWindow
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::EstimatedWindow
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Range of time given a from and to number and the unit. For example: 1-4 hours or 4-7 days
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ EstimatedWindow
constructor
A new instance of EstimatedWindow.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ EstimatedWindow
31417 31418 31419 31420 31421 31422 31423 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31417 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:from, :to, :unit], 'EstimatedWindow') @from = HttpClient::Preconditions.assert_class('from', opts.delete(:from), Integer) @to = HttpClient::Preconditions.assert_class('to', opts.delete(:to), Integer) @unit = (x = opts.delete(:unit); x.is_a?(::Io::Flow::V0::Models::UnitOfTime) ? x : ::Io::Flow::V0::Models::UnitOfTime.apply(x)) end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
31415 31416 31417 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31415 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
31415 31416 31417 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31415 def to @to end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
31415 31416 31417 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31415 def unit @unit end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31429 31430 31431 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31429 def copy(incoming={}) EstimatedWindow.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
31433 31434 31435 31436 31437 31438 31439 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31433 def to_hash { :from => from, :to => to, :unit => unit.value } end |
#to_json ⇒ Object
31425 31426 31427 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31425 def to_json JSON.dump(to_hash) end |