Class: Io::Flow::V0::Models::SpotRateForm

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 = {}) ⇒ SpotRateForm

Returns a new instance of SpotRateForm.



17451
17452
17453
17454
17455
17456
17457
17458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17451

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:effective_at, :base, :target, :value], 'SpotRateForm')
  @effective_at = HttpClient::Preconditions.assert_class('effective_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:effective_at)), DateTime)
  @base = HttpClient::Preconditions.assert_class('base', opts.delete(:base), String)
  @target = HttpClient::Preconditions.assert_class('target', opts.delete(:target), String)
  @value = HttpClient::Preconditions.assert_class('value', HttpClient::Helper.to_big_decimal(opts.delete(:value)), BigDecimal)
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



17449
17450
17451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17449

def base
  @base
end

#effective_atObject (readonly)

Returns the value of attribute effective_at.



17449
17450
17451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17449

def effective_at
  @effective_at
end

#targetObject (readonly)

Returns the value of attribute target.



17449
17450
17451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17449

def target
  @target
end

#valueObject (readonly)

Returns the value of attribute value.



17449
17450
17451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17449

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17464
17465
17466
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17464

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

#to_hashObject



17468
17469
17470
17471
17472
17473
17474
17475
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17468

def to_hash
  {
    :effective_at => effective_at,
    :base => base,
    :target => target,
    :value => value
  }
end

#to_jsonObject



17460
17461
17462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17460

def to_json
  JSON.dump(to_hash)
end