Class: Page

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/restpack_activity/models/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, key) ⇒ Page

Returns a new instance of Page.



11
12
13
14
15
16
17
18
19
# File 'lib/restpack_activity/models/page.rb', line 11

def initialize(response, key)
  @response = response
  @key = key
  @items = []

  response.result[key].each do |item|
    @items << yield(item)
  end
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



9
10
11
# File 'lib/restpack_activity/models/page.rb', line 9

def items
  @items
end

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/restpack_activity/models/page.rb', line 9

def response
  @response
end

Instance Method Details

#countObject



21
22
23
# File 'lib/restpack_activity/models/page.rb', line 21

def count
  meta :count
end

#next_pageObject



41
42
43
# File 'lib/restpack_activity/models/page.rb', line 41

def next_page
  meta :next_page
end

#next_page?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/restpack_activity/models/page.rb', line 49

def next_page?
  next_page != nil
end

#pageObject



25
26
27
# File 'lib/restpack_activity/models/page.rb', line 25

def page
  meta :page
end

#page_countObject



33
34
35
# File 'lib/restpack_activity/models/page.rb', line 33

def page_count
  meta :page_count
end

#page_sizeObject



29
30
31
# File 'lib/restpack_activity/models/page.rb', line 29

def page_size
  meta :page_size
end

#previous_pageObject



37
38
39
# File 'lib/restpack_activity/models/page.rb', line 37

def previous_page
  meta :previous_page
end

#previous_page?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/restpack_activity/models/page.rb', line 45

def previous_page?
  previous_page != nil
end