Module: BitBucket::Result
Constant Summary
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 Method Summary
collapse
Methods included from Pagination
#auto_paginate, #each_page, #first_page, #has_next_page?, #links, #next_page, #page, #prev_page
Instance Method Details
#body ⇒ Object
59
60
61
|
# File 'lib/bitbucket_rest_api/result.rb', line 59
def body
loaded? ? @env[:body] : nil
end
|
#cache_control ⇒ Object
22
23
24
|
# File 'lib/bitbucket_rest_api/result.rb', line 22
def cache_control
loaded? ? @env[:response_headers][CACHE_CONTROL] : nil
end
|
#content_length ⇒ Object
30
31
32
|
# File 'lib/bitbucket_rest_api/result.rb', line 30
def content_length
loaded? ? @env[:response_headers][CONTENT_LENGTH] : nil
end
|
#content_type ⇒ Object
26
27
28
|
# File 'lib/bitbucket_rest_api/result.rb', line 26
def content_type
loaded? ? @env[:response_headers][CONTENT_TYPE] : nil
end
|
#date ⇒ Object
38
39
40
|
# File 'lib/bitbucket_rest_api/result.rb', line 38
def date
loaded? ? @env[:response_headers][DATE] : nil
end
|
#etag ⇒ Object
34
35
36
|
# File 'lib/bitbucket_rest_api/result.rb', line 34
def etag
loaded? ? @env[:response_headers][ETAG] : nil
end
|
#loaded? ⇒ Boolean
63
64
65
|
# File 'lib/bitbucket_rest_api/result.rb', line 63
def loaded?
!!@env
end
|
#location ⇒ Object
42
43
44
|
# File 'lib/bitbucket_rest_api/result.rb', line 42
def location
loaded? ? @env[:response_headers][LOCATION] : nil
end
|
#paginated? ⇒ Boolean
TODO Add result counts method to check total items looking at result links
10
11
12
|
# File 'lib/bitbucket_rest_api/result.rb', line 10
def paginated?
loaded? ? !@env[:body][PARAM_PAGE].nil? : false
end
|
#ratelimit_limit ⇒ Object
14
15
16
|
# File 'lib/bitbucket_rest_api/result.rb', line 14
def ratelimit_limit
loaded? ? @env[:response_headers][RATELIMIT_LIMIT] : nil
end
|
#ratelimit_remaining ⇒ Object
18
19
20
|
# File 'lib/bitbucket_rest_api/result.rb', line 18
def ratelimit_remaining
loaded? ? @env[:response_headers][RATELIMIT_REMAINING] : nil
end
|
#server ⇒ Object
46
47
48
|
# File 'lib/bitbucket_rest_api/result.rb', line 46
def server
loaded? ? @env[:response_headers][SERVER] : nil
end
|
#status ⇒ Object
50
51
52
|
# File 'lib/bitbucket_rest_api/result.rb', line 50
def status
loaded? ? @env[:status] : nil
end
|
#success? ⇒ Boolean
54
55
56
|
# File 'lib/bitbucket_rest_api/result.rb', line 54
def success?
(200..299).include? status
end
|