class Nokotime::Request::SinglePage
Attributes
last_response[R]
raw_links[R]
Public Class Methods
new()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 7 def initialize @last_response = nil @raw_links = nil end
Public Instance Methods
first()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 48 def first first? ? get(paginator.first) : nil end
first?()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 52 def first? paginator.first end
get(path, params: {}, request_options: {})
click to toggle source
# File lib/nokotime/request/single_page.rb, line 12 def get(path, params: {}, request_options: {}) @last_response = client.get( path, params: params, request_options: request_options ) @raw_links = @last_response.headers["link"] || [] self end
last()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 40 def last last? ? get(paginator.last) : nil end
last?()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 44 def last? paginator.last end
next()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 24 def next next? ? get(paginator.next) : nil end
next?()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 28 def next? paginator.next end
prev()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 32 def prev prev? ? get(paginator.prev) : nil end
prev?()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 36 def prev? paginator.prev end
total_pages()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 56 def total_pages paginator.total_pages.to_i end
Private Instance Methods
client()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 66 def client @client = Connection.new end
paginator()
click to toggle source
# File lib/nokotime/request/single_page.rb, line 62 def paginator @paginator = Paginator.new(raw_links) end