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.



37105
37106
37107
37108
37109
37110
37111
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37105

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.



37103
37104
37105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37103

def base
  @base
end

#marginObject (readonly)

Returns the value of attribute margin.



37103
37104
37105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37103

def margin
  @margin
end

#targetObject (readonly)

Returns the value of attribute target.



37103
37104
37105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37103

def target
  @target
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37117
37118
37119
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37117

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

#to_hashObject



37121
37122
37123
37124
37125
37126
37127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37121

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

#to_jsonObject



37113
37114
37115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37113

def to_json
  JSON.dump(to_hash)
end