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
Returns a new instance of EstimatedWindow.
22728 22729 22730 22731 22732 22733 22734 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22728 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.
22726 22727 22728 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22726 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
22726 22727 22728 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22726 def to @to end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
22726 22727 22728 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22726 def unit @unit end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
22740 22741 22742 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22740 def copy(incoming={}) EstimatedWindow.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
22744 22745 22746 22747 22748 22749 22750 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22744 def to_hash { :from => from, :to => to, :unit => unit.value } end |
#to_json ⇒ Object
22736 22737 22738 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22736 def to_json JSON.dump(to_hash) end |