Class: Headquarters::Request

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, params) ⇒ Request

Returns a new instance of Request.



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

def initialize(path, params)
  @path = path
  @params = params
end

Class Method Details

.perform(http_method, path, params = {}) ⇒ Object



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

def self.perform(http_method, path, params = {})
  new(path, params).public_send(http_method)
end

Instance Method Details

#getObject



17
18
19
20
21
# File 'lib/headquarters/request.rb', line 17

def get
  response = Request.get(path, params)
  log_request_info(:get, response)
  response.parsed_response
end

#postObject



23
24
25
26
27
# File 'lib/headquarters/request.rb', line 23

def post
  response = Request.post(path, params)
  log_request_info(:post, response)
  response.parsed_response
end