class Io::Flow::V0::Models::EstimatedWindow

Range of time given a from and to number and the unit. For example: 1-4 hours or 4-7 days

Attributes

from[R]
to[R]
unit[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41179
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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41191
def copy(incoming={})
  EstimatedWindow.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41195
def to_hash
  {
    :from => from,
    :to => to,
    :unit => unit.value
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41187
def to_json
  JSON.dump(to_hash)
end