Class: WebfleetConnect::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/webfleet_connect/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, url, is_json) ⇒ Response

Returns a new instance of Response.



8
9
10
11
12
# File 'lib/webfleet_connect/response.rb', line 8

def initialize(response, url, is_json)
  @response = response
  @url = url
  @parser = build_parser(is_json)
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/webfleet_connect/response.rb', line 6

def url
  @url
end

Instance Method Details

#status_codeObject



14
15
16
# File 'lib/webfleet_connect/response.rb', line 14

def status_code
  @response.code
end

#to_hashObject



18
19
20
# File 'lib/webfleet_connect/response.rb', line 18

def to_hash
  @parser.to_hash(@response.body)
end

#to_sObject



22
23
24
# File 'lib/webfleet_connect/response.rb', line 22

def to_s
  @response.body
end