hcloud 0.1.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +32 -0
  3. data/.gitignore +0 -1
  4. data/.rubocop.yml +28 -10
  5. data/.rubocop_todo.yml +18 -121
  6. data/CHANGELOG.md +60 -2
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +149 -0
  9. data/README.md +34 -1
  10. data/Rakefile +2 -0
  11. data/bin/console +1 -0
  12. data/hcloud.gemspec +14 -9
  13. data/lib/hcloud/abstract_resource.rb +165 -60
  14. data/lib/hcloud/action.rb +8 -10
  15. data/lib/hcloud/action_resource.rb +3 -29
  16. data/lib/hcloud/client.rb +70 -29
  17. data/lib/hcloud/datacenter.rb +7 -7
  18. data/lib/hcloud/datacenter_resource.rb +6 -31
  19. data/lib/hcloud/entry_loader.rb +186 -20
  20. data/lib/hcloud/errors.rb +2 -0
  21. data/lib/hcloud/floating_ip.rb +18 -29
  22. data/lib/hcloud/floating_ip_resource.rb +15 -30
  23. data/lib/hcloud/image.rb +12 -32
  24. data/lib/hcloud/image_resource.rb +7 -38
  25. data/lib/hcloud/iso.rb +4 -1
  26. data/lib/hcloud/iso_resource.rb +7 -28
  27. data/lib/hcloud/location.rb +3 -9
  28. data/lib/hcloud/location_resource.rb +6 -27
  29. data/lib/hcloud/network.rb +33 -0
  30. data/lib/hcloud/network_resource.rb +25 -0
  31. data/lib/hcloud/pagination.rb +2 -9
  32. data/lib/hcloud/server.rb +37 -70
  33. data/lib/hcloud/server_resource.rb +17 -38
  34. data/lib/hcloud/server_type.rb +3 -10
  35. data/lib/hcloud/server_type_resource.rb +6 -28
  36. data/lib/hcloud/ssh_key.rb +6 -17
  37. data/lib/hcloud/ssh_key_resource.rb +13 -32
  38. data/lib/hcloud/typhoeus_ext.rb +110 -0
  39. data/lib/hcloud/version.rb +3 -1
  40. data/lib/hcloud/volume.rb +32 -0
  41. data/lib/hcloud/volume_resource.rb +29 -0
  42. data/lib/hcloud.rb +31 -5
  43. metadata +56 -22
  44. data/.travis.yml +0 -9
  45. data/lib/hcloud/multi_reply.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9f78617929469ecee9ebece771e9e5dc5752ba60
4
- data.tar.gz: f615021080bdae845cb44e238c612510a77c9df7
2
+ SHA256:
3
+ metadata.gz: a461edd72b44398c79ea0fb49a47457864551df5157572f9ce7e41fb8761b2c1
4
+ data.tar.gz: 8dcfe208c66dd462d444da2cdcc6e5ef65fa5595cea900c7406fdff0e5da8f7b
5
5
  SHA512:
6
- metadata.gz: a4994677850cd19bffcf5934e09b4a29a6be7a52baa5cbf92a8fb139c82ee538a59aa3e4f81b4fc4f4556af67bf1500c137e270ac28d16038fb1df6f48e5c60b
7
- data.tar.gz: b6be721c3b66b15a818efdceb5ae630cb684f9f89685ae94ea2f80f5ec20b9ed9b20e6a80f435eb1d84d5ed5846c903c426e46d4b724d765266a27486e2b1f6d
6
+ metadata.gz: eabc376f9c8d3fe45a8b09aa30195a8d877cdf7bfa18c2a9dab93d19be45e418a745a270aba90213ccf9adf7eee772a6880e9a8e6cacf20bbe26fc5410985438
7
+ data.tar.gz: 5e4bb090f48e683bbf0895d091ed8b6e74bb53f8d1f965638a5c8749241d1e562b5e9387dfe4306570666dd9b88c10fae00446a52723ff62b663caf6646707b8
@@ -0,0 +1,32 @@
1
+ name: hcloud-ruby ci
2
+ on: [push]
3
+ jobs:
4
+ lint:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v2
8
+ - name: Setup Ruby
9
+ uses: ruby/setup-ruby@v1
10
+ with:
11
+ ruby-version: 2.7
12
+ bundler-cache: true
13
+ - name: Run rubocop
14
+ run: bundle exec rubocop --parallel
15
+
16
+ test:
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby-version: [ '2.7', '3.0', '3.1' ]
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ - name: Setup Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby-version }}
28
+ bundler-cache: true
29
+ - name: Run double tests
30
+ run: bundle exec rspec -t doubles --order rand
31
+ - name: Run legacy tests
32
+ run: LEGACY_TESTS=y bundle exec rspec -t ~doubles
data/.gitignore CHANGED
@@ -2,7 +2,6 @@
2
2
  /vendor
