Class: OneRosterClient::LineItemType
- Defined in:
- lib/oneroster_client/models/line_item_type.rb
Overview
…tbd (Class description)…
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_class ⇒ Object
Returns the value of attribute _class.
-
#assign_date ⇒ Object
Model Primitive Datatype = DateTime.
-
#category ⇒ Object
Returns the value of attribute category.
-
#date_last_modified ⇒ Object
Model Primitive Datatype = DateTime.
-
#description ⇒ Object
Model Primitive Datatype = String.
-
#due_date ⇒ Object
Model Primitive Datatype = DateTime.
-
#grading_period ⇒ Object
Returns the value of attribute grading_period.
-
#metadata ⇒ Object
…tbd (Class description)…
-
#result_value_max ⇒ Object
Model Primitive Datatype = Float.
-
#result_value_min ⇒ Object
Model Primitive Datatype = Float.
-
#sourced_id ⇒ Object
…tbd (Class description)…
-
#status ⇒ Object
Returns the value of attribute status.
-
#title ⇒ Object
Model Primitive Datatype = NormalizedString.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_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 ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ LineItemType
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 = {}) ⇒ LineItemType
Initializes the object
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 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 121 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OneRosterClient::LineItemType` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OneRosterClient::LineItemType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } # call parent's initialize super(attributes) if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'assign_date') self.assign_date = attributes[:'assign_date'] end if attributes.key?(:'due_date') self.due_date = attributes[:'due_date'] end if attributes.key?(:'_class') self._class = attributes[:'_class'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'grading_period') self.grading_period = attributes[:'grading_period'] end if attributes.key?(:'result_value_min') self.result_value_min = attributes[:'result_value_min'] end if attributes.key?(:'result_value_max') self.result_value_max = attributes[:'result_value_max'] end if attributes.key?(:'sourced_id') self.sourced_id = attributes[:'sourced_id'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'date_last_modified') self.date_last_modified = attributes[:'date_last_modified'] end if attributes.key?(:'metadata') self. = attributes[:'metadata'] end end |
Instance Attribute Details
#_class ⇒ Object
Returns the value of attribute _class.
30 31 32 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 30 def _class @_class end |
#assign_date ⇒ Object
Model Primitive Datatype = DateTime
25 26 27 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 25 def assign_date @assign_date end |
#category ⇒ Object
Returns the value of attribute category.
32 33 34 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 32 def category @category end |
#date_last_modified ⇒ Object
Model Primitive Datatype = DateTime
48 49 50 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 48 def date_last_modified @date_last_modified end |
#description ⇒ Object
Model Primitive Datatype = String
22 23 24 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 22 def description @description end |
#due_date ⇒ Object
Model Primitive Datatype = DateTime
28 29 30 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 28 def due_date @due_date end |
#grading_period ⇒ Object
Returns the value of attribute grading_period.
34 35 36 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 34 def grading_period @grading_period end |
#metadata ⇒ Object
…tbd (Class description)…
51 52 53 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 51 def @metadata end |
#result_value_max ⇒ Object
Model Primitive Datatype = Float
40 41 42 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 40 def result_value_max @result_value_max end |
#result_value_min ⇒ Object
Model Primitive Datatype = Float
37 38 39 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 37 def result_value_min @result_value_min end |
#sourced_id ⇒ Object
…tbd (Class description)…
43 44 45 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 43 def sourced_id @sourced_id end |
#status ⇒ Object
Returns the value of attribute status.
45 46 47 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 45 def status @status end |
#title ⇒ Object
Model Primitive Datatype = NormalizedString
19 20 21 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 19 def title @title end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 76 def self.attribute_map { :'title' => :'title', :'description' => :'description', :'assign_date' => :'assignDate', :'due_date' => :'dueDate', :'_class' => :'class', :'category' => :'category', :'grading_period' => :'gradingPeriod', :'result_value_min' => :'resultValueMin', :'result_value_max' => :'resultValueMax', :'sourced_id' => :'sourcedId', :'status' => :'status', :'date_last_modified' => :'dateLastModified', :'metadata' => :'metadata' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
290 291 292 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 290 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
114 115 116 117 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 114 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 95 def self.openapi_types { :'title' => :'String', :'description' => :'String', :'assign_date' => :'DateTime', :'due_date' => :'DateTime', :'_class' => :'GUIDRefType', :'category' => :'GUIDRefType', :'grading_period' => :'GUIDRefType', :'result_value_min' => :'Float', :'result_value_max' => :'Float', :'sourced_id' => :'String', :'status' => :'String', :'date_last_modified' => :'DateTime', :'metadata' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 257 def ==(o) return true if self.equal?(o) self.class == o.class && title == o.title && description == o.description && assign_date == o.assign_date && due_date == o.due_date && _class == o._class && category == o.category && grading_period == o.grading_period && result_value_min == o.result_value_min && result_value_max == o.result_value_max && sourced_id == o.sourced_id && status == o.status && date_last_modified == o.date_last_modified && == o. && super(o) end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 321 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 OneRosterClient.const_get(type).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
390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 390 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
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 297 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) super(attributes) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that 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]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end |
#eql?(o) ⇒ Boolean
277 278 279 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 277 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
283 284 285 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 283 def hash [title, description, assign_date, due_date, _class, category, grading_period, result_value_min, result_value_max, sourced_id, status, date_last_modified, ].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 192 def list_invalid_properties invalid_properties = super if @title.nil? invalid_properties.push('invalid value for "title", title cannot be nil.') end if @assign_date.nil? invalid_properties.push('invalid value for "assign_date", assign_date cannot be nil.') end if @_class.nil? invalid_properties.push('invalid value for "_class", _class cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category cannot be nil.') end if @result_value_min.nil? invalid_properties.push('invalid value for "result_value_min", result_value_min cannot be nil.') end if @sourced_id.nil? invalid_properties.push('invalid value for "sourced_id", sourced_id cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @date_last_modified.nil? invalid_properties.push('invalid value for "date_last_modified", date_last_modified cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
366 367 368 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 366 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 372 def to_hash hash = super self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
360 361 362 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 360 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/oneroster_client/models/line_item_type.rb', line 231 def valid? return false if @title.nil? return false if @assign_date.nil? return false if @_class.nil? return false if @category.nil? return false if @result_value_min.nil? return false if @sourced_id.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('', ['active', 'tobedeleted']) return false unless status_validator.valid?(@status) return false if @date_last_modified.nil? true end |