Class: Wes::Data::API::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/wes/data/api/request.rb

Class Method Summary collapse

Class Method Details

.delete(path) ⇒ Object



35
36
37
38
39
40
# File 'lib/wes/data/api/request.rb', line 35

def delete(path)
  connection.delete do |r|
    r.options.timeout = TIMEOUT
    r.url             complete_path(path)
  end
end

.get(path) ⇒ Object



10
11
12
13
14
15
# File 'lib/wes/data/api/request.rb', line 10

def get(path)
  connection.get do |r|
    r.options.timeout = TIMEOUT
    r.url             complete_path(path)
  end
end

.post(path, options) ⇒ Object



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

def post(path, options)
  connection.post do |r|
    r.body                    = options.to_json
    r.headers["Content-Type"] = "application/json"
    r.options.timeout         = TIMEOUT
    r.url                     complete_path(path)
  end
end

.put(path, options) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/wes/data/api/request.rb', line 26

def put(path, options)
  connection.put do |r|
    r.body                    = options.to_json
    r.headers["Content-Type"] = "application/json"
    r.options.timeout         = TIMEOUT
    r.url                     complete_path(path)
  end
end