Class: LunaApi::Request

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

Class Method Summary collapse

Class Method Details

.get(url, *args) ⇒ Object



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

def get(url, *args)
  request("get", url, *args)
end

.post(url, *args) ⇒ Object



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

def post(url, *args)
  request("post", url, *args)
end

.put(url, *args) ⇒ Object



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

def put(url, *args)
  request("put", url, *args)
end

.request(method, url, args = {}) ⇒ Object



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

def request(method, url, args={})
  Typhoeus::Request.send(method,
    url,
    args.merge({username: ENV["LUNA_API_USERNAME"], password: ENV["LUNA_API_PASSWORD"]})
  )
end