3
3
  config.ru
4
4
  /.yardoc
5
- /Gemfile.lock
6
5
  /_yardoc/
7
6
  /coverage/
8
7
  /doc/
data/.rubocop.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ AllCops:
4
+ TargetRubyVersion: 2.7
5
+
3
6
  Style/GlobalVars:
4
7
  Exclude:
5
8
  - 'spec/**/*.rb'
@@ -10,15 +13,30 @@ Style/Documentation:
10
13
  Naming/ConstantName:
11
14
  Enabled: false
12
15
 
13
- Lint/HandleExceptions:
16
+ Lint/SuppressedException:
17
+ Enabled: false
18
+
19
+ Lint/AssignmentInCondition:
20
+ Enabled: false
21
+
22
+ Metrics/BlockLength:
23
+ Exclude:
24
+ - 'spec/**/*.rb'
25
+
26
+ Metrics/ParameterLists:
27
+ CountKeywordArgs: false
28
+
29
+ Metrics/MethodLength:
30
+ Max: 20
14
31
  Exclude:
15
- - 'lib/hcloud/action_resource.rb'
16
- - 'lib/hcloud/datacenter_resource.rb'
17
- - 'lib/hcloud/floating_ip_resource.rb'
18
- - 'lib/hcloud/image_resource.rb'
19
- - 'lib/hcloud/iso_resource.rb'
20
- - 'lib/hcloud/location_resource.rb'
21
- - 'lib/hcloud/server_resource.rb'
22
- - 'lib/hcloud/server_type_resource.rb'
23
- - 'lib/hcloud/ssh_key_resource.rb'
32
+ - 'spec/doubles/*.rb'
24
33
 
34
+ Metrics/ClassLength:
35
+ Max: 200
36
+ Exclude:
37
+ - 'spec/**/*.rb'
38
+
39
+ Metrics/LineLength:
40
+ Max: 100
41
+ Exclude:
42
+ - 'spec/**/*.rb'
data/.rubocop_todo.yml CHANGED
@@ -1,148 +1,45 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-02-27 01:17:09 +0100 using RuboCop version 0.52.1.
3
+ # on 2019-10-12 23:08:05 +0200 using RuboCop version 0.75.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 5
10
- # Cop supports --auto-correct.
11
- Layout/BlockEndNewline:
12
- Exclude:
13
- - 'spec/fake_service/server.rb'
14
-
15
- # Offense count: 1
16
- # Cop supports --auto-correct.
17
- # Configuration parameters: EnforcedStyle.
18
- # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
19
- Layout/EmptyLinesAroundModuleBody:
20
- Exclude:
21
- - 'spec/fake_service/server.rb'
22
-
23
9
  # Offense count: 3
24
- # Cop supports --auto-correct.
25
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
26
- # SupportedStyles: space, no_space, compact
27
- # SupportedStylesForEmptyBrackets: space, no_space
28
- Layout/SpaceInsideArrayLiteralBrackets:
29
- Exclude:
30
- - 'spec/fake_service/action.rb'
31
- - 'spec/fake_service/server.rb'
32
- - 'spec/fake_service/ssh_key.rb'
33
-
34
- # Offense count: 3
35
- # Configuration parameters: AllowSafeAssignment.
36
- Lint/AssignmentInCondition:
37
- Exclude:
38
- - 'lib/hcloud/client.rb'
39
- - 'spec/fake_service/server.rb'
40
-
41
- # Offense count: 12
42
10
  Lint/ShadowingOuterLocalVariable:
