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

#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_status = SKIP, document_name = SKIP) ⇒ EIDDocument

Returns a new instance of EIDDocument.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 110

def initialize(document_id = SKIP,  = SKIP,
                = SKIP, document_type = SKIP,
               document_format = SKIP, document_date = SKIP,
               number_of_invoices = SKIP, file_size = SKIP,
               document_status = 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_status = document_status unless document_status == 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)


60
61
62
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 60

def document_name
  @document_name
end

#document_statusString

Document status. Possible values: • NEW • VIEWED • DOWNLOADED • RESTORED

Returns:

  • (String)


56
57
58
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 56

def document_status
  @document_status
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.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 128

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_status =
    hash.key?('DocumentStatus') ? hash['DocumentStatus'] : 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_status,
                  document_name)
end

.namesObject

A mapping from model property names to API property names.



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

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_status'] = 'DocumentStatus'
  @_hash['document_name'] = 'DocumentName'
  @_hash
end

.nullablesObject

An array for nullable fields



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/shell_data_reporting_ap_is/models/eid_document.rb', line 95

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

.optionalsObject

An array for optional fields



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

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