Class: CtdDocumentation::Information
- Defined in:
- lib/ctd_documentation/models/information.rb
Overview
Information Model.
Instance Attribute Summary collapse
-
#approved ⇒ TrueClass|FalseClass
TODO: Write general description for this method.
-
#asset_id ⇒ Integer
TODO: Write general description for this method.
-
#code_sections ⇒ List of CodeSections
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#information_type_name ⇒ String
TODO: Write general description for this method.
-
#information_type_number ⇒ Integer
TODO: Write general description for this method.
-
#originator_name ⇒ String
TODO: Write general description for this method.
-
#originator_number ⇒ Integer
TODO: Write general description for this method.
-
#resource_id ⇒ String
TODO: Write general description for this method.
-
#site_id ⇒ Integer
TODO: Write general description for this method.
-
#source ⇒ String
TODO: Write general description for this method.
-
#timestamp ⇒ String
TODO: Write general description for this method.
-
#valid ⇒ TrueClass|FalseClass
TODO: Write general description for this method.
Class Method Summary collapse
-
.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(site_id = SKIP, resource_id = SKIP, id = SKIP, asset_id = SKIP, code_sections = SKIP, source = SKIP, originator_name = SKIP, originator_number = SKIP, information_type_name = SKIP, information_type_number = SKIP, approved = SKIP, valid = SKIP, timestamp = SKIP) ⇒ Information
constructor
A new instance of Information.
Methods inherited from BaseModel
Constructor Details
#initialize(site_id = SKIP, resource_id = SKIP, id = SKIP, asset_id = SKIP, code_sections = SKIP, source = SKIP, originator_name = SKIP, originator_number = SKIP, information_type_name = SKIP, information_type_number = SKIP, approved = SKIP, valid = SKIP, timestamp = SKIP) ⇒ Information
Returns a new instance of Information.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/ctd_documentation/models/information.rb', line 107 def initialize(site_id = SKIP, resource_id = SKIP, id = SKIP, asset_id = SKIP, code_sections = SKIP, source = SKIP, originator_name = SKIP, originator_number = SKIP, information_type_name = SKIP, information_type_number = SKIP, approved = SKIP, valid = SKIP, = SKIP) @site_id = site_id unless site_id == SKIP @resource_id = resource_id unless resource_id == SKIP @id = id unless id == SKIP @asset_id = asset_id unless asset_id == SKIP @code_sections = code_sections unless code_sections == SKIP @source = source unless source == SKIP @originator_name = originator_name unless originator_name == SKIP @originator_number = originator_number unless originator_number == SKIP @information_type_name = information_type_name unless information_type_name == SKIP @information_type_number = information_type_number unless information_type_number == SKIP @approved = approved unless approved == SKIP @valid = valid unless valid == SKIP = unless == SKIP end |
Instance Attribute Details
#approved ⇒ TrueClass|FalseClass
TODO: Write general description for this method
54 55 56 |
# File 'lib/ctd_documentation/models/information.rb', line 54 def approved @approved end |
#asset_id ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/ctd_documentation/models/information.rb', line 26 def asset_id @asset_id end |
#code_sections ⇒ List of CodeSections
TODO: Write general description for this method
30 31 32 |
# File 'lib/ctd_documentation/models/information.rb', line 30 def code_sections @code_sections end |
#id ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/ctd_documentation/models/information.rb', line 22 def id @id end |
#information_type_name ⇒ String
TODO: Write general description for this method
46 47 48 |
# File 'lib/ctd_documentation/models/information.rb', line 46 def information_type_name @information_type_name end |
#information_type_number ⇒ Integer
TODO: Write general description for this method
50 51 52 |
# File 'lib/ctd_documentation/models/information.rb', line 50 def information_type_number @information_type_number end |
#originator_name ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/ctd_documentation/models/information.rb', line 38 def originator_name @originator_name end |
#originator_number ⇒ Integer
TODO: Write general description for this method
42 43 44 |
# File 'lib/ctd_documentation/models/information.rb', line 42 def originator_number @originator_number end |
#resource_id ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/ctd_documentation/models/information.rb', line 18 def resource_id @resource_id end |
#site_id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/ctd_documentation/models/information.rb', line 14 def site_id @site_id end |
#source ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/ctd_documentation/models/information.rb', line 34 def source @source end |
#timestamp ⇒ String
TODO: Write general description for this method
62 63 64 |
# File 'lib/ctd_documentation/models/information.rb', line 62 def end |
#valid ⇒ TrueClass|FalseClass
TODO: Write general description for this method
58 59 60 |
# File 'lib/ctd_documentation/models/information.rb', line 58 def valid @valid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/ctd_documentation/models/information.rb', line 136 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. site_id = hash.key?('site_id') ? hash['site_id'] : SKIP resource_id = hash.key?('resource_id') ? hash['resource_id'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP asset_id = hash.key?('asset_id') ? hash['asset_id'] : SKIP # Parameter is an array, so we need to iterate through it code_sections = nil unless hash['code_sections'].nil? code_sections = [] hash['code_sections'].each do |structure| code_sections << (CodeSections.from_hash(structure) if structure) end end code_sections = SKIP unless hash.key?('code_sections') source = hash.key?('source') ? hash['source'] : SKIP originator_name = hash.key?('originator_name') ? hash['originator_name'] : SKIP originator_number = hash.key?('originator_number') ? hash['originator_number'] : SKIP information_type_name = hash.key?('information_type_name') ? hash['information_type_name'] : SKIP information_type_number = hash.key?('information_type_number') ? hash['information_type_number'] : SKIP approved = hash.key?('approved') ? hash['approved'] : SKIP valid = hash.key?('valid') ? hash['valid'] : SKIP = hash.key?('timestamp') ? hash['timestamp'] : SKIP # Create object from extracted values. Information.new(site_id, resource_id, id, asset_id, code_sections, source, originator_name, originator_number, information_type_name, information_type_number, approved, valid, ) end |
.names ⇒ Object
A mapping from model property names to API property names.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/ctd_documentation/models/information.rb', line 65 def self.names @_hash = {} if @_hash.nil? @_hash['site_id'] = 'site_id' @_hash['resource_id'] = 'resource_id' @_hash['id'] = 'id' @_hash['asset_id'] = 'asset_id' @_hash['code_sections'] = 'code_sections' @_hash['source'] = 'source' @_hash['originator_name'] = 'originator_name' @_hash['originator_number'] = 'originator_number' @_hash['information_type_name'] = 'information_type_name' @_hash['information_type_number'] = 'information_type_number' @_hash['approved'] = 'approved' @_hash['valid'] = 'valid' @_hash['timestamp'] = 'timestamp' @_hash end |
.nullables ⇒ Object
An array for nullable fields
103 104 105 |
# File 'lib/ctd_documentation/models/information.rb', line 103 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ctd_documentation/models/information.rb', line 84 def self.optionals %w[ site_id resource_id id asset_id code_sections source originator_name originator_number information_type_name information_type_number approved valid timestamp ] end |