Class: Io::Flow::V0::Models::SpotRate

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

Returns a new instance of SpotRate.



15167
15168
15169
15170
15171
15172
15173
15174
15175
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15167

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :effective_at, :base, :target, :value], 'SpotRate')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @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.



15165
15166
15167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15165

def base
  @base
end

#effective_atObject (readonly)

Returns the value of attribute effective_at.



15165
15166
15167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15165

def effective_at
  @effective_at
end

#idObject (readonly)

Returns the value of attribute id.



15165
15166
15167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15165

def id
  @id
end

#targetObject (readonly)

Returns the value of attribute target.



15165
15166
15167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15165

def target
  @target
end

#valueObject (readonly)

Returns the value of attribute value.



15165
15166
15167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15165

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15181
15182
15183
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15181

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

#to_hashObject



15185
15186
15187
15188
15189
15190
15191
15192
15193
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15185

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

#to_jsonObject



15177
15178
15179
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15177

def to_json
  JSON.dump(to_hash)
end