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.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(total_count = nil, page_info = nil, messages = nil) ⇒ BandwidthMessagesList
Returns a new instance of BandwidthMessagesList.
47 48 49 50 51 52 53 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 47 def initialize(total_count = nil, page_info = nil, = nil) @total_count = total_count unless total_count == SKIP @page_info = page_info unless page_info == SKIP @messages = unless == SKIP end |
Instance Attribute Details
#messages ⇒ List of BandwidthMessageItem
Total number of messages matched by the search
22 23 24 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 22 def @messages end |
#page_info ⇒ PageInfo
Total number of messages matched by the search
18 19 20 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 18 def page_info @page_info end |
#total_count ⇒ Integer
Total number of messages matched by the search
14 15 16 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 14 def total_count @total_count end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. total_count = hash.key?('totalCount') ? hash['totalCount'] : SKIP 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 = SKIP unless hash.key?('messages') # Create object from extracted values. BandwidthMessagesList.new(total_count, page_info, ) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['total_count'] = 'totalCount' @_hash['page_info'] = 'pageInfo' @_hash['messages'] = 'messages' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 43 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb', line 34 def optionals %w[ total_count page_info messages ] end |