Class: Gaurun::Response
- Inherits:
-
Object
- Object
- Gaurun::Response
- Defined in:
- lib/gaurun-ruby/response.rb
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(res) ⇒ Response
constructor
A new instance of Response.
- #status_code ⇒ Object
- #status_message ⇒ Object
Constructor Details
#initialize(res) ⇒ Response
Returns a new instance of Response.
5 6 7 |
# File 'lib/gaurun-ruby/response.rb', line 5 def initialize(res) @res = res end |
Instance Method Details
#body ⇒ Object
17 18 19 20 |
# File 'lib/gaurun-ruby/response.rb', line 17 def body return nil unless @res.response_body.length > 1 JSON.parse(@res.response_body, { symbolize_names: true }) end |
#status_code ⇒ Object
9 10 11 |
# File 'lib/gaurun-ruby/response.rb', line 9 def status_code @res.response_code.to_i end |
#status_message ⇒ Object
13 14 15 |
# File 'lib/gaurun-ruby/response.rb', line 13 def @res.return_code end |