Class: Simple::OAuth2::Responses
- Inherits:
-
Object
- Object
- Simple::OAuth2::Responses
- Defined in:
- lib/simple_oauth2/responses.rb
Overview
Processes Rack Responses and contains helper methods
Instance Method Summary collapse
-
#body ⇒ Object
Response JSON-parsed body.
-
#headers ⇒ Object
Response headers.
-
#initialize(response) ⇒ Responses
constructor
Simple::OAuth2 response class.
-
#status ⇒ Object
Response status.
Constructor Details
#initialize(response) ⇒ Responses
Simple::OAuth2 response class
39 40 41 |
# File 'lib/simple_oauth2/responses.rb', line 39 def initialize(response) @response = response end |
Instance Method Details
#body ⇒ Object
Response JSON-parsed body
54 55 56 57 58 59 |
# File 'lib/simple_oauth2/responses.rb', line 54 def body response_body = @response[2].body.first return {} if response_body.nil? || response_body.empty? JSON.parse(response_body) end |
#headers ⇒ Object
Response headers
49 50 51 |
# File 'lib/simple_oauth2/responses.rb', line 49 def headers @response[1] end |
#status ⇒ Object
Response status
44 45 46 |
# File 'lib/simple_oauth2/responses.rb', line 44 def status @response[0] end |