Class: Alula::AlulaResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/alula/alula_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/alula/alula_response.rb', line 3

def data
  @data
end

#http_bodyObject

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_headersObject

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_statusObject

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_limitObject

Returns the value of attribute rate_limit.



3
4
5
# File 'lib/alula/alula_response.rb', line 3

def rate_limit
  @rate_limit
end

#rawObject

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

Returns:

  • (Boolean)


5
6
7
# File 'lib/alula/alula_response.rb', line 5

def ok?
  (200..299).cover?(self.http_status)
end