Class: Cameraplus::API::Request

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/cameraplus/api/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Request

Returns a new instance of Request.



12
13
14
15
# File 'lib/cameraplus/api/request.rb', line 12

def initialize(url, options = {})
  @url      = url
  @options  = options
end

Class Method Details

.call(url, options = {}) ⇒ Object



8
9
10
# File 'lib/cameraplus/api/request.rb', line 8

def self.call(url, options = {})
  new(url, options).parsed_response
end

Instance Method Details

#parsed_responseObject



17
18
19
20
21
22
23
# File 'lib/cameraplus/api/request.rb', line 17

def parsed_response
  if code == 200
    @response.parsed_response
  else
    raise InvalidResponseError, message
  end
end