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



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

def delete(path)
  connection.delete do |r|
    r.options.timeout         = TIMEOUT
    r.headers['Content-Type'] = 'application/json'
    r.url                     complete_path(path)
  end
end

.get(path) ⇒ Object



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

def get(path)
  connection.get do |r|
    r.options.timeout         = TIMEOUT
    r.headers['Content-Type'] = 'application/json'
    r.url                     complete_path(path)
  end
end

.post(path, options) ⇒ Object



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

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



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

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