Class: CyberSourceMergedSpec::FileDetail
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::FileDetail
- Defined in:
- lib/cyber_source_merged_spec/models/file_detail.rb
Overview
FileDetail Model.
Instance Attribute Summary collapse
-
#created_time ⇒ DateTime
Date and time for the file in PST.
-
#date ⇒ Date
Date and time for the file in PST.
-
#file_id ⇒ String
Unique identifier of a file.
-
#last_modified_time ⇒ DateTime
Date and time for the file in PST.
-
#mime_type ⇒ String
'File extension' Valid values: - 'application/xml' - 'text/csv' - 'application/pdf' - 'application/octet-stream'.
-
#name ⇒ String
Name of the file.
-
#size ⇒ Float
Size of the file in bytes.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(file_id: SKIP, name: SKIP, created_time: SKIP, last_modified_time: SKIP, date: SKIP, mime_type: SKIP, size: SKIP, additional_properties: nil) ⇒ FileDetail
constructor
A new instance of FileDetail.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_time ⇒ Object
- #to_custom_last_modified_time ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(file_id: SKIP, name: SKIP, created_time: SKIP, last_modified_time: SKIP, date: SKIP, mime_type: SKIP, size: SKIP, additional_properties: nil) ⇒ FileDetail
Returns a new instance of FileDetail.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 77 def initialize(file_id: SKIP, name: SKIP, created_time: SKIP, last_modified_time: SKIP, date: SKIP, mime_type: SKIP, size: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @file_id = file_id unless file_id == SKIP @name = name unless name == SKIP @created_time = created_time unless created_time == SKIP @last_modified_time = last_modified_time unless last_modified_time == SKIP @date = date unless date == SKIP @mime_type = mime_type unless mime_type == SKIP @size = size unless size == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#created_time ⇒ DateTime
Date and time for the file in PST
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 23 def created_time @created_time end |
#date ⇒ Date
Date and time for the file in PST
31 32 33 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 31 def date @date end |
#file_id ⇒ String
Unique identifier of a file
15 16 17 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 15 def file_id @file_id end |
#last_modified_time ⇒ DateTime
Date and time for the file in PST
27 28 29 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 27 def last_modified_time @last_modified_time end |
#mime_type ⇒ String
'File extension' Valid values:
- 'application/xml'
- 'text/csv'
- 'application/pdf'
- 'application/octet-stream'
40 41 42 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 40 def mime_type @mime_type end |
#name ⇒ String
Name of the file
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 19 def name @name end |
#size ⇒ Float
Size of the file in bytes
44 45 46 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 44 def size @size end |
Class Method Details
.from_element(root) ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 140 def self.from_element(root) file_id = XmlUtilities.from_element(root, 'fileId', String) name = XmlUtilities.from_element(root, 'name', String) created_time = XmlUtilities.from_element(root, 'createdTime', String, datetime_format: 'rfc3339') last_modified_time = XmlUtilities.from_element(root, 'lastModifiedTime', String, datetime_format: 'rfc3339') date = XmlUtilities.from_element(root, 'date', String) mime_type = XmlUtilities.from_element(root, 'mimeType', String) size = XmlUtilities.from_element(root, 'size', Float) new(file_id: file_id, name: name, created_time: created_time, last_modified_time: last_modified_time, date: date, mime_type: mime_type, size: size, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 94 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. file_id = hash.key?('fileId') ? hash['fileId'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP created_time = if hash.key?('createdTime') (DateTimeHelper.from_rfc3339(hash['createdTime']) if hash['createdTime']) else SKIP end last_modified_time = if hash.key?('lastModifiedTime') (DateTimeHelper.from_rfc3339(hash['lastModifiedTime']) if hash['lastModifiedTime']) else SKIP end date = hash.key?('date') ? hash['date'] : SKIP mime_type = hash.key?('mimeType') ? hash['mimeType'] : SKIP size = hash.key?('size') ? hash['size'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. FileDetail.new(file_id: file_id, name: name, created_time: created_time, last_modified_time: last_modified_time, date: date, mime_type: mime_type, size: size, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['file_id'] = 'fileId' @_hash['name'] = 'name' @_hash['created_time'] = 'createdTime' @_hash['last_modified_time'] = 'lastModifiedTime' @_hash['date'] = 'date' @_hash['mime_type'] = 'mimeType' @_hash['size'] = 'size' @_hash end |
.nullables ⇒ Object
An array for nullable fields
73 74 75 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 73 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 60 def self.optionals %w[ file_id name created_time last_modified_time date mime_type size ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
190 191 192 193 194 195 196 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 190 def inspect class_name = self.class.name.split('::').last "<#{class_name} file_id: #{@file_id.inspect}, name: #{@name.inspect}, created_time:"\ " #{@created_time.inspect}, last_modified_time: #{@last_modified_time.inspect}, date:"\ " #{@date.inspect}, mime_type: #{@mime_type.inspect}, size: #{@size.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_created_time ⇒ Object
132 133 134 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 132 def to_custom_created_time DateTimeHelper.to_rfc3339(created_time) end |
#to_custom_last_modified_time ⇒ Object
136 137 138 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 136 def to_custom_last_modified_time DateTimeHelper.to_rfc3339(last_modified_time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
182 183 184 185 186 187 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 182 def to_s class_name = self.class.name.split('::').last "<#{class_name} file_id: #{@file_id}, name: #{@name}, created_time: #{@created_time},"\ " last_modified_time: #{@last_modified_time}, date: #{@date}, mime_type: #{@mime_type},"\ " size: #{@size}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/cyber_source_merged_spec/models/file_detail.rb', line 162 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'fileId', file_id) XmlUtilities.add_as_subelement(doc, root, 'name', name) XmlUtilities.add_as_subelement(doc, root, 'createdTime', created_time, datetime_format: 'rfc3339') XmlUtilities.add_as_subelement(doc, root, 'lastModifiedTime', last_modified_time, datetime_format: 'rfc3339') XmlUtilities.add_as_subelement(doc, root, 'date', date) XmlUtilities.add_as_subelement(doc, root, 'mimeType', mime_type) XmlUtilities.add_as_subelement(doc, root, 'size', size) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |