Sha256: 9268477d97f302c02983af7cf9e18c52bf3cfb5bdfafb785c690612641351c10

Contents?: true

Size: 1.77 KB

Versions: 7

Compression:

Stored size: 1.77 KB

Contents

# bandwidth
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).

module Bandwidth
  # BandwidthMessagesList Model.
  class BandwidthMessagesList < BaseModel
    # Total number of messages matched by the search
    # @return [Integer]
    attr_accessor :total_count

    # Total number of messages matched by the search
    # @return [PageInfo]
    attr_accessor :page_info

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

    # A mapping from model property names to API property names.
    def self.names
      @_hash = {} if @_hash.nil?
      @_hash['total_count'] = 'totalCount'
      @_hash['page_info'] = 'pageInfo'
      @_hash['messages'] = 'messages'
      @_hash
    end

    def initialize(total_count = nil,
                   page_info = nil,
                   messages = nil)
      @total_count = total_count
      @page_info = page_info
      @messages = messages
    end

    # Creates an instance of the object from a hash.
    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bandwidth-sdk-8.0.0 lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb
bandwidth-sdk-7.1.0 lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb
bandwidth-sdk-7.0.0 lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb
bandwidth-sdk-6.2.0 lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb
bandwidth-sdk-6.1.0 lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb
bandwidth-sdk-6.0.0 lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb
bandwidth-sdk-5.0.0 lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb