Class: Netdata::Client::Helper::Network
- Inherits:
-
Object
- Object
- Netdata::Client::Helper::Network
- Defined in:
- lib/netdata/client/helper/network.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Access the configuration object instance externally.
Instance Method Summary collapse
-
#get(endpoint, url, args, version = "v1") ⇒ Object
- Perform a GET request to a specified URL Params:
url - The URL you want to hit
key -
The authentication key to pass via headers to the URL.
- The URL you want to hit
- Perform a GET request to a specified URL Params:
-
#post(endpoint, url, args, version = "v1") ⇒ Object
- Perform a POST request to a specified URL Params:
url - The URL you want to hit
key -
The authentication key to pass via headers to the URL.
- The URL you want to hit
- Perform a POST request to a specified URL Params:
Instance Attribute Details
#config ⇒ Object
Access the configuration object instance externally
6 7 8 |
# File 'lib/netdata/client/helper/network.rb', line 6 def config @config end |
Instance Method Details
#get(endpoint, url, args, version = "v1") ⇒ Object
Perform a GET request to a specified URL Params:
url-
The URL you want to hit
key-
The authentication key to pass via headers to the URL
12 13 14 15 16 17 |
# File 'lib/netdata/client/helper/network.rb', line 12 def get(endpoint, url, args, version = "v1") qs = build_qs(args) req_url = "#{url}/api/#{version}/#{endpoint}?#{qs}" request(req_url, :GET) end |
#post(endpoint, url, args, version = "v1") ⇒ Object
Perform a POST request to a specified URL Params:
url-
The URL you want to hit
key-
The authentication key to pass via headers to the URL
23 24 25 26 27 28 |
# File 'lib/netdata/client/helper/network.rb', line 23 def post(endpoint, url, args, version = "v1") qs = build_qs(args) req_url = "#{url}/api/#{version}/#{endpoint}?#{qs}" request(req_url, :POST) end |