Class: Alula::AlulaResponse
- Inherits:
-
Object
- Object
- Alula::AlulaResponse
- Defined in:
- lib/alula/alula_response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#http_body ⇒ Object
Returns the value of attribute http_body.
-
#http_headers ⇒ Object
Returns the value of attribute http_headers.
-
#http_status ⇒ Object
Returns the value of attribute http_status.
-
#rate_limit ⇒ Object
Returns the value of attribute rate_limit.
-
#raw ⇒ Object
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/alula/alula_response.rb', line 3 def data @data end |
#http_body ⇒ Object
Returns the value of attribute http_body.
3 4 5 |
# File 'lib/alula/alula_response.rb', line 3 def http_body @http_body end |
#http_headers ⇒ Object
Returns the value of attribute http_headers.
3 4 5 |
# File 'lib/alula/alula_response.rb', line 3 def http_headers @http_headers end |
#http_status ⇒ Object
Returns the value of attribute http_status.
3 4 5 |
# File 'lib/alula/alula_response.rb', line 3 def http_status @http_status end |
#rate_limit ⇒ Object
Returns the value of attribute rate_limit.
3 4 5 |
# File 'lib/alula/alula_response.rb', line 3 def rate_limit @rate_limit end |
#raw ⇒ Object
Returns the value of attribute raw.
3 4 5 |
# File 'lib/alula/alula_response.rb', line 3 def raw @raw end |
Class Method Details
.from_httparty_response(response) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/alula/alula_response.rb', line 9 def self.from_httparty_response(response) resp = AlulaResponse.new resp.data = response.parsed_response resp.http_body = response.body resp.http_headers = response.headers resp.rate_limit = Alula::RateLimit.new(response.headers) resp.http_status = response.code resp.raw = response resp end |
Instance Method Details
#ok? ⇒ Boolean
5 6 7 |
# File 'lib/alula/alula_response.rb', line 5 def ok? (200..299).cover?(self.http_status) end |