Class: Rdwu::Api

Inherits:
Object
  • Object
show all
Includes:
JSON, Read, Settings, Write
Defined in:
lib/rdwu.rb

Instance Method Summary collapse

Methods included from Write

#create, #delete, #update

Methods included from Read

#find, #list, #qrcode, #qrcode_by_url, #qrcode_by_uuid, #qrcode_to_png, #retrieve

Methods included from Settings

#enabled?, #host, #timeout_seconds, #token

Instance Method Details

#delete_request(path) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/rdwu.rb', line 45

def delete_request(path)
  return nil unless enabled?

  path = [host, path].join

  HTTP
    .timeout(timeout_seconds)
    .headers(token:)
    .delete(path)
end

#get_request(path) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/rdwu.rb', line 23

def get_request(path)
  return nil unless enabled?

  path = [host, path].join

  HTTP
    .timeout(timeout_seconds)
    .headers(token:)
    .get(path)
end

#post_request(path, payload) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/rdwu.rb', line 34

def post_request(path, payload)
  return nil unless enabled?

  path = [host, path].join

  HTTP
    .timeout(timeout_seconds)
    .headers(token:)
    .post(path, json: payload)
end