Class: ReliefWebAPI::Training
- Inherits:
-
Object
- Object
- ReliefWebAPI::Training
- Defined in:
- lib/reliefweb-api/models/training.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#date ⇒ Object
Returns the value of attribute date.
-
#description ⇒ Object
Returns the value of attribute description.
-
#description_html ⇒ Object
Returns the value of attribute description_html.
-
#file ⇒ Object
Returns the value of attribute file.
-
#format ⇒ Object
Returns the value of attribute format.
-
#how_to_apply ⇒ Object
Returns the value of attribute how_to_apply.
-
#how_to_apply_html ⇒ Object
Returns the value of attribute how_to_apply_html.
-
#id ⇒ Object
Returns the value of attribute id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#link ⇒ Object
Returns the value of attribute link.
-
#theme ⇒ Object
Returns the value of attribute theme.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Training
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Training
Initializes the object
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 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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/reliefweb-api/models/training.rb', line 95 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'category') if (value = attributes[:'category']).is_a?(Array) self.category = value end end if attributes.has_key?(:'city') if (value = attributes[:'city']).is_a?(Array) self.city = value end end if attributes.has_key?(:'country') if (value = attributes[:'country']).is_a?(Array) self.country = value end end if attributes.has_key?(:'date') self.date = attributes[:'date'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'description-html') self.description_html = attributes[:'description-html'] end if attributes.has_key?(:'file') if (value = attributes[:'file']).is_a?(Array) self.file = value end end if attributes.has_key?(:'format') if (value = attributes[:'format']).is_a?(Array) self.format = value end end if attributes.has_key?(:'how-to-apply-html') self.how_to_apply_html = attributes[:'how-to-apply-html'] end if attributes.has_key?(:'how_to_apply') self.how_to_apply = attributes[:'how_to_apply'] end if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'language') self.language = attributes[:'language'] end if attributes.has_key?(:'link') self.link = attributes[:'link'] end if attributes.has_key?(:'theme') if (value = attributes[:'theme']).is_a?(Array) self.theme = value end end if attributes.has_key?(:'title') self.title = attributes[:'title'] end if attributes.has_key?(:'url') self.url = attributes[:'url'] end end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
17 18 19 |
# File 'lib/reliefweb-api/models/training.rb', line 17 def category @category end |
#city ⇒ Object
Returns the value of attribute city.
19 20 21 |
# File 'lib/reliefweb-api/models/training.rb', line 19 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
21 22 23 |
# File 'lib/reliefweb-api/models/training.rb', line 21 def country @country end |
#date ⇒ Object
Returns the value of attribute date.
23 24 25 |
# File 'lib/reliefweb-api/models/training.rb', line 23 def date @date end |
#description ⇒ Object
Returns the value of attribute description.
25 26 27 |
# File 'lib/reliefweb-api/models/training.rb', line 25 def description @description end |
#description_html ⇒ Object
Returns the value of attribute description_html.
27 28 29 |
# File 'lib/reliefweb-api/models/training.rb', line 27 def description_html @description_html end |
#file ⇒ Object
Returns the value of attribute file.
29 30 31 |
# File 'lib/reliefweb-api/models/training.rb', line 29 def file @file end |
#format ⇒ Object
Returns the value of attribute format.
31 32 33 |
# File 'lib/reliefweb-api/models/training.rb', line 31 def format @format end |
#how_to_apply ⇒ Object
Returns the value of attribute how_to_apply.
35 36 37 |
# File 'lib/reliefweb-api/models/training.rb', line 35 def how_to_apply @how_to_apply end |
#how_to_apply_html ⇒ Object
Returns the value of attribute how_to_apply_html.
33 34 35 |
# File 'lib/reliefweb-api/models/training.rb', line 33 def how_to_apply_html @how_to_apply_html end |
#id ⇒ Object
Returns the value of attribute id.
37 38 39 |
# File 'lib/reliefweb-api/models/training.rb', line 37 def id @id end |
#language ⇒ Object
Returns the value of attribute language.
39 40 41 |
# File 'lib/reliefweb-api/models/training.rb', line 39 def language @language end |
#link ⇒ Object
Returns the value of attribute link.
41 42 43 |
# File 'lib/reliefweb-api/models/training.rb', line 41 def link @link end |
#theme ⇒ Object
Returns the value of attribute theme.
43 44 45 |
# File 'lib/reliefweb-api/models/training.rb', line 43 def theme @theme end |
#title ⇒ Object
Returns the value of attribute title.
45 46 47 |
# File 'lib/reliefweb-api/models/training.rb', line 45 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
47 48 49 |
# File 'lib/reliefweb-api/models/training.rb', line 47 def url @url end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/reliefweb-api/models/training.rb', line 50 def self.attribute_map { :'category' => :'category', :'city' => :'city', :'country' => :'country', :'date' => :'date', :'description' => :'description', :'description_html' => :'description-html', :'file' => :'file', :'format' => :'format', :'how_to_apply_html' => :'how-to-apply-html', :'how_to_apply' => :'how_to_apply', :'id' => :'id', :'language' => :'language', :'link' => :'link', :'theme' => :'theme', :'title' => :'title', :'url' => :'url' } end |
.swagger_types ⇒ Object
Attribute type mapping.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/reliefweb-api/models/training.rb', line 72 def self.swagger_types { :'category' => :'Array<Category>', :'city' => :'Array<Location>', :'country' => :'Array<Country>', :'date' => :'Date', :'description' => :'String', :'description_html' => :'String', :'file' => :'Array<File>', :'format' => :'Array<Category>', :'how_to_apply_html' => :'String', :'how_to_apply' => :'String', :'id' => :'String', :'language' => :'Language', :'link' => :'String', :'theme' => :'Array<Category>', :'title' => :'String', :'url' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/reliefweb-api/models/training.rb', line 193 def ==(o) return true if self.equal?(o) self.class == o.class && category == o.category && city == o.city && country == o.country && date == o.date && description == o.description && description_html == o.description_html && file == o.file && format == o.format && how_to_apply_html == o.how_to_apply_html && how_to_apply == o.how_to_apply && id == o.id && language == o.language && link == o.link && theme == o.theme && title == o.title && url == o.url end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/reliefweb-api/models/training.rb', line 250 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = ReliefWebAPI.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/reliefweb-api/models/training.rb', line 316 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/reliefweb-api/models/training.rb', line 229 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
216 217 218 |
# File 'lib/reliefweb-api/models/training.rb', line 216 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
222 223 224 |
# File 'lib/reliefweb-api/models/training.rb', line 222 def hash [category, city, country, date, description, description_html, file, format, how_to_apply_html, how_to_apply, id, language, link, theme, title, url].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
180 181 182 183 |
# File 'lib/reliefweb-api/models/training.rb', line 180 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
296 297 298 |
# File 'lib/reliefweb-api/models/training.rb', line 296 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
302 303 304 305 306 307 308 309 310 |
# File 'lib/reliefweb-api/models/training.rb', line 302 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
290 291 292 |
# File 'lib/reliefweb-api/models/training.rb', line 290 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
187 188 189 |
# File 'lib/reliefweb-api/models/training.rb', line 187 def valid? true end |