Class: ShellDataReportingApIs::InvoiceSummaryDetails

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

Overview

InvoiceSummaryDetails Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(total_invoices = SKIP, total_gross_amount_customer_currency = SKIP, total_net_amount_customer_currency = SKIP, total_vat_amount_customer_currency = SKIP, customer_currency_code = SKIP, customer_currency_symbol = SKIP) ⇒ InvoiceSummaryDetails

Returns a new instance of InvoiceSummaryDetails.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 80

def initialize(total_invoices = SKIP,
               total_gross_amount_customer_currency = SKIP,
               total_net_amount_customer_currency = SKIP,
               total_vat_amount_customer_currency = SKIP,
               customer_currency_code = SKIP,
               customer_currency_symbol = SKIP)
  @total_invoices = total_invoices unless total_invoices == SKIP
  unless total_gross_amount_customer_currency == SKIP
    @total_gross_amount_customer_currency =
      total_gross_amount_customer_currency
  end
  unless total_net_amount_customer_currency == SKIP
    @total_net_amount_customer_currency =
      total_net_amount_customer_currency
  end
  unless total_vat_amount_customer_currency == SKIP
    @total_vat_amount_customer_currency =
      total_vat_amount_customer_currency
  end
  @customer_currency_code = customer_currency_code unless customer_currency_code == SKIP
  @customer_currency_symbol = customer_currency_symbol unless customer_currency_symbol == SKIP
end

Instance Attribute Details

#customer_currency_codeString

Customer currency ISO code. Example: EUR

Returns:

  • (String)


34
35
36
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 34

def customer_currency_code
  @customer_currency_code
end

#customer_currency_symbolString

Customer currency code. Example: €

Returns:

  • (String)


39
40
41
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 39

def customer_currency_symbol
  @customer_currency_symbol
end

#total_gross_amount_customer_currencyFloat

Total gross amount in customer currency combined from all the invoices matching with the given search criteria.

Returns:

  • (Float)


19
20
21
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 19

def total_gross_amount_customer_currency
  @total_gross_amount_customer_currency
end

#total_invoicesInteger

Total number of invoices matching with the given search criteria.

Returns:

  • (Integer)


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

def total_invoices
  @total_invoices
end

#total_net_amount_customer_currencyFloat

Total net amount in customer currency combined from all the invoices matching with the given search criteria.

Returns:

  • (Float)


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

def total_net_amount_customer_currency
  @total_net_amount_customer_currency
end

#total_vat_amount_customer_currencyFloat

Total VAT amount in customer currency combined from all the invoices matching with the given search criteria.

Returns:

  • (Float)


29
30
31
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 29

def total_vat_amount_customer_currency
  @total_vat_amount_customer_currency
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 104

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total_invoices = hash.key?('TotalInvoices') ? hash['TotalInvoices'] : SKIP
  total_gross_amount_customer_currency =
    hash.key?('TotalGrossAmountCustomerCurrency') ? hash['TotalGrossAmountCustomerCurrency'] : SKIP
  total_net_amount_customer_currency =
    hash.key?('TotalNetAmountCustomerCurrency') ? hash['TotalNetAmountCustomerCurrency'] : SKIP
  total_vat_amount_customer_currency =
    hash.key?('TotalVATAmountCustomerCurrency') ? hash['TotalVATAmountCustomerCurrency'] : SKIP
  customer_currency_code =
    hash.key?('CustomerCurrencyCode') ? hash['CustomerCurrencyCode'] : SKIP
  customer_currency_symbol =
    hash.key?('CustomerCurrencySymbol') ? hash['CustomerCurrencySymbol'] : SKIP

  # Create object from extracted values.
  InvoiceSummaryDetails.new(total_invoices,
                            total_gross_amount_customer_currency,
                            total_net_amount_customer_currency,
                            total_vat_amount_customer_currency,
                            customer_currency_code,
                            customer_currency_symbol)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_invoices'] = 'TotalInvoices'
  @_hash['total_gross_amount_customer_currency'] =
    'TotalGrossAmountCustomerCurrency'
  @_hash['total_net_amount_customer_currency'] =
    'TotalNetAmountCustomerCurrency'
  @_hash['total_vat_amount_customer_currency'] =
    'TotalVATAmountCustomerCurrency'
  @_hash['customer_currency_code'] = 'CustomerCurrencyCode'
  @_hash['customer_currency_symbol'] = 'CustomerCurrencySymbol'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
72
73
74
75
76
77
78
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 69

def self.nullables
  %w[
    total_invoices
    total_gross_amount_customer_currency
    total_net_amount_customer_currency
    total_vat_amount_customer_currency
    customer_currency_code
    customer_currency_symbol
  ]
end

.optionalsObject

An array for optional fields



57
58
59
60
61
62
63
64
65
66
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 57

def self.optionals
  %w[
    total_invoices
    total_gross_amount_customer_currency
    total_net_amount_customer_currency
    total_vat_amount_customer_currency
    customer_currency_code
    customer_currency_symbol
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



140
141
142
143
144
145
146
147
148
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 140

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} total_invoices: #{@total_invoices.inspect},"\
  " total_gross_amount_customer_currency: #{@total_gross_amount_customer_currency.inspect},"\
  " total_net_amount_customer_currency: #{@total_net_amount_customer_currency.inspect},"\
  " total_vat_amount_customer_currency: #{@total_vat_amount_customer_currency.inspect},"\
  " customer_currency_code: #{@customer_currency_code.inspect}, customer_currency_symbol:"\
  " #{@customer_currency_symbol.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
135
136
137
# File 'lib/shell_data_reporting_ap_is/models/invoice_summary_details.rb', line 130

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} total_invoices: #{@total_invoices}, total_gross_amount_customer_currency:"\
  " #{@total_gross_amount_customer_currency}, total_net_amount_customer_currency:"\
  " #{@total_net_amount_customer_currency}, total_vat_amount_customer_currency:"\
  " #{@total_vat_amount_customer_currency}, customer_currency_code:"\
  " #{@customer_currency_code}, customer_currency_symbol: #{@customer_currency_symbol}>"
end