Class: VoiceML::MessageList

Inherits:
Object
  • Object
show all
Includes:
Pageable
Defined in:
lib/voiceml/models/messages.rb

Overview

Paginated ‘GET /Messages` response.

Constant Summary

Constants included from Pageable

Pageable::PAGE_FIELDS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Pageable

#assign_page_fields

Constructor Details

#initialize(hash = {}) ⇒ MessageList

Returns a new instance of MessageList.



47
48
49
50
# File 'lib/voiceml/models/messages.rb', line 47

def initialize(hash = {})
  assign_page_fields(hash)
  @messages = (hash['messages'] || []).map { |m| Message.from_hash(m) }
end

Instance Attribute Details

#messagesObject (readonly)

Returns the value of attribute messages.



45
46
47
# File 'lib/voiceml/models/messages.rb', line 45

def messages
  @messages
end

Class Method Details

.from_hash(hash) ⇒ Object



52
53
54
# File 'lib/voiceml/models/messages.rb', line 52

def self.from_hash(hash)
  new(hash || {})
end