Class: Webex::Response
- Inherits:
-
Object
- Object
- Webex::Response
- Defined in:
- lib/webex/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#rate_limiter ⇒ Object
Returns the value of attribute rate_limiter.
-
#request_body ⇒ Object
readonly
Returns the value of attribute request_body.
-
#request_headers ⇒ Object
readonly
Returns the value of attribute request_headers.
-
#retry_count ⇒ Object
Returns the value of attribute retry_count.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#time_spent_in_ms ⇒ Object
Returns the value of attribute time_spent_in_ms.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(faraday_response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(faraday_response) ⇒ Response
Returns a new instance of Response.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/webex/response.rb', line 10 def initialize(faraday_response) @status = faraday_response.status @body = begin JSON.parse(faraday_response.body) rescue {} end @success = faraday_response.success? @headers = faraday_response.headers.to_h @request_headers = faraday_response.env[:request_headers].to_h @request_body = faraday_response.env[:request_body] @url = faraday_response.env[:url] @rate_limiter = RateLimiter.new(headers) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/webex/response.rb', line 5 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/webex/response.rb', line 5 def headers @headers end |
#rate_limiter ⇒ Object
Returns the value of attribute rate_limiter.
7 8 9 |
# File 'lib/webex/response.rb', line 7 def rate_limiter @rate_limiter end |
#request_body ⇒ Object (readonly)
Returns the value of attribute request_body.
6 7 8 |
# File 'lib/webex/response.rb', line 6 def request_body @request_body end |
#request_headers ⇒ Object (readonly)
Returns the value of attribute request_headers.
6 7 8 |
# File 'lib/webex/response.rb', line 6 def request_headers @request_headers end |
#retry_count ⇒ Object
Returns the value of attribute retry_count.
7 8 9 |
# File 'lib/webex/response.rb', line 7 def retry_count @retry_count end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/webex/response.rb', line 5 def status @status end |
#time_spent_in_ms ⇒ Object
Returns the value of attribute time_spent_in_ms.
7 8 9 |
# File 'lib/webex/response.rb', line 7 def time_spent_in_ms @time_spent_in_ms end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/webex/response.rb', line 6 def url @url end |
Instance Method Details
#success? ⇒ Boolean
25 26 27 |
# File 'lib/webex/response.rb', line 25 def success? @success end |