class Bandwidth::BandwidthMessagesList

BandwidthMessagesList Model.

Attributes

messages[RW]

Total number of messages matched by the search @return [List of BandwidthMessageItem]

page_info[RW]

Total number of messages matched by the search @return [PageInfo]

total_count[RW]

Total number of messages matched by the search @return [Integer]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# 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
  messages = nil
  unless hash['messages'].nil?
    messages = []
    hash['messages'].each do |structure|
      messages << (BandwidthMessageItem.from_hash(structure) if structure)
    end
  end

  # Create object from extracted values.
  BandwidthMessagesList.new(total_count,
                            page_info,
                            messages)
end
names() click to toggle source

A mapping from model property names to API property names.

# 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
new(total_count = nil, page_info = nil, messages = nil) click to toggle source
# File lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb, line 30
def initialize(total_count = nil,
               page_info = nil,
               messages = nil)
  @total_count = total_count
  @page_info = page_info
  @messages = messages
end