Class: Github::Response::Header
- Inherits:
-
Struct
- Object
- Struct
- Github::Response::Header
show all
- Includes:
- Constants
- Defined in:
- lib/github_api/response/header.rb
Overview
Represents http response header
Constant Summary
collapse
- SUCCESSFUL_STATUSES =
200..299
Constants included
from Constants
Constants::ACCEPT, Constants::ACCEPTED_OAUTH_SCOPES, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::OAUTH_SCOPES, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::RATELIMIT_RESET, Constants::SERVER, Constants::USER_AGENT
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env
7
8
9
|
# File 'lib/github_api/response/header.rb', line 7
def env
@env
end
|
Instance Method Details
#accepted_oauth_scopes ⇒ Object
20
21
22
|
# File 'lib/github_api/response/header.rb', line 20
def accepted_oauth_scopes
loaded? ? env[:response_headers][ACCEPTED_OAUTH_SCOPES] : nil
end
|
#body ⇒ Object
76
77
78
|
# File 'lib/github_api/response/header.rb', line 76
def body
loaded? ? env[:body] : nil
end
|
#cache_control ⇒ Object
39
40
41
|
# File 'lib/github_api/response/header.rb', line 39
def cache_control
loaded? ? env[:response_headers][CACHE_CONTROL] : nil
end
|
#content_length ⇒ Object
47
48
49
|
# File 'lib/github_api/response/header.rb', line 47
def content_length
loaded? ? env[:response_headers][CONTENT_LENGTH] : nil
end
|
#content_type ⇒ Object
43
44
45
|
# File 'lib/github_api/response/header.rb', line 43
def content_type
loaded? ? env[:response_headers][CONTENT_TYPE] : nil
end
|
#date ⇒ Object
55
56
57
|
# File 'lib/github_api/response/header.rb', line 55
def date
loaded? ? env[:response_headers][DATE] : nil
end
|
#etag ⇒ Object
51
52
53
|
# File 'lib/github_api/response/header.rb', line 51
def etag
loaded? ? env[:response_headers][ETAG] : nil
end
|
#loaded? ⇒ Boolean
12
13
14
|
# File 'lib/github_api/response/header.rb', line 12
def loaded?
!!env
end
|
#location ⇒ Object
59
60
61
|
# File 'lib/github_api/response/header.rb', line 59
def location
loaded? ? env[:response_headers][LOCATION] : nil
end
|
#oauth_scopes ⇒ Object
16
17
18
|
# File 'lib/github_api/response/header.rb', line 16
def oauth_scopes
loaded? ? env[:response_headers][OAUTH_SCOPES] : nil
end
|
#ratelimit_limit ⇒ Object
Requests are limited to API v3 to 5000 per hour.
25
26
27
|
# File 'lib/github_api/response/header.rb', line 25
def ratelimit_limit
loaded? ? env[:response_headers][RATELIMIT_LIMIT] : nil
end
|
#ratelimit_remaining ⇒ Object
29
30
31
|
# File 'lib/github_api/response/header.rb', line 29
def ratelimit_remaining
loaded? ? env[:response_headers][RATELIMIT_REMAINING] : nil
end
|
#ratelimit_reset ⇒ Object
A unix timestamp describing when the ratelimit will be reset
35
36
37
|
# File 'lib/github_api/response/header.rb', line 35
def ratelimit_reset
loaded? ? env[:response_headers][RATELIMIT_RESET] : nil
end
|
#server ⇒ Object
63
64
65
|
# File 'lib/github_api/response/header.rb', line 63
def server
loaded? ? env[:response_headers][SERVER] : nil
end
|
#status ⇒ Object
67
68
69
|
# File 'lib/github_api/response/header.rb', line 67
def status
loaded? ? env[:status] : nil
end
|
#success? ⇒ Boolean
71
72
73
|
# File 'lib/github_api/response/header.rb', line 71
def success?
SUCCESSFUL_STATUSES.include? status
end
|