class PixivApi::Response::Pagination

Attributes

current[R]
next[R]
pages[R]
per_page[R]
previous[R]
total[R]

Public Class Methods

define_pagination_url(*attrs) click to toggle source
# File lib/pixiv_api/response/pagination.rb, line 8
def self.define_pagination_url(*attrs)
  attrs.each do |attr|
    define_method "#{attr}_url" do
      if self[attr]
        params = @request.params.merge('page' => self[attr])
        url = @request.url
        url.query = URI.encode_www_form(params)
        url
      end
    end
  end
end
from_response(response, *attributes) click to toggle source
# File lib/pixiv_api/response/pagination.rb, line 4
def self.from_response(response, *attributes)
  new(response, *attributes)
end