43
11
  Exclude:
44
- - 'lib/hcloud/action_resource.rb'
45
- - 'lib/hcloud/floating_ip_resource.rb'
46
- - 'lib/hcloud/image_resource.rb'
47
- - 'lib/hcloud/iso_resource.rb'
48
- - 'lib/hcloud/location_resource.rb'
49
- - 'lib/hcloud/server_resource.rb'
50
- - 'lib/hcloud/ssh_key_resource.rb'
51
12
  - 'spec/fake_service/datacenter.rb'
52
13
  - 'spec/fake_service/location.rb'
53
14
  - 'spec/fake_service/server_type.rb'
54
15
 
55
- # Offense count: 24
56
- # Cop supports --auto-correct.
57
- # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
58
- Lint/UnusedMethodArgument:
59
- Exclude:
60
- - 'lib/hcloud/floating_ip_resource.rb'
61
- - 'lib/hcloud/image.rb'
62
- - 'lib/hcloud/image_resource.rb'
63
- - 'lib/hcloud/server.rb'
64
- - 'lib/hcloud/server_resource.rb'
65
-
66
- # Offense count: 3
67
- Lint/UselessAssignment:
16
+ # Offense count: 1
17
+ # Configuration parameters: AllowKeywordBlockArguments.
18
+ Lint/UnderscorePrefixedVariableName:
68
19
  Exclude:
69
- - 'lib/hcloud/abstract_resource.rb'
70
- - 'spec/fake_service/base.rb'
71
- - 'spec/hcloud/server_spec.rb'
20
+ - 'lib/hcloud/typhoeus_ext.rb'
72
21
 
73
- # Offense count: 12
22
+ # Offense count: 7
74
23
  Metrics/AbcSize:
75
- Max: 35
76
-
77
- # Offense count: 20
78
- # Configuration parameters: CountComments, ExcludedMethods.
79
- Metrics/BlockLength:
80
- Max: 273
81
-
82
- # Offense count: 2
83
- # Configuration parameters: CountComments.
84
- Metrics/ClassLength:
85
- Max: 224
24
+ Max: 31
86
25
 
87
- # Offense count: 3
26
+ # Offense count: 4
88
27
  Metrics/CyclomaticComplexity:
89
- Max: 15
90
-
91
- # Offense count: 5
92
- # Configuration parameters: CountComments.
93
- Metrics/MethodLength:
94
- Max: 48
28
+ Max: 9
95
29
 
96
30
  # Offense count: 1
97
- # Configuration parameters: CountKeywordArgs.
98
- Metrics/ParameterLists:
99
- Max: 8
31
+ # Configuration parameters: CountComments, ExcludedMethods.
32
+ Metrics/MethodLength:
33
+ Max: 35
100
34
 
101
35
  # Offense count: 1
102
36
  Metrics/PerceivedComplexity:
103
- Max: 8
104
-
105
- # Offense count: 1
106
- # Cop supports --auto-correct.
107
- # Configuration parameters: AutoCorrect.
108
- Performance/HashEachMethods:
109
- Exclude:
110
- - 'lib/hcloud/entry_loader.rb'
111
-
112
- # Offense count: 1
113
- # Cop supports --auto-correct.
114
- # Configuration parameters: AutoCorrect.
115
- Performance/TimesMap:
116
- Exclude:
117
- - 'lib/hcloud/abstract_resource.rb'
118
-
119
- # Offense count: 7
120
- Security/Eval:
121
- Exclude:
122
- - 'lib/hcloud/floating_ip_resource.rb'
123
- - 'lib/hcloud/image.rb'
124
- - 'lib/hcloud/image_resource.rb'
125
- - 'lib/hcloud/server.rb'
126
- - 'lib/hcloud/server_resource.rb'
127
-
128
- # Offense count: 2
129
- # Configuration parameters: .
130
- # SupportedStyles: annotated, template, unannotated
131
- Style/FormatStringToken:
132
- EnforcedStyle: unannotated
37
+ Max: 9
133
38
 
