Class: Hetzner::Client
- Inherits:
-
Object
- Object
- Hetzner::Client
- Defined in:
- lib/hetzner/infra/client.rb
Constant Summary collapse
- BASE_URI =
'https://api.hetzner.cloud/v1'
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/hetzner/infra/client.rb', line 7 def token @token end |
Instance Method Details
#delete(path, id) ⇒ Object
21 22 23 24 25 |
# File 'lib/hetzner/infra/client.rb', line 21 def delete(path, id) make_request do HTTParty.delete("#{BASE_URI}#{path}/#{id}", headers: headers) end end |
#get(path) ⇒ Object
9 10 11 12 13 |
# File 'lib/hetzner/infra/client.rb', line 9 def get(path) make_request do JSON.parse HTTParty.get(BASE_URI + path, headers: headers).body end end |
#post(path, data) ⇒ Object
15 16 17 18 19 |
# File 'lib/hetzner/infra/client.rb', line 15 def post(path, data) make_request do HTTParty.post(BASE_URI + path, body: data.to_json, headers: headers) end end |