Class: Asdawqw::GetMessageListForSpecificThreadResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/asdawqw/models/get_message_list_for_specific_thread_response.rb

Overview

GetMessageListForSpecificThreadResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(message = nil, error_message = nil, is_error = nil, code = nil, data = nil) ⇒ GetMessageListForSpecificThreadResponse

Returns a new instance of GetMessageListForSpecificThreadResponse.



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/asdawqw/models/get_message_list_for_specific_thread_response.rb', line 40

def initialize(message = nil,
               error_message = nil,
               is_error = nil,
               code = nil,
               data = nil)
  @message = message
  @error_message = error_message
  @is_error = is_error
  @code = code
  @data = data
end

Instance Attribute Details

#codeString

Code of message

Returns:



23
24
25
# File 'lib/asdawqw/models/get_message_list_for_specific_thread_response.rb', line 23

def code
  @code
end

#dataList of MessagesModel

List of Models

Returns:



27
28
29
# File 'lib/asdawqw/models/get_message_list_for_specific_thread_response.rb', line 27

def data
  @data
end

#error_messageList of String

List of error messages

Returns:



15
16
17
# File 'lib/asdawqw/models/get_message_list_for_specific_thread_response.rb', line 15

def error_message
  @error_message
end

#is_errorBoolean

Is error (default = false)

Returns:

  • (Boolean)


19
20
21
# File 'lib/asdawqw/models/get_message_list_for_specific_thread_response.rb', line 19

def is_error
  @is_error
end

#messageString

Text info message

Returns:



11
12
13
# File 'lib/asdawqw/models/get_message_list_for_specific_thread_response.rb', line 11

def message
  @message
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/asdawqw/models/get_message_list_for_specific_thread_response.rb', line 53

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  message = hash['message']
  error_message = hash['errorMessage']
  is_error = hash['is_error']
  code = hash['code']
  # Parameter is an array, so we need to iterate through it
  data = nil
  unless hash['data'].nil?
    data = []
    hash['data'].each do |structure|
      data << (MessagesModel.from_hash(structure) if structure)
    end
  end

  # Create object from extracted values.
  GetMessageListForSpecificThreadResponse.new(message,
                                              error_message,
                                              is_error,
                                              code,
                                              data)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
38
# File 'lib/asdawqw/models/get_message_list_for_specific_thread_response.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['message'] = 'message'
  @_hash['error_message'] = 'errorMessage'
  @_hash['is_error'] = 'is_error'
  @_hash['code'] = 'code'
  @_hash['data'] = 'data'
  @_hash
end