Class: Gaurun::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/gaurun-ruby/response.rb

Instance Method Summary collapse

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

#bodyObject



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_codeObject



9
10
11
# File 'lib/gaurun-ruby/response.rb', line 9

def status_code
  @res.response_code.to_i
end

#status_messageObject



13
14
15
# File 'lib/gaurun-ruby/response.rb', line 13

def status_message
  @res.return_code
end