Class: ApiReference::MatrixCell
- Defined in:
- lib/api_reference/models/matrix_cell.rb
Overview
MatrixCell Model.
Instance Attribute Summary collapse
-
#first_dimension_value ⇒ String
TODO: Write general description for this method.
-
#second_dimension_value ⇒ String
TODO: Write general description for this method.
-
#unit_amount ⇒ String
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(first_dimension_value:, unit_amount:, second_dimension_value: SKIP) ⇒ MatrixCell
constructor
A new instance of MatrixCell.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the 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(first_dimension_value:, unit_amount:, second_dimension_value: SKIP) ⇒ MatrixCell
Returns a new instance of MatrixCell.
47 48 49 50 51 52 |
# File 'lib/api_reference/models/matrix_cell.rb', line 47 def initialize(first_dimension_value:, unit_amount:, second_dimension_value: SKIP) @first_dimension_value = first_dimension_value @second_dimension_value = second_dimension_value unless second_dimension_value == SKIP @unit_amount = unit_amount end |
Instance Attribute Details
#first_dimension_value ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/api_reference/models/matrix_cell.rb', line 14 def first_dimension_value @first_dimension_value end |
#second_dimension_value ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/api_reference/models/matrix_cell.rb', line 18 def second_dimension_value @second_dimension_value end |
#unit_amount ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/api_reference/models/matrix_cell.rb', line 22 def unit_amount @unit_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/api_reference/models/matrix_cell.rb', line 55 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. first_dimension_value = hash.key?('first_dimension_value') ? hash['first_dimension_value'] : nil unit_amount = hash.key?('unit_amount') ? hash['unit_amount'] : nil second_dimension_value = hash.key?('second_dimension_value') ? hash['second_dimension_value'] : SKIP # Create object from extracted values. MatrixCell.new(first_dimension_value: first_dimension_value, unit_amount: unit_amount, second_dimension_value: second_dimension_value) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/api_reference/models/matrix_cell.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['first_dimension_value'] = 'first_dimension_value' @_hash['second_dimension_value'] = 'second_dimension_value' @_hash['unit_amount'] = 'unit_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 44 45 |
# File 'lib/api_reference/models/matrix_cell.rb', line 41 def self.nullables %w[ second_dimension_value ] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 |
# File 'lib/api_reference/models/matrix_cell.rb', line 34 def self.optionals %w[ second_dimension_value ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/api_reference/models/matrix_cell.rb', line 73 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.first_dimension_value, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.unit_amount, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['first_dimension_value'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['unit_amount'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
101 102 103 104 105 106 |
# File 'lib/api_reference/models/matrix_cell.rb', line 101 def inspect class_name = self.class.name.split('::').last "<#{class_name} first_dimension_value: #{@first_dimension_value.inspect},"\ " second_dimension_value: #{@second_dimension_value.inspect}, unit_amount:"\ " #{@unit_amount.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
94 95 96 97 98 |
# File 'lib/api_reference/models/matrix_cell.rb', line 94 def to_s class_name = self.class.name.split('::').last "<#{class_name} first_dimension_value: #{@first_dimension_value}, second_dimension_value:"\ " #{@second_dimension_value}, unit_amount: #{@unit_amount}>" end |