Class: Io::Flow::V0::Models::ProcessingEstimate

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ProcessingEstimate

Returns a new instance of ProcessingEstimate.



56253
56254
56255
56256
56257
56258
56259
56260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56253

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:location, :min_date, :max_date, :source], 'ProcessingEstimate')
  @location = (x = opts.delete(:location); 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

#locationObject (readonly)

Returns the value of attribute location.



56251
56252
56253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56251

def location
  @location
end

#max_dateObject (readonly)

Returns the value of attribute max_date.



56251
56252
56253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56251

def max_date
  @max_date
end

#min_dateObject (readonly)

Returns the value of attribute min_date.



56251
56252
56253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56251

def min_date
  @min_date
end

#sourceObject (readonly)

Returns the value of attribute source.



56251
56252
56253
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56251

def source
  @source
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



56266
56267
56268
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56266

def copy(incoming={})
  ProcessingEstimate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



56270
56271
56272
56273
56274
56275
56276
56277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56270

def to_hash
  {
    :location => location.value,
    :min_date => min_date,
    :max_date => max_date,
    :source => source.value
  }
end

#to_jsonObject



56262
56263
56264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56262

def to_json
  JSON.dump(to_hash)
end