Class: ShellDataReportingApIs::FinanceCurrency2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/finance_currency2.rb

Overview

FinanceCurrency2 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(currency_code = SKIP, currency_symbol = SKIP, invoice_exchange_rate = SKIP, credit_limit_exchange_rate = SKIP) ⇒ FinanceCurrency2

Returns a new instance of FinanceCurrency2.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 64

def initialize(currency_code = SKIP, currency_symbol = SKIP,
               invoice_exchange_rate = SKIP,
               credit_limit_exchange_rate = SKIP)
  @currency_code = currency_code unless currency_code == SKIP
  @currency_symbol = currency_symbol unless currency_symbol == SKIP
  @invoice_exchange_rate = invoice_exchange_rate unless invoice_exchange_rate == SKIP
  unless credit_limit_exchange_rate == SKIP
    @credit_limit_exchange_rate =
      credit_limit_exchange_rate
  end
end

Instance Attribute Details

#credit_limit_exchange_rateFloat

Factor to be used for converting the amounts in credit limit currency to finance widget currency. (If finance currency is same as credit limit currency, then the value of this field will be “1” so that the value does not change)

Returns:

  • (Float)


32
33
34
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 32

def credit_limit_exchange_rate
  @credit_limit_exchange_rate
end

#currency_codeString

Currency ISO Code used for the Finance Widget.

Returns:

  • (String)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 14

def currency_code
  @currency_code
end

#currency_symbolString

Currency Symbol

Returns:

  • (String)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 18

def currency_symbol
  @currency_symbol
end

#invoice_exchange_rateFloat

Factor to be used for converting the amounts in invoice currency to finance widget currency. (If finance currency is same as invoice currency, then the value of this field will be “1” so that the value does not change)

Returns:

  • (Float)


25
26
27
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 25

def invoice_exchange_rate
  @invoice_exchange_rate
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  currency_code = hash.key?('CurrencyCode') ? hash['CurrencyCode'] : SKIP
  currency_symbol =
    hash.key?('CurrencySymbol') ? hash['CurrencySymbol'] : SKIP
  invoice_exchange_rate =
    hash.key?('Invoice_ExchangeRate') ? hash['Invoice_ExchangeRate'] : SKIP
  credit_limit_exchange_rate =
    hash.key?('CreditLimit_ExchangeRate') ? hash['CreditLimit_ExchangeRate'] : SKIP

  # Create object from extracted values.
  FinanceCurrency2.new(currency_code,
                       currency_symbol,
                       invoice_exchange_rate,
                       credit_limit_exchange_rate)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['currency_code'] = 'CurrencyCode'
  @_hash['currency_symbol'] = 'CurrencySymbol'
  @_hash['invoice_exchange_rate'] = 'Invoice_ExchangeRate'
  @_hash['credit_limit_exchange_rate'] = 'CreditLimit_ExchangeRate'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
58
59
60
61
62
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 55

def self.nullables
  %w[
    currency_code
    currency_symbol
    invoice_exchange_rate
    credit_limit_exchange_rate
  ]
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
# File 'lib/shell_data_reporting_ap_is/models/finance_currency2.rb', line 45

def self.optionals
  %w[
    currency_code
    currency_symbol
    invoice_exchange_rate
    credit_limit_exchange_rate
  ]
end