Module: Wazuh::Sawyer::Request

Included in:
Client
Defined in:
lib/wazuh/sawyer/request.rb

Instance Method Summary collapse

Instance Method Details

#delete(path, options = {}) ⇒ Object



17
18
19
# File 'lib/wazuh/sawyer/request.rb', line 17

def delete(path, options = {})
  request(:delete, path, options)
end

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



5
6
7
# File 'lib/wazuh/sawyer/request.rb', line 5

def get(path, options = {})
  request(:get, path, options)
end

#offset_request(method, path, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/wazuh/sawyer/request.rb', line 21

def offset_request(method, path, options = {})
  items = []
  data = send(method, path, options)
  total_items = api_version == 3 ? data.totalItems : data.total_affected_items
  0.step(total_items, 500) { |offset|
    options[:offset] = offset
    d = send(method, path, options)
    _items = api_version == 3 ? data.items : d.affected_items
    items.concat(_items)
  }

  items
end

#post(path, options = {}) ⇒ Object



9
10
11
# File 'lib/wazuh/sawyer/request.rb', line 9

def post(path, options = {})
  request(:post, path, options)
end

#put(path, options = {}) ⇒ Object



13
14
15
# File 'lib/wazuh/sawyer/request.rb', line 13

def put(path, options = {})
  request(:put, path, options)
end