Class: Bluevia::Response
- Inherits:
-
Object
- Object
- Bluevia::Response
- Defined in:
- lib/bluevia/response.rb
Overview
Inner class that wraps the response
Instance Attribute Summary collapse
-
#body ⇒ Object
HTTP response body.
-
#code ⇒ Object
HTTP response code.
-
#headers ⇒ Object
HTTP headers (required when creating resources).
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
- #[](value) ⇒ Object
- #get_value(var) ⇒ Object
-
#initialize ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
21 22 23 |
# File 'lib/bluevia/response.rb', line 21 def initialize @body = "" end |
Instance Attribute Details
#body ⇒ Object
HTTP response body
15 16 17 |
# File 'lib/bluevia/response.rb', line 15 def body @body end |
#code ⇒ Object
HTTP response code
13 14 15 |
# File 'lib/bluevia/response.rb', line 13 def code @code end |
#headers ⇒ Object
HTTP headers (required when creating resources)
17 18 19 |
# File 'lib/bluevia/response.rb', line 17 def headers @headers end |
#message ⇒ Object
Returns the value of attribute message.
19 20 21 |
# File 'lib/bluevia/response.rb', line 19 def @message end |
Instance Method Details
#[](value) ⇒ Object
43 44 45 |
# File 'lib/bluevia/response.rb', line 43 def [](value) return self.instance_variable_get("@#{value}") end |
#get_value(var) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/bluevia/response.rb', line 33 def get_value(var) if var.instance_of?(String) var elsif var.instance_of?(Hash) var.to_a.join(" - ") else var end end |
#to_s ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/bluevia/response.rb', line 25 def to_s value = String.new self.instance_variables.each{ |var| value << "#{var} : #{get_value(self.instance_variable_get(var))} \n" } value end |