Class: Nimbu::Response::Header
- Inherits:
-
Struct
- Object
- Struct
- Nimbu::Response::Header
show all
- Includes:
- Utils::Constants
- Defined in:
- lib/nimbu-api/response/header.rb
Overview
Represents http response header
Constant Summary
collapse
- SUCCESSFUL_STATUSES =
200..299
Utils::Constants::ACCEPT, Utils::Constants::ACCEPTED_OAUTH_SCOPES, Utils::Constants::ACCEPT_CHARSET, Utils::Constants::CACHE_CONTROL, Utils::Constants::CONTENT_LENGTH, Utils::Constants::CONTENT_TYPE, Utils::Constants::DATE, Utils::Constants::ETAG, Utils::Constants::HEADER_LAST, Utils::Constants::HEADER_LINK, Utils::Constants::HEADER_NEXT, Utils::Constants::LOCATION, Utils::Constants::META_FIRST, Utils::Constants::META_LAST, Utils::Constants::META_NEXT, Utils::Constants::META_PREV, Utils::Constants::META_REL, Utils::Constants::NIMBU_SITE, Utils::Constants::OAUTH_SCOPES, Utils::Constants::PARAM_PAGE, Utils::Constants::PARAM_PER_PAGE, Utils::Constants::PARAM_START_PAGE, Utils::Constants::RATELIMIT_LIMIT, Utils::Constants::RATELIMIT_REMAINING, Utils::Constants::SERVER, Utils::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/nimbu-api/response/header.rb', line 7
def env
@env
end
|
Instance Method Details
#accepted_oauth_scopes ⇒ Object
20
21
22
|
# File 'lib/nimbu-api/response/header.rb', line 20
def accepted_oauth_scopes
loaded? ? env[:response_headers][ACCEPTED_OAUTH_SCOPES] : nil
end
|
#body ⇒ Object
70
71
72
|
# File 'lib/nimbu-api/response/header.rb', line 70
def body
loaded? ? env[:body] : nil
end
|
#cache_control ⇒ Object
33
34
35
|
# File 'lib/nimbu-api/response/header.rb', line 33
def cache_control
loaded? ? env[:response_headers][CACHE_CONTROL] : nil
end
|
#content_length ⇒ Object
41
42
43
|
# File 'lib/nimbu-api/response/header.rb', line 41
def content_length
loaded? ? env[:response_headers][CONTENT_LENGTH] : nil
end
|
#content_type ⇒ Object
37
38
39
|
# File 'lib/nimbu-api/response/header.rb', line 37
def content_type
loaded? ? env[:response_headers][CONTENT_TYPE] : nil
end
|
#date ⇒ Object
49
50
51
|
# File 'lib/nimbu-api/response/header.rb', line 49
def date
loaded? ? env[:response_headers][DATE] : nil
end
|
#etag ⇒ Object
45
46
47
|
# File 'lib/nimbu-api/response/header.rb', line 45
def etag
loaded? ? env[:response_headers][ETAG] : nil
end
|
#loaded? ⇒ Boolean
12
13
14
|
# File 'lib/nimbu-api/response/header.rb', line 12
def loaded?
!!env
end
|
#location ⇒ Object
53
54
55
|
# File 'lib/nimbu-api/response/header.rb', line 53
def location
loaded? ? env[:response_headers][LOCATION] : nil
end
|
#oauth_scopes ⇒ Object
16
17
18
|
# File 'lib/nimbu-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/nimbu-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/nimbu-api/response/header.rb', line 29
def ratelimit_remaining
loaded? ? env[:response_headers][RATELIMIT_REMAINING] : nil
end
|
#server ⇒ Object
57
58
59
|
# File 'lib/nimbu-api/response/header.rb', line 57
def server
loaded? ? env[:response_headers][SERVER] : nil
end
|
#status ⇒ Object
61
62
63
|
# File 'lib/nimbu-api/response/header.rb', line 61
def status
loaded? ? env[:status] : nil
end
|
#success? ⇒ Boolean
65
66
67
|
# File 'lib/nimbu-api/response/header.rb', line 65
def success?
SUCCESSFUL_STATUSES.include? status
end
|