Class: Request

Inherits:
Object
  • Object
show all
Defined in:
lib/smokey/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ Request

Returns a new instance of Request.



4
5
6
7
# File 'lib/smokey/request.rb', line 4

def initialize(username, password)
  @auth   = { username: username, password: password }
  @logger = Logger.new
end

Instance Method Details

#get(url, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/smokey/request.rb', line 9

def get(url, options={})
  begin
    options.merge!({basic_auth: @auth})
    response = HTTParty.get(url, options)
    @logger.log("info", "#{response.code} - #{response.message}")
  rescue => e
    e.response
  end
end

#post(url, parameters) ⇒ Object



19
20
21
# File 'lib/smokey/request.rb', line 19

def post(url, parameters)
 # RestClient.post(url, parameters)
end