Class: ShellDataReportingApIs::EIDDocument

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

Overview

EIDDocument 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(document_id = SKIP, account_group_id = SKIP, account_group_name = SKIP, document_type = SKIP, document_format = SKIP, document_date = SKIP, number_of_invoices = SKIP, file_size = SKIP, document_name = SKIP) ⇒ EIDDocument

Returns a new instance of EIDDocument.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 98

def initialize(document_id = SKIP,  = SKIP,
                = SKIP, document_type = SKIP,
               document_format = SKIP, document_date = SKIP,
               number_of_invoices = SKIP, file_size = SKIP,
               document_name = SKIP)
  @document_id = document_id unless document_id == SKIP
  @account_group_id =  unless  == SKIP
  @account_group_name =  unless  == SKIP
  @document_type = document_type unless document_type == SKIP
  @document_format = document_format unless document_format == SKIP
  @document_date = document_date unless document_date == SKIP
  @number_of_invoices = number_of_invoices unless number_of_invoices == SKIP
  @file_size = file_size unless file_size == SKIP
  @document_name = document_name unless document_name == SKIP
end

Instance Attribute Details

#account_group_idString

Account Group Id

Returns:

  • (String)


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

def 
  @account_group_id
end

#account_group_nameString

Account group name

Returns:

  • (String)


23
24
25
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 23

def 
  @account_group_name
end

#document_dateString

Document date. Example: 20170101

Returns:

  • (String)


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

def document_date
  @document_date
end

#document_formatString

Document format (CHORUS, DIFI etc.)

Returns:

  • (String)


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

def document_format
  @document_format
end

#document_idInteger

Technical identifier for the EID file. Should not be stored in database as it is not guaranteed to stay unchanged over time.

Returns:

  • (Integer)


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

def document_id
  @document_id
end

#document_nameString

Document file name.

Returns:

  • (String)


51
52
53
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 51

def document_name
  @document_name
end

#document_typeString

Document type. Possible values: • NAT (National) • INT (International)

Returns:

  • (String)


30
31
32
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 30

def document_type
  @document_type
end

#file_sizeInteger

Document size

Returns:

  • (Integer)


47
48
49
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 47

def file_size
  @file_size
end

#number_of_invoicesInteger

Number of invoices

Returns:

  • (Integer)


43
44
45
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 43

def number_of_invoices
  @number_of_invoices
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 115

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  document_id = hash.key?('DocumentId') ? hash['DocumentId'] : SKIP
   =
    hash.key?('AccountGroupId') ? hash['AccountGroupId'] : SKIP
   =
    hash.key?('AccountGroupName') ? hash['AccountGroupName'] : SKIP
  document_type = hash.key?('DocumentType') ? hash['DocumentType'] : SKIP
  document_format =
    hash.key?('DocumentFormat') ? hash['DocumentFormat'] : SKIP
  document_date = hash.key?('DocumentDate') ? hash['DocumentDate'] : SKIP
  number_of_invoices =
    hash.key?('NumberOfInvoices') ? hash['NumberOfInvoices'] : SKIP
  file_size = hash.key?('FileSize') ? hash['FileSize'] : SKIP
  document_name = hash.key?('DocumentName') ? hash['DocumentName'] : SKIP

  # Create object from extracted values.
  EIDDocument.new(document_id,
                  ,
                  ,
                  document_type,
                  document_format,
                  document_date,
                  number_of_invoices,
                  file_size,
                  document_name)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['document_id'] = 'DocumentId'
  @_hash['account_group_id'] = 'AccountGroupId'
  @_hash['account_group_name'] = 'AccountGroupName'
  @_hash['document_type'] = 'DocumentType'
  @_hash['document_format'] = 'DocumentFormat'
  @_hash['document_date'] = 'DocumentDate'
  @_hash['number_of_invoices'] = 'NumberOfInvoices'
  @_hash['file_size'] = 'FileSize'
  @_hash['document_name'] = 'DocumentName'
  @_hash
end

.nullablesObject

An array for nullable fields



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 84

def self.nullables
  %w[
    document_id
    account_group_id
    account_group_name
    document_type
    document_format
    document_date
    number_of_invoices
    file_size
    document_name
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    document_id
    account_group_id
    account_group_name
    document_type
    document_format
    document_date
    number_of_invoices
    file_size
    document_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



156
157
158
159
160
161
162
163
164
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 156

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} document_id: #{@document_id.inspect}, account_group_id:"\
  " #{@account_group_id.inspect}, account_group_name: #{@account_group_name.inspect},"\
  " document_type: #{@document_type.inspect}, document_format: #{@document_format.inspect},"\
  " document_date: #{@document_date.inspect}, number_of_invoices:"\
  " #{@number_of_invoices.inspect}, file_size: #{@file_size.inspect}, document_name:"\
  " #{@document_name.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



146
147
148
149
150
151
152
153
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 146

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} document_id: #{@document_id}, account_group_id: #{@account_group_id},"\
  " account_group_name: #{@account_group_name}, document_type: #{@document_type},"\
  " document_format: #{@document_format}, document_date: #{@document_date},"\
  " number_of_invoices: #{@number_of_invoices}, file_size: #{@file_size}, document_name:"\
  " #{@document_name}>"
end