Class: Asdawqw::APIResponseWithoutData
- Defined in:
- lib/asdawqw/models/api_response_without_data.rb
Overview
Common response for most of functions - where ‘data’ element is not present.
Instance Attribute Summary collapse
-
#code ⇒ String
Code of message.
-
#error_message ⇒ List of String
List of error messages.
-
#is_error ⇒ Boolean
Is error (default = false).
-
#message ⇒ String
text info message.
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.
Instance Method Summary collapse
-
#initialize(message = nil, error_message = nil, is_error = nil, code = nil) ⇒ APIResponseWithoutData
constructor
A new instance of APIResponseWithoutData.
Methods inherited from BaseModel
Constructor Details
#initialize(message = nil, error_message = nil, is_error = nil, code = nil) ⇒ APIResponseWithoutData
Returns a new instance of APIResponseWithoutData.
35 36 37 38 39 40 41 42 43 |
# File 'lib/asdawqw/models/api_response_without_data.rb', line 35 def initialize( = nil, = nil, is_error = nil, code = nil) @message = @error_message = @is_error = is_error @code = code end |
Instance Attribute Details
#code ⇒ String
Code of message
23 24 25 |
# File 'lib/asdawqw/models/api_response_without_data.rb', line 23 def code @code end |
#error_message ⇒ List of String
List of error messages
15 16 17 |
# File 'lib/asdawqw/models/api_response_without_data.rb', line 15 def @error_message end |
#is_error ⇒ Boolean
Is error (default = false)
19 20 21 |
# File 'lib/asdawqw/models/api_response_without_data.rb', line 19 def is_error @is_error end |
#message ⇒ String
text info message
11 12 13 |
# File 'lib/asdawqw/models/api_response_without_data.rb', line 11 def @message end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/asdawqw/models/api_response_without_data.rb', line 46 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = hash['message'] = hash['errorMessage'] is_error = hash['is_error'] code = hash['code'] # Create object from extracted values. APIResponseWithoutData.new(, , is_error, code) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 33 |
# File 'lib/asdawqw/models/api_response_without_data.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['message'] = 'message' @_hash['error_message'] = 'errorMessage' @_hash['is_error'] = 'is_error' @_hash['code'] = 'code' @_hash end |