Class: VaultedBilling::HTTP::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/vaulted_billing/http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_response) ⇒ Response

Returns a new instance of Response.



29
30
31
32
33
34
35
36
37
38
# File 'lib/vaulted_billing/http.rb', line 29

def initialize(http_response)
  if http_response
    self.raw_response = http_response
    self.code = http_response.code
    self.message = http_response.message
    self.body = http_response.body
    self.success = ((http_response.code =~ /^2\d{2}/) == 0)
    self.connection_error = false
  end
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



23
24
25
# File 'lib/vaulted_billing/http.rb', line 23

def body
  @body
end

#codeObject Also known as: status_code

Returns the value of attribute code.



21
22
23
# File 'lib/vaulted_billing/http.rb', line 21

def code
  @code
end

#connection_errorObject Also known as: connection_error?

Returns the value of attribute connection_error.



26
27
28
# File 'lib/vaulted_billing/http.rb', line 26

def connection_error
  @connection_error
end

#messageObject

Returns the value of attribute message.



22
23
24
# File 'lib/vaulted_billing/http.rb', line 22

def message
  @message
end

#raw_responseObject

Returns the value of attribute raw_response.



25
26
27
# File 'lib/vaulted_billing/http.rb', line 25

def raw_response
  @raw_response
end

#successObject Also known as: success?

Returns the value of attribute success.



24
25
26
# File 'lib/vaulted_billing/http.rb', line 24

def success
  @success
end