Class: ShellDataReportingApIs::MonthlyInvoiceTrend

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

Overview

MonthlyInvoiceTrend 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, month = SKIP, total_net_amount = SKIP, total_vat_amount = SKIP, year = SKIP) ⇒ MonthlyInvoiceTrend

Returns a new instance of MonthlyInvoiceTrend.



74
75
76
77
78
79
80
81
82
83
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 74

def initialize(currency_code = SKIP, currency_symbol = SKIP, month = SKIP,
               total_net_amount = SKIP, total_vat_amount = SKIP,
               year = SKIP)
  @currency_code = currency_code unless currency_code == SKIP
  @currency_symbol = currency_symbol unless currency_symbol == SKIP
  @month = month unless month == SKIP
  @total_net_amount = total_net_amount unless total_net_amount == SKIP
  @total_vat_amount = total_vat_amount unless total_vat_amount == SKIP
  @year = year unless year == SKIP
end

Instance Attribute Details

#currency_codeString

ISO code of invoice currency. Example: EUR

Returns:

  • (String)


15
16
17
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 15

def currency_code
  @currency_code
end

#currency_symbolString

Symbol of invoice currency. Example: €

Returns:

  • (String)


20
21
22
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 20

def currency_symbol
  @currency_symbol
end

#monthInteger

Month.

Returns:

  • (Integer)


24
25
26
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 24

def month
  @month
end

#total_net_amountFloat

Total net amount invoiced in this month.

Returns:

  • (Float)


28
29
30
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 28

def total_net_amount
  @total_net_amount
end

#total_vat_amountFloat

Total VAT amount invoiced in this month.

Returns:

  • (Float)


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

def total_vat_amount
  @total_vat_amount
end

#yearInteger

Year.

Returns:

  • (Integer)


36
37
38
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 36

def year
  @year
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 86

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
  month = hash.key?('Month') ? hash['Month'] : SKIP
  total_net_amount =
    hash.key?('TotalNetAmount') ? hash['TotalNetAmount'] : SKIP
  total_vat_amount =
    hash.key?('TotalVATAmount') ? hash['TotalVATAmount'] : SKIP
  year = hash.key?('Year') ? hash['Year'] : SKIP

  # Create object from extracted values.
  MonthlyInvoiceTrend.new(currency_code,
                          currency_symbol,
                          month,
                          total_net_amount,
                          total_vat_amount,
                          year)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['currency_code'] = 'CurrencyCode'
  @_hash['currency_symbol'] = 'CurrencySymbol'
  @_hash['month'] = 'Month'
  @_hash['total_net_amount'] = 'TotalNetAmount'
  @_hash['total_vat_amount'] = 'TotalVATAmount'
  @_hash['year'] = 'Year'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    currency_code
    currency_symbol
    month
    total_net_amount
    total_vat_amount
    year
  ]
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
60
# File 'lib/shell_data_reporting_ap_is/models/monthly_invoice_trend.rb', line 51

def self.optionals
  %w[
    currency_code
    currency_symbol
    month
    total_net_amount
    total_vat_amount
    year
  ]
end