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.



41917
41918
41919
41920
41921
41922
41923
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41917

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.



41915
41916
41917
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41915

def base
  @base
end

#marginObject (readonly)

Returns the value of attribute margin.



41915
41916
41917
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41915

def margin
  @margin
end

#targetObject (readonly)

Returns the value of attribute target.



41915
41916
41917
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41915

def target
  @target
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41929
41930
41931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41929

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

#to_hashObject



41933
41934
41935
41936
41937
41938
41939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41933

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

#to_jsonObject



41925
41926
41927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41925

def to_json
  JSON.dump(to_hash)
end