134
- # Offense count: 6
135
- # Cop supports --auto-correct.
136
- Style/IfUnlessModifier:
39
+ # Offense count: 3
40
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
41
+ # AllowedNames: io, id, to, by, on, in, at, ip, db
42
+ Naming/MethodParameterName:
137
43
  Exclude:
138
44
  - 'lib/hcloud/abstract_resource.rb'
139
- - 'lib/hcloud/entry_loader.rb'
140
- - 'spec/fake_service/floating_ip.rb'
141
- - 'spec/fake_service/server.rb'
142
- - 'spec/fake_service/ssh_key.rb'
143
-
144
- # Offense count: 80
145
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
146
- # URISchemes: http, https
147
- Metrics/LineLength:
148
- Max: 108
45
+ - 'spec/fake_service/action.rb'
data/CHANGELOG.md CHANGED
@@ -1,6 +1,56 @@
1
- # Change Log
1
+ # Changelog
2
+
3
+ ## [v1.0.3](https://github.com/tonobo/hcloud-ruby/tree/v1.0.3) (2022-02-17)
4
+
5
+ [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.0.2...v1.0.3)
6
+
7
+ **Closed issues:**
8
+
9
+ - Support Ruby 3.0+ [\#18](https://github.com/tonobo/hcloud-ruby/issues/18)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - lib: adjust code to work with 3.x ruby versions [\#21](https://github.com/tonobo/hcloud-ruby/pull/21) ([Kjarrigan](https://github.com/Kjarrigan))
14
+ - ci: add github workflow [\#20](https://github.com/tonobo/hcloud-ruby/pull/20) ([RaphaelPour](https://github.com/RaphaelPour))
15
+
16
+ ## [v1.0.2](https://github.com/tonobo/hcloud-ruby/tree/v1.0.2) (2020-02-13)
17
+
18
+ [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.0.1...v1.0.2)
19
+
20
+ **Closed issues:**
21
+
22
+ - Thank you! [\#14](https://github.com/tonobo/hcloud-ruby/issues/14)
23
+
24
+ ## [v1.0.1](https://github.com/tonobo/hcloud-ruby/tree/v1.0.1) (2020-02-12)
25
+
26
+ [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v1.0.0...v1.0.1)
27
+
28
+ ## [v1.0.0](https://github.com/tonobo/hcloud-ruby/tree/v1.0.0) (2019-10-22)
29
+
30
+ [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.2...v1.0.0)
31
+
32
+ **Merged pull requests:**
33
+
34
+ - Refactor resource handling [\#15](https://github.com/tonobo/hcloud-ruby/pull/15) ([tonobo](https://github.com/tonobo))
35
+ - Development [\#13](https://github.com/tonobo/hcloud-ruby/pull/13) ([tonobo](https://github.com/tonobo))
36
+ - Mention destroy instead of delete. [\#10](https://github.com/tonobo/hcloud-ruby/pull/10) ([FloHeinle](https://github.com/FloHeinle))
37
+
38
+ ## [v0.1.2](https://github.com/tonobo/hcloud-ruby/tree/v0.1.2) (2018-02-27)
39
+
40
+ [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.1...v0.1.2)
41
+
42
+ **Closed issues:**
43
+
44
+ - Add rubocop [\#7](https://github.com/tonobo/hcloud-ruby/issues/7)
45
+ - Unnecessary pagination calls [\#6](https://github.com/tonobo/hcloud-ruby/issues/6)
46
+
47
+ **Merged pull requests:**
48
+
49
+ - Introduce rubocop [\#8](https://github.com/tonobo/hcloud-ruby/pull/8) ([tonobo](https://github.com/tonobo))
50
+ - Enhance test suite [\#5](https://github.com/tonobo/hcloud-ruby/pull/5) ([tonobo](https://github.com/tonobo))
2
51
 
3
52
  ## [v0.1.1](https://github.com/tonobo/hcloud-ruby/tree/v0.1.1) (2018-02-26)
53
+
4
54
  [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0...v0.1.1)
5
55
 
6
56
  **Merged pull requests:**
@@ -8,6 +58,7 @@
8
58
  - Floating IP context [\#4](https://github.com/tonobo/hcloud-ruby/pull/4) ([MarkusFreitag](https://github.com/MarkusFreitag))
9
59
 
10
60
  ## [v0.1.0](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0) (2018-02-25)
61
+
11
62
  [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha4...v0.1.0)
12
63
 
13
64
  **Closed issues:**
@@ -19,9 +70,11 @@
19
70
  - Pagination proposal [\#3](https://github.com/tonobo/hcloud-ruby/pull/3) ([tonobo](https://github.com/tonobo))
20
71
 
21
72
  ## [v0.1.0.pre.alpha4](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha4) (2018-01-30)
73
+
22
74
  [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha3...v0.1.0.pre.alpha4)
23
75
 
24
76
  ## [v0.1.0.pre.alpha3](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha3) (2018-01-29)
77
+
25
78
  [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha2...v0.1.0.pre.alpha3)
26
79
 
27
80
  **Merged pull requests:**
@@ -29,12 +82,17 @@
29
82
  - set needed gems to runtime dependency [\#1](https://github.com/tonobo/hcloud-ruby/pull/1) ([bastelfreak](https://github.com/bastelfreak))
30
83
 
31
84
  ## [v0.1.0.pre.alpha2](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha2) (2018-01-28)
85
+
32
86
  [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha1...v0.1.0.pre.alpha2)
33
87
 
34
88
  ## [v0.1.0.pre.alpha1](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha1) (2018-01-28)
89
+
35
90
  [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha0...v0.1.0.pre.alpha1)
36
91
 
37
92
  ## [v0.1.0.pre.alpha0](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha0) (2018-01-27)
38
93
 
94
+ [Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/7f85d9b10b15c275f44f57d1b6fb6f122d95b5aa...v0.1.0.pre.alpha0)
95
+
96
+
39
97
 
40
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
98
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile CHANGED
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  gem 'codecov', require: false, group: :test
8
+ gem 'faker'
6
9
  gem 'pry'
7
10
  gem 'rubocop'
8
11
 
data/Gemfile.lock ADDED
@@ -0,0 +1,149 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hcloud (1.0.3)
5
+ activemodel
6
+ activesupport (= 6.1.4.4)
7
+ oj
8
+ typhoeus
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ activemodel (6.1.4.4)
14
+ activesupport (= 6.1.4.4)
15
+ activesupport (6.1.4.4)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
+ addressable (2.8.0)
22
+ public_suffix (>= 2.0.2, < 5.0)
23
+ ast (2.4.2)
24
+ builder (3.2.4)
25
+ codecov (0.6.0)
26
+ simplecov (>= 0.15, < 0.22)
27
+ coderay (1.1.3)
28
+ concurrent-ruby (1.1.9)
29
+ crack (0.4.5)
30
+ rexml
31
+ diff-lcs (1.5.0)
32
+ docile (1.4.0)
33
+ dry-configurable (0.14.0)
34
+ concurrent-ruby (~> 1.0)
35
+ dry-core (~> 0.6)
36
+ dry-container (0.9.0)
37
+ concurrent-ruby (~> 1.0)
38
+ dry-configurable (~> 0.13, >= 0.13.0)
39
+ dry-core (0.7.1)
40
+ concurrent-ruby (~> 1.0)
41
+ dry-inflector (0.2.1)
42
+ dry-logic (1.2.0)
43
+ concurrent-ruby (~> 1.0)
44
+ dry-core (~> 0.5, >= 0.5)
45
+ dry-types (1.5.1)
46
+ concurrent-ruby (~> 1.0)
47
+ dry-container (~> 0.3)
48
+ dry-core (~> 0.5, >= 0.5)
49
+ dry-inflector (~> 0.1, >= 0.1.2)
50
+ dry-logic (~> 1.0, >= 1.0.2)
51
+ ethon (0.15.0)
52
+ ffi (>= 1.15.0)
53
+ faker (2.19.0)
54
+ i18n (>= 1.6, < 2)
55
+ ffi (1.15.5)
56
+ grape (1.6.2)
57
+ activesupport
58
+ builder
59
+ dry-types (>= 1.1)
60
+ mustermann-grape (~> 1.0.0)
61
+ rack (>= 1.3.0)
62
+ rack-accept
63
+ hashdiff (1.0.1)
64
+ i18n (1.10.0)
65
+ concurrent-ruby (~> 1.0)
66
+ method_source (1.0.0)
67
+ minitest (5.15.0)
68
+ mustermann (1.1.1)
69
+ ruby2_keywords (~> 0.0.1)
70
+ mustermann-grape (1.0.1)
71
+ mustermann (>= 1.0.0)
72
+ oj (3.13.11)
73
+ parallel (1.21.0)
74
+ parser (3.1.0.0)
75
+ ast (~> 2.4.1)
76
+ pry (0.14.1)
77
+ coderay (~> 1.1)
78
+ method_source (~> 1.0)
79
+ public_suffix (4.0.6)
80
+ rack (2.2.3)
81
+ rack-accept (0.4.5)
82
+ rack (>= 0.4)
83
+ rainbow (3.1.1)
84
+ rake (13.0.6)
85
+ regexp_parser (2.2.1)
86
+ rexml (3.2.5)
87
+ rspec (3.11.0)
88
+ rspec-core (~> 3.11.0)
89
+ rspec-expectations (~> 3.11.0)
90
+ rspec-mocks (~> 3.11.0)
91
+ rspec-core (3.11.0)
92
+ rspec-support (~> 3.11.0)
93
+ rspec-expectations (3.11.0)
94
+ diff-lcs (>= 1.2.0, < 2.0)
95
+ rspec-support (~> 3.11.0)
96
+ rspec-mocks (3.11.0)
97
+ diff-lcs (>= 1.2.0, < 2.0)
98
+ rspec-support (~> 3.11.0)
99
+ rspec-support (3.11.0)
100
+ rubocop (1.25.1)
101
+ parallel (~> 1.10)
102
+ parser (>= 3.1.0.0)
103
+ rainbow (>= 2.2.2, < 4.0)
104
+ regexp_parser (>= 1.8, < 3.0)
105
+ rexml
106
+ rubocop-ast (>= 1.15.1, < 2.0)
107
+ ruby-progressbar (~> 1.7)
108
+ unicode-display_width (>= 1.4.0, < 3.0)
109
+ rubocop-ast (1.15.2)
110
+ parser (>= 3.0.1.1)
111
+ ruby-progressbar (1.11.0)
112
+ ruby2_keywords (0.0.5)
113
+ simplecov (0.21.2)
114
+ docile (~> 1.1)
115
+ simplecov-html (~> 0.11)
116
+ simplecov_json_formatter (~> 0.1)
117
+ simplecov-html (0.12.3)
118
+ simplecov_json_formatter (0.1.4)
119
+ typhoeus (1.4.0)
120
+ ethon (>= 0.9.0)
121
+ tzinfo (2.0.4)
122
+ concurrent-ruby (~> 1.0)
123
+ unicode-display_width (2.1.0)
124
+ webmock (3.14.0)
125
+ addressable (>= 2.8.0)
126
+ crack (>= 0.3.2)
127
+ hashdiff (>= 0.4.0, < 2.0.0)
128
+ zeitwerk (2.5.4)
129
+
130
+ PLATFORMS
131
+ ruby
132
+ x86_64-linux
133
+
134
+ DEPENDENCIES
135
+ activemodel
136
+ activesupport (= 6.1.4.4)
137
+ bundler
138
+ codecov
139
+ faker
140
+ grape
141
+ hcloud!
142
+ pry
143
+ rake
144
+ rspec
145
+ rubocop
146
+ webmock
147
+
148
+ BUNDLED WITH
149
+ 2.3.7
data/README.md CHANGED
@@ -46,6 +46,31 @@ c = Hcloud::Client.new(
46
46
  )
47
47
  ```
48
48
 
49
+ * Expose client connection to class level
50
+
51
+ ```ruby
52
+ Hcloud::Client.connection = Hcloud::Client.new(...)
53
+ ```
54
+
55
+ ### Client concurrency
56
+
57
+ Each action could be handled concurrently. The actual downsides are located
58
+ at the exception handling. Means one request could break the whole bunch of requests,
59
+ you currently have to deal with that.
60
+
61
+ ```ruby
62
+ servers = []
63
+ client.concurrent do
64
+ 10.times do
65
+ servers << client.servers.create(...)
66
+ end
67
+ end
68
+
69
+ servers.each do |(action, server, root_password)|
70
+ # do something with your servers ...
71
+ end
72
+ ```
73
+
49
74
  ### Server Resource
50
75
 
51
76
  * List servers (basic client)
@@ -67,6 +92,14 @@ c.servers.limit(80).each do |server|
67
92
  end
68
93
  ```
69
94
 
95
+ * List with registered class level client
96
+
97
+ ```ruby
98
+ Server.limit(10).each do |server|
99
+ # do something with the server
100
+ end
101
+ ```
102
+
70
103
  * Create a server
71
104
 
72
105
  Nonblocking:
@@ -106,6 +139,6 @@ Hcloud::Error::UniquenessError: server name is already used
106
139
  * Delete a server
107
140
 
108
141
  ```ruby
109
- c.servers.first.delete
142
+ c.servers.first.destroy
110
143
  #=> #<Hcloud::Action>
111
144
  ```
data/Rakefile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  task default: :spec
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'hcloud'
data/hcloud.gemspec CHANGED
@@ -1,31 +1,36 @@
1
+ # frozen_string_literal: true
1
2
 
2
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'hcloud/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
8
  spec.name = 'hcloud'
8
9
  spec.version = Hcloud::VERSION
9
- spec.authors = ['Tim Foerster']
10
- spec.email = ['github@moo.gl']
10
+ spec.authors = ['Tim Foerster', 'Raphael Pour']
11
+ spec.email = ['github@moo.gl', 'rubygems@evilcookie.de']
11
12
 
12
13
  spec.summary = 'HetznerCloud native Ruby client'
13
- spec.homepage = 'https://github.com/tonobo/hcloud'
14
+ spec.homepage = 'https://github.com/tonobo/hcloud-ruby'
14
15
 
15
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ spec.required_ruby_version = '>= 2.7.0'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
19
  f.match(%r{^(test|spec|features)/})
17
20
  end
18
21
  spec.bindir = 'exe'
19
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
23
  spec.require_paths = ['lib']
21
24
 
22
- spec.add_development_dependency 'activesupport'
23
- spec.add_development_dependency 'bundler', '~> 1.15'
25
+ spec.add_development_dependency 'activemodel'
26
+ spec.add_development_dependency 'activesupport', '6.1.4.4'
27
+ spec.add_development_dependency 'bundler'
24
28
  spec.add_development_dependency 'grape'
25
- spec.add_development_dependency 'rake', '~> 10.0'
29
+ spec.add_development_dependency 'rake'
26
30
  spec.add_development_dependency 'rspec'
27
31
  spec.add_development_dependency 'webmock'
28
- spec.add_runtime_dependency 'activesupport'
32
+ spec.add_runtime_dependency 'activemodel'
33
+ spec.add_runtime_dependency 'activesupport', '6.1.4.4'
29
34
  spec.add_runtime_dependency 'oj'
30
35
  spec.add_runtime_dependency 'typhoeus'
31
36
  end