Class: Io::Flow::V0::Models::OrganizationCurrencySetting

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

Overview

Represents organization-specific currency conversion adjustments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationCurrencySetting



18575
18576
18577
18578
18579
18580
18581
18582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18575

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



18573
18574
18575
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18573

def base
  @base
end

#idObject (readonly)

Returns the value of attribute id.



18573
18574
18575
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18573

def id
  @id
end

#marginObject (readonly)

Returns the value of attribute margin.



18573
18574
18575
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18573

def margin
  @margin
end

#targetObject (readonly)

Returns the value of attribute target.



18573
18574
18575
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18573

def target
  @target
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18588
18589
18590
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18588

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

#to_hashObject



18592
18593
18594
18595
18596
18597
18598
18599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18592

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

#to_jsonObject



18584
18585
18586
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18584

def to_json
  JSON.dump(to_hash)
end