Class: Bandwidth::BandwidthMessagesList
- Defined in:
- lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb
Overview
BandwidthMessagesList Model.
Instance Attribute Summary collapse
-
#messages ⇒ List of BandwidthMessageItem
Total number of messages matched by the search.
-
#page_info ⇒ PageInfo
Total number of messages matched by the search.
-
#total_count ⇒ Integer
Total number of messages matched by the search.
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(total_count = nil, page_info = nil, messages = nil) ⇒ BandwidthMessagesList
constructor
A new instance of BandwidthMessagesList.
Methods inherited from BaseModel
Constructor Details
#initialize(total_count = nil, page_info = nil, messages = nil) ⇒ BandwidthMessagesList
Returns a new instance of BandwidthMessagesList.
30 31 32 33 34 35 36 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 30 def initialize(total_count = nil, page_info = nil, = nil) @total_count = total_count @page_info = page_info @messages = end |
Instance Attribute Details
#messages ⇒ List of BandwidthMessageItem
Total number of messages matched by the search
19 20 21 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 19 def @messages end |
#page_info ⇒ PageInfo
Total number of messages matched by the search
15 16 17 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 15 def page_info @page_info end |
#total_count ⇒ Integer
Total number of messages matched by the search
11 12 13 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 11 def total_count @total_count end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 39 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. total_count = hash['totalCount'] page_info = PageInfo.from_hash(hash['pageInfo']) if hash['pageInfo'] # Parameter is an array, so we need to iterate through it = nil unless hash['messages'].nil? = [] hash['messages'].each do |structure| << (BandwidthMessageItem.from_hash(structure) if structure) end end # Create object from extracted values. BandwidthMessagesList.new(total_count, page_info, ) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 28 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['total_count'] = 'totalCount' @_hash['page_info'] = 'pageInfo' @_hash['messages'] = 'messages' @_hash end |