hetzner 0.0.13 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8564112b50c1ebdc702892b47be85fcb7eb9b5c7cb58de764e9c727c7de0adc6
4
- data.tar.gz: 1ee7d2a3f5e0f359255b30dc1692fe41e7c58af1c66a178493d3d612f1cbd3f1
3
+ metadata.gz: 417250f33d174488ff2e82c8492b4fd7d78e671ce61864c9406b7999632242d0
4
+ data.tar.gz: 9f723d5e347e711ff3b636ecdfc2f1cd5dd06ce51d9b2398530391f956c4b749
5
5
  SHA512:
6
- metadata.gz: b4a62122c785ab66045a1417c26812ab5a6090f522d971522f909330d270cc163bd51f6569ee579048cc3911ba84e56a7a0f20f99066d63cd09a6e2932ab6109
7
- data.tar.gz: fa778bd705d95a67bfb532ceaf0cb0dfe2696ca1509dbcfd917466925a58325924af1196f9ba5adc7c82a7fda4e192fd471c1e0d88111414ad9e1283d4fd295f
6
+ metadata.gz: eaf61595620306167b90f031fc108da683f247a2f40d182c21550f03695f204d96d2f5478613cd1c1dcf33d48320a1669b58c00b24713fcade1bcd76c9df9a3f
7
+ data.tar.gz: d94896ec6903e5f3276920517578f672a79d8de22088f03ce775be229f248e64d78fc787d3181a5198522e21d21d84926255c96ee89c4a9339aa3199b8171100
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require "faraday"
3
3
  require "oj"
4
- Dir["commands/*.rb"].each {|file| require file }
4
+ Dir[File.join(__dir__, 'commands', '*.rb')].each { |f| require f }
5
5
 
6
6
  module Hetzner
7
7
  class Client
@@ -23,13 +23,13 @@ module Hetzner
23
23
  end
24
24
  end
25
25
 
26
- def get(endpoint, params = {})
27
- response = client.public_send(:get, endpoint, params)
26
+ def get(endpoint)
27
+ response = client.get(endpoint)
28
28
  Oj.load(response.body)
29
29
  end
30
30
 
31
- def post(endpoint, params = {})
32
- response = client.public_send(:post, endpoint, params)
31
+ def post(endpoint, body)
32
+ response = client.post(endpoint, body.to_json, "Content-Type" => "application/json")
33
33
  Oj.load(response.body)
34
34
  end
35
35
  end
@@ -23,5 +23,9 @@ module Hetzner
23
23
  def server_type(id)
24
24
  get("/v1/server_types/#{id}")
25
25
  end
26
+
27
+ def create_server(name, server_type, image)
28
+ post("/v1/servers", { name: name, server_type: server_type, image: image })
29
+ end
26
30
  end
27
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hetzner
4
- VERSION = "0.0.13"
4
+ VERSION = "0.0.22"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hetzner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abe Shalash
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-25 00:00:00.000000000 Z
11
+ date: 2021-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday