hetzner 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1ea9424683ea563187f3a6cb31bda79108bedd3c50d8b9b3607d211d0d092d2c
4
+ data.tar.gz: 9e36c188c44e45a4575d085c2b60f789d751e041654b6da3f11237f8df8c423a
5
+ SHA512:
6
+ metadata.gz: bdc9125a49fa17478003b65c2d685dcfd23db029b3ce7eb34281d58a60c6c9567fb507810327539367b9bd3f29e8553bc8c3518b833889a3aa8323a7060199e0
7
+ data.tar.gz: 93cc687492cfc30cec47b757b2697d84980132fab18f302979e9329aea01845c2ba670b6f9dd85ba36a91a6419c07050ec388056cab6d3efb826835caf678c3b
data/.DS_Store ADDED
Binary file
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.0.1] - 2021-12-24
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in hetzner.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rubocop", "~> 1.21"
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Hetzner
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/hetzner`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'hetzner'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install hetzner
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hetzner.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "hetzner"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ require "faraday"
3
+
4
+ module Hetzner
5
+ class Client
6
+ API_ENDPOINT = 'https://api.hetzner.cloud/v1'.freeze
7
+
8
+ attr_reader :api_token
9
+
10
+ def initialize(api_token = nil)
11
+ @api_token = api_token
12
+ end
13
+
14
+ def list_server_types
15
+ request(
16
+ http_method: :get,
17
+ endpoint: "/server_types"
18
+ )
19
+ end
20
+
21
+ private
22
+
23
+ def client
24
+ @_client ||= Faraday.new(API_ENDPOINT) do |client|
25
+ client.request :url_encoded
26
+ client.adapter Faraday.default_adapter
27
+ client.headers['Authorization'] = "Bearer #{api_token}" if api_token.present?
28
+ end
29
+ end
30
+
31
+ def request(http_method:, endpoint:, params: {})
32
+ response = client.public_send(http_method, endpoint, params)
33
+ Oj.load(response.body)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hetzner
4
+ VERSION = "0.0.1"
5
+ end
data/lib/hetzner.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "hetzner/version"
4
+ require_relative "hetzner/client"
5
+
6
+ module Hetzner
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
data/sig/hetzner.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Hetzner
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hetzner
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Abe Shalash
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-12-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: oj
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email:
43
+ - shalashtein@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".DS_Store"
49
+ - CHANGELOG.md
50
+ - Gemfile
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - lib/hetzner.rb
56
+ - lib/hetzner/client.rb
57
+ - lib/hetzner/version.rb
58
+ - sig/hetzner.rbs
59
+ homepage: https://github.com/Serviox/hetzner.git
60
+ licenses: []
61
+ metadata:
62
+ homepage_uri: https://github.com/Serviox/hetzner.git
63
+ source_code_uri: https://github.com/Serviox/hetzner.git
64
+ changelog_uri: https://github.com/Serviox/hetzner/blob/main/CHANGELOG.md
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 2.6.0
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubygems_version: 3.2.33
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Hetzner API Wrapper
84
+ test_files: []