Class: Io::Flow::V0::Models::OrganizationCurrencySettingForm

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

Overview

Represents the parts of an organization setting that can be updated.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationCurrencySettingForm

Returns a new instance of OrganizationCurrencySettingForm.



42011
42012
42013
42014
42015
42016
42017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42011

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

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



42009
42010
42011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42009

def base
  @base
end

#marginObject (readonly)

Returns the value of attribute margin.



42009
42010
42011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42009

def margin
  @margin
end

#targetObject (readonly)

Returns the value of attribute target.



42009
42010
42011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42009

def target
  @target
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



42023
42024
42025
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42023

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

#to_hashObject



42027
42028
42029
42030
42031
42032
42033
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42027

def to_hash
  {
    :base => base,
    :target => target,
    :margin => margin.to_f.to_s
  }
end

#to_jsonObject



42019
42020
42021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42019

def to_json
  JSON.dump(to_hash)
end