Class: SplititWebApiV4::ApiErrorModel
- Defined in:
- lib/splitit_web_api_v4/models/api_error_model.rb
Overview
ApiErrorModel Model.
Instance Attribute Summary collapse
-
#additional_info ⇒ String
TODO: Write general description for this method.
-
#code ⇒ String
TODO: Write general description for this method.
-
#extra_data ⇒ Hash[String, String]
TODO: Write general description for this method.
-
#message ⇒ 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.
Instance Method Summary collapse
-
#initialize(code: SKIP, message: SKIP, additional_info: SKIP, extra_data: SKIP, additional_properties: nil) ⇒ ApiErrorModel
constructor
A new instance of ApiErrorModel.
-
#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(code: SKIP, message: SKIP, additional_info: SKIP, extra_data: SKIP, additional_properties: nil) ⇒ ApiErrorModel
Returns a new instance of ApiErrorModel.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 53 def initialize(code: SKIP, message: SKIP, additional_info: SKIP, extra_data: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @code = code unless code == SKIP @message = unless == SKIP @additional_info = additional_info unless additional_info == SKIP @extra_data = extra_data unless extra_data == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#additional_info ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 22 def additional_info @additional_info end |
#code ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 14 def code @code end |
#extra_data ⇒ Hash[String, String]
TODO: Write general description for this method
26 27 28 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 26 def extra_data @extra_data end |
#message ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 18 def @message end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. code = hash.key?('Code') ? hash['Code'] : SKIP = hash.key?('Message') ? hash['Message'] : SKIP additional_info = hash.key?('AdditionalInfo') ? hash['AdditionalInfo'] : SKIP extra_data = hash.key?('ExtraData') ? hash['ExtraData'] : 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. ApiErrorModel.new(code: code, message: , additional_info: additional_info, extra_data: extra_data, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'Code' @_hash['message'] = 'Message' @_hash['additional_info'] = 'AdditionalInfo' @_hash['extra_data'] = 'ExtraData' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 39 def self.optionals %w[ code message additional_info extra_data ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 104 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} code: #{@code.inspect}, message: #{@message.inspect}, additional_info:"\ " #{@additional_info.inspect}, extra_data: #{@extra_data.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 |
# File 'lib/splitit_web_api_v4/models/api_error_model.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} code: #{@code}, message: #{@message}, additional_info: #{@additional_info},"\ " extra_data: #{@extra_data}, additional_properties: #{@additional_properties}>" end |