Class: Bandwidth::PageInfo

Inherits:
BaseModel show all
Defined in:
lib/bandwidth/messaging_lib/messaging/models/page_info.rb

Overview

PageInfo Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(prev_page = nil, next_page = nil, prev_page_token = nil, next_page_token = nil) ⇒ PageInfo

Returns a new instance of PageInfo.



35
36
37
38
39
40
41
42
43
# File 'lib/bandwidth/messaging_lib/messaging/models/page_info.rb', line 35

def initialize(prev_page = nil,
               next_page = nil,
               prev_page_token = nil,
               next_page_token = nil)
  @prev_page = prev_page
  @next_page = next_page
  @prev_page_token = prev_page_token
  @next_page_token = next_page_token
end

Instance Attribute Details

#next_pageString

The link to the next page for pagination

Returns:

  • (String)


15
16
17
# File 'lib/bandwidth/messaging_lib/messaging/models/page_info.rb', line 15

def next_page
  @next_page
end

#next_page_tokenString

The isolated pagination token for the next page

Returns:

  • (String)


23
24
25
# File 'lib/bandwidth/messaging_lib/messaging/models/page_info.rb', line 23

def next_page_token
  @next_page_token
end

#prev_pageString

The link to the previous page for pagination

Returns:

  • (String)


11
12
13
# File 'lib/bandwidth/messaging_lib/messaging/models/page_info.rb', line 11

def prev_page
  @prev_page
end

#prev_page_tokenString

The isolated pagination token for the previous page

Returns:

  • (String)


19
20
21
# File 'lib/bandwidth/messaging_lib/messaging/models/page_info.rb', line 19

def prev_page_token
  @prev_page_token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/bandwidth/messaging_lib/messaging/models/page_info.rb', line 46

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  prev_page = hash['prevPage']
  next_page = hash['nextPage']
  prev_page_token = hash['prevPageToken']
  next_page_token = hash['nextPageToken']

  # Create object from extracted values.
  PageInfo.new(prev_page,
               next_page,
               prev_page_token,
               next_page_token)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
33
# File 'lib/bandwidth/messaging_lib/messaging/models/page_info.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['prev_page'] = 'prevPage'
  @_hash['next_page'] = 'nextPage'
  @_hash['prev_page_token'] = 'prevPageToken'
  @_hash['next_page_token'] = 'nextPageToken'
  @_hash
end