Class: BitBucket::PageLinks

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/bitbucket_rest_api/page_links.rb

Overview

Determines the links in the current response to be used to find the links to other pages of request responses.

Constant Summary collapse

FIRST_PAGE_NUMBER =

:nodoc:

1

Constants included from Constants

Constants::ACCEPT, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::PARAM_PAGE, Constants::PARAM_START_PAGE, Constants::QUERY_STR_SEP, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::SERVER, Constants::USER_AGENT

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ PageLinks

Parses links from executed request



15
16
17
18
19
20
21
22
# File 'lib/bitbucket_rest_api/page_links.rb', line 15

def initialize(response)
  self.response_dup = response
  if response.body.is_a?(Hash) and !response.body[PARAM_PAGE].nil?
    self.first        = path_for_page(FIRST_PAGE_NUMBER)
    self.next         = response.body[META_NEXT] unless response.body
    self.prev         = response.body[META_PREV]
  end
end

Instance Attribute Details

#firstObject

Hold the extracted values for URI from the response body for the next and previous page.



11
12
13
# File 'lib/bitbucket_rest_api/page_links.rb', line 11

def first
  @first
end

#nextObject

Hold the extracted values for URI from the response body for the next and previous page.



11
12
13
# File 'lib/bitbucket_rest_api/page_links.rb', line 11

def next
  @next
end

#prevObject

Hold the extracted values for URI from the response body for the next and previous page.



11
12
13
# File 'lib/bitbucket_rest_api/page_links.rb', line 11

def prev
  @prev
end

#response_dupObject

Hold the extracted values for URI from the response body for the next and previous page.



11
12
13
# File 'lib/bitbucket_rest_api/page_links.rb', line 11

def response_dup
  @response_dup
end