hcloud 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +32 -0
- data/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +47 -2
- data/Gemfile.lock +102 -96
- data/hcloud.gemspec +8 -6
- data/lib/hcloud/abstract_resource.rb +15 -17
- data/lib/hcloud/client.rb +5 -4
- data/lib/hcloud/entry_loader.rb +7 -2
- data/lib/hcloud/network.rb +1 -1
- data/lib/hcloud/server_resource.rb +1 -2
- data/lib/hcloud/typhoeus_ext.rb +8 -10
- data/lib/hcloud/version.rb +1 -1
- metadata +20 -18
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a461edd72b44398c79ea0fb49a47457864551df5157572f9ce7e41fb8761b2c1
|
4
|
+
data.tar.gz: 8dcfe208c66dd462d444da2cdcc6e5ef65fa5595cea900c7406fdff0e5da8f7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/.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,7 +13,7 @@ Style/Documentation:
|
|
10
13
|
Naming/ConstantName:
|
11
14
|
Enabled: false
|
12
15
|
|
13
|
-
Lint/
|
16
|
+
Lint/SuppressedException:
|
14
17
|
Enabled: false
|
15
18
|
|
16
19
|
Lint/AssignmentInCondition:
|
data/.rubocop_todo.yml
CHANGED
@@ -39,7 +39,7 @@ Metrics/PerceivedComplexity:
|
|
39
39
|
# Offense count: 3
|
40
40
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
41
41
|
# AllowedNames: io, id, to, by, on, in, at, ip, db
|
42
|
-
Naming/
|
42
|
+
Naming/MethodParameterName:
|
43
43
|
Exclude:
|
44
44
|
- 'lib/hcloud/abstract_resource.rb'
|
45
45
|
- 'spec/fake_service/action.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,42 @@
|
|
1
|
-
#
|
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))
|
2
37
|
|
3
38
|
## [v0.1.2](https://github.com/tonobo/hcloud-ruby/tree/v0.1.2) (2018-02-27)
|
39
|
+
|
4
40
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.1...v0.1.2)
|
5
41
|
|
6
42
|
**Closed issues:**
|
@@ -14,6 +50,7 @@
|
|
14
50
|
- Enhance test suite [\#5](https://github.com/tonobo/hcloud-ruby/pull/5) ([tonobo](https://github.com/tonobo))
|
15
51
|
|
16
52
|
## [v0.1.1](https://github.com/tonobo/hcloud-ruby/tree/v0.1.1) (2018-02-26)
|
53
|
+
|
17
54
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0...v0.1.1)
|
18
55
|
|
19
56
|
**Merged pull requests:**
|
@@ -21,6 +58,7 @@
|
|
21
58
|
- Floating IP context [\#4](https://github.com/tonobo/hcloud-ruby/pull/4) ([MarkusFreitag](https://github.com/MarkusFreitag))
|
22
59
|
|
23
60
|
## [v0.1.0](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0) (2018-02-25)
|
61
|
+
|
24
62
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha4...v0.1.0)
|
25
63
|
|
26
64
|
**Closed issues:**
|
@@ -32,9 +70,11 @@
|
|
32
70
|
- Pagination proposal [\#3](https://github.com/tonobo/hcloud-ruby/pull/3) ([tonobo](https://github.com/tonobo))
|
33
71
|
|
34
72
|
## [v0.1.0.pre.alpha4](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha4) (2018-01-30)
|
73
|
+
|
35
74
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha3...v0.1.0.pre.alpha4)
|
36
75
|
|
37
76
|
## [v0.1.0.pre.alpha3](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha3) (2018-01-29)
|
77
|
+
|
38
78
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha2...v0.1.0.pre.alpha3)
|
39
79
|
|
40
80
|
**Merged pull requests:**
|
@@ -42,12 +82,17 @@
|
|
42
82
|
- set needed gems to runtime dependency [\#1](https://github.com/tonobo/hcloud-ruby/pull/1) ([bastelfreak](https://github.com/bastelfreak))
|
43
83
|
|
44
84
|
## [v0.1.0.pre.alpha2](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha2) (2018-01-28)
|
85
|
+
|
45
86
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha1...v0.1.0.pre.alpha2)
|
46
87
|
|
47
88
|
## [v0.1.0.pre.alpha1](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha1) (2018-01-28)
|
89
|
+
|
48
90
|
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/v0.1.0.pre.alpha0...v0.1.0.pre.alpha1)
|
49
91
|
|
50
92
|
## [v0.1.0.pre.alpha0](https://github.com/tonobo/hcloud-ruby/tree/v0.1.0.pre.alpha0) (2018-01-27)
|
51
93
|
|
94
|
+
[Full Changelog](https://github.com/tonobo/hcloud-ruby/compare/7f85d9b10b15c275f44f57d1b6fb6f122d95b5aa...v0.1.0.pre.alpha0)
|
95
|
+
|
96
|
+
|
52
97
|
|
53
|
-
\* *This
|
98
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile.lock
CHANGED
@@ -1,125 +1,131 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hcloud (0.
|
5
|
-
|
4
|
+
hcloud (1.0.3)
|
5
|
+
activemodel
|
6
|
+
activesupport (= 6.1.4.4)
|
6
7
|
oj
|
7
8
|
typhoeus
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
activemodel (6.
|
13
|
-
activesupport (= 6.
|
14
|
-
activesupport (6.
|
13
|
+
activemodel (6.1.4.4)
|
14
|
+
activesupport (= 6.1.4.4)
|
15
|
+
activesupport (6.1.4.4)
|
15
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
-
i18n (>=
|
17
|
-
minitest (
|
18
|
-
tzinfo (~>
|
19
|
-
zeitwerk (~> 2.
|
20
|
-
addressable (2.
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
zeitwerk (~> 2.3)
|
21
|
+
addressable (2.8.0)
|
21
22
|
public_suffix (>= 2.0.2, < 5.0)
|
22
|
-
ast (2.4.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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)
|
49
57
|
activesupport
|
50
58
|
builder
|
59
|
+
dry-types (>= 1.1)
|
51
60
|
mustermann-grape (~> 1.0.0)
|
52
61
|
rack (>= 1.3.0)
|
53
62
|
rack-accept
|
54
|
-
|
55
|
-
|
56
|
-
i18n (1.7.0)
|
63
|
+
hashdiff (1.0.1)
|
64
|
+
i18n (1.10.0)
|
57
65
|
concurrent-ruby (~> 1.0)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
public_suffix (4.0.1)
|
74
|
-
rack (2.0.7)
|
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)
|
75
81
|
rack-accept (0.4.5)
|
76
82
|
rack (>= 0.4)
|
77
|
-
rainbow (3.
|
78
|
-
rake (13.0.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
rspec-
|
83
|
-
|
84
|
-
rspec-
|
85
|
-
rspec-
|
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)
|
86
94
|
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
-
rspec-support (~> 3.
|
88
|
-
rspec-mocks (3.
|
95
|
+
rspec-support (~> 3.11.0)
|
96
|
+
rspec-mocks (3.11.0)
|
89
97
|
diff-lcs (>= 1.2.0, < 2.0)
|
90
|
-
rspec-support (~> 3.
|
91
|
-
rspec-support (3.
|
92
|
-
rubocop (
|
93
|
-
jaro_winkler (~> 1.5.1)
|
98
|
+
rspec-support (~> 3.11.0)
|
99
|
+
rspec-support (3.11.0)
|
100
|
+
rubocop (1.25.1)
|
94
101
|
parallel (~> 1.10)
|
95
|
-
parser (>=
|
102
|
+
parser (>= 3.1.0.0)
|
96
103
|
rainbow (>= 2.2.2, < 4.0)
|
104
|
+
regexp_parser (>= 1.8, < 3.0)
|
105
|
+
rexml
|
106
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
97
107
|
ruby-progressbar (~> 1.7)
|
98
|
-
unicode-display_width (>= 1.4.0, <
|
99
|
-
|
100
|
-
|
101
|
-
|
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)
|
102
114
|
docile (~> 1.1)
|
103
|
-
|
104
|
-
|
105
|
-
simplecov-html (0.
|
106
|
-
|
107
|
-
typhoeus (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)
|
108
120
|
ethon (>= 0.9.0)
|
109
|
-
tzinfo (
|
110
|
-
|
111
|
-
unicode-display_width (1.
|
112
|
-
|
113
|
-
|
114
|
-
axiom-types (~> 0.1)
|
115
|
-
coercible (~> 1.0)
|
116
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
117
|
-
equalizer (~> 0.0, >= 0.0.9)
|
118
|
-
webmock (3.7.6)
|
119
|
-
addressable (>= 2.3.6)
|
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)
|
120
126
|
crack (>= 0.3.2)
|
121
127
|
hashdiff (>= 0.4.0, < 2.0.0)
|
122
|
-
zeitwerk (2.
|
128
|
+
zeitwerk (2.5.4)
|
123
129
|
|
124
130
|
PLATFORMS
|
125
131
|
ruby
|
@@ -127,7 +133,7 @@ PLATFORMS
|
|
127
133
|
|
128
134
|
DEPENDENCIES
|
129
135
|
activemodel
|
130
|
-
activesupport
|
136
|
+
activesupport (= 6.1.4.4)
|
131
137
|
bundler
|
132
138
|
codecov
|
133
139
|
faker
|
@@ -140,4 +146,4 @@ DEPENDENCIES
|
|
140
146
|
webmock
|
141
147
|
|
142
148
|
BUNDLED WITH
|
143
|
-
|
149
|
+
2.3.7
|
data/hcloud.gemspec
CHANGED
@@ -7,13 +7,15 @@ require 'hcloud/version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'hcloud'
|
9
9
|
spec.version = Hcloud::VERSION
|
10
|
-
spec.authors = ['Tim Foerster']
|
11
|
-
spec.email = ['github@moo.gl']
|
10
|
+
spec.authors = ['Tim Foerster', 'Raphael Pour']
|
11
|
+
spec.email = ['github@moo.gl', 'rubygems@evilcookie.de']
|
12
12
|
|
13
13
|
spec.summary = 'HetznerCloud native Ruby client'
|
14
|
-
spec.homepage = 'https://github.com/tonobo/hcloud'
|
14
|
+
spec.homepage = 'https://github.com/tonobo/hcloud-ruby'
|
15
15
|
|
16
|
-
spec.
|
16
|
+
spec.required_ruby_version = '>= 2.7.0'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
19
|
f.match(%r{^(test|spec|features)/})
|
18
20
|
end
|
19
21
|
spec.bindir = 'exe'
|
@@ -21,14 +23,14 @@ Gem::Specification.new do |spec|
|
|
21
23
|
spec.require_paths = ['lib']
|
22
24
|
|
23
25
|
spec.add_development_dependency 'activemodel'
|
24
|
-
spec.add_development_dependency 'activesupport'
|
26
|
+
spec.add_development_dependency 'activesupport', '6.1.4.4'
|
25
27
|
spec.add_development_dependency 'bundler'
|
26
28
|
spec.add_development_dependency 'grape'
|
27
29
|
spec.add_development_dependency 'rake'
|
28
30
|
spec.add_development_dependency 'rspec'
|
29
31
|
spec.add_development_dependency 'webmock'
|
30
32
|
spec.add_runtime_dependency 'activemodel'
|
31
|
-
spec.add_runtime_dependency 'activesupport'
|
33
|
+
spec.add_runtime_dependency 'activesupport', '6.1.4.4'
|
32
34
|
spec.add_runtime_dependency 'oj'
|
33
35
|
spec.add_runtime_dependency 'typhoeus'
|
34
36
|
end
|
@@ -66,8 +66,8 @@ module Hcloud
|
|
66
66
|
where
|
67
67
|
end
|
68
68
|
|
69
|
-
def where(
|
70
|
-
kwargs.
|
69
|
+
def where(kwargs = {})
|
70
|
+
kwargs.each_key do |key|
|
71
71
|
keys = self.class.filter_attributes.map(&:to_s)
|
72
72
|
next if keys.include?(key.to_s)
|
73
73
|
|
@@ -117,16 +117,16 @@ module Hcloud
|
|
117
117
|
def order(*sort)
|
118
118
|
_dup :@order,
|
119
119
|
begin
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
120
|
+
sort.flat_map do |s|
|
121
|
+
case s
|
122
|
+
when Symbol, String then s.to_s
|
123
|
+
when Hash then s.map { |k, v| "#{k}:#{v}" }
|
124
|
+
else
|
125
|
+
raise ArgumentError,
|
126
|
+
"Unable to resolve type for given #{s.inspect} from #{sort}"
|
127
|
+
end
|
127
128
|
end
|
128
129
|
end
|
129
|
-
end
|
130
130
|
end
|
131
131
|
|
132
132
|
def run
|
@@ -138,10 +138,8 @@ module Hcloud
|
|
138
138
|
)
|
139
139
|
end
|
140
140
|
|
141
|
-
def each
|
142
|
-
run.each
|
143
|
-
yield(member)
|
144
|
-
end
|
141
|
+
def each(&block)
|
142
|
+
run.each(&block)
|
145
143
|
end
|
146
144
|
|
147
145
|
# this is just to keep the actual bevahior
|
@@ -195,14 +193,13 @@ module Hcloud
|
|
195
193
|
r.compact.join('&')
|
196
194
|
end
|
197
195
|
|
196
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
198
197
|
def __entries__(path, **o)
|
199
198
|
first_page = request(path, o.merge(ep: ep(per_page: 1, page: 1))).run
|
200
199
|
total_entries = first_page.pagination.total_entries
|
201
200
|
return [first_page] if total_entries <= 1 || @limit == 1
|
202
201
|
|
203
|
-
|
204
|
-
total_entries = @limit if total_entries > @limit
|
205
|
-
end
|
202
|
+
total_entries = @limit if !@limit.nil? && (total_entries > @limit)
|
206
203
|
pages = total_entries / Client::MAX_ENTRIES_PER_PAGE
|
207
204
|
pages += 1 if (total_entries % Client::MAX_ENTRIES_PER_PAGE).positive?
|
208
205
|
pages.times.map do |page|
|
@@ -215,5 +212,6 @@ module Hcloud
|
|
215
212
|
end
|
216
213
|
end
|
217
214
|
end
|
215
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
218
216
|
end
|
219
217
|
end
|
data/lib/hcloud/client.rb
CHANGED
@@ -20,6 +20,7 @@ module Hcloud
|
|
20
20
|
end
|
21
21
|
|
22
22
|
attr_reader :token, :auto_pagination, :hydra, :user_agent
|
23
|
+
|
23
24
|
def initialize(token:, auto_pagination: false, concurrency: 20, user_agent: nil)
|
24
25
|
@token = token
|
25
26
|
@user_agent = user_agent || "hcloud-ruby v#{VERSION}"
|
@@ -98,7 +99,7 @@ module Hcloud
|
|
98
99
|
end
|
99
100
|
|
100
101
|
class ResourceFuture < Delegator
|
101
|
-
def initialize(request)
|
102
|
+
def initialize(request) # rubocop:disable Lint/MissingSuper
|
102
103
|
@request = request
|
103
104
|
end
|
104
105
|
|
@@ -107,7 +108,7 @@ module Hcloud
|
|
107
108
|
end
|
108
109
|
end
|
109
110
|
|
110
|
-
def prepare_request(url,
|
111
|
+
def prepare_request(url, args = {}, &block)
|
111
112
|
req = request(url, **args.merge(block: block))
|
112
113
|
return req.run.resource unless concurrent?
|
113
114
|
|
@@ -115,7 +116,7 @@ module Hcloud
|
|
115
116
|
ResourceFuture.new(req)
|
116
117
|
end
|
117
118
|
|
118
|
-
def request(path,
|
119
|
+
def request(path, options = {}) # rubocop:disable Metrics/MethodLength
|
119
120
|
hcloud_attributes = TyphoeusExt.collect_attributes(options)
|
120
121
|
if x = options.delete(:j)
|
121
122
|
options[:body] = Oj.dump(x, mode: :compat)
|
@@ -127,7 +128,7 @@ module Hcloud
|
|
127
128
|
q << x.to_param
|
128
129
|
end
|
129
130
|
path = path.dup
|
130
|
-
path <<
|
131
|
+
path << "?#{q.join('&')}"
|
131
132
|
r = Typhoeus::Request.new(
|
132
133
|
"https://api.hetzner.cloud/v1/#{path}",
|
133
134
|
{
|
data/lib/hcloud/entry_loader.rb
CHANGED
@@ -53,7 +53,7 @@ module Hcloud
|
|
53
53
|
|
54
54
|
def protectable(*args)
|
55
55
|
define_method(:change_protection) do |**kwargs|
|
56
|
-
kwargs.
|
56
|
+
kwargs.each_key do |key|
|
57
57
|
next if args.map(&:to_s).include? key.to_s
|
58
58
|
|
59
59
|
raise ArgumentError, "#{key} not an allowed protection mode (allowed: #{args})"
|
@@ -94,7 +94,12 @@ module Hcloud
|
|
94
94
|
|
95
95
|
attr_accessor :response
|
96
96
|
|
97
|
-
def initialize(client = nil,
|
97
|
+
def initialize(client = nil, kwargs = {})
|
98
|
+
if client.is_a?(Hash)
|
99
|
+
kwargs = client
|
100
|
+
client = nil
|
101
|
+
end
|
102
|
+
|
98
103
|
@client = client
|
99
104
|
_load(kwargs)
|
100
105
|
end
|
data/lib/hcloud/network.rb
CHANGED
data/lib/hcloud/typhoeus_ext.rb
CHANGED
@@ -30,16 +30,14 @@ module Hcloud
|
|
30
30
|
def parsed_json
|
31
31
|
return {} if code == 204
|
32
32
|
|
33
|
-
@parsed_json ||=
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
33
|
+
@parsed_json ||= Oj.load(body, symbol_keys: true).tap do |json|
|
34
|
+
next unless request.hydra
|
35
|
+
|
36
|
+
check_for_error(
|
37
|
+
e_code: json.to_h.dig(:error, :code),
|
38
|
+
e_message: json.to_h.dig(:error, :message)
|
39
|
+
)
|
40
|
+
end
|
43
41
|
rescue StandardError
|
44
42
|
raise Error::UnexpectedError, "unable to load body: #{body}"
|
45
43
|
end
|
data/lib/hcloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Foerster
|
8
|
-
|
8
|
+
- Raphael Pour
|
9
|
+
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activemodel
|
@@ -28,16 +29,16 @@ dependencies:
|
|
28
29
|
name: activesupport
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- -
|
32
|
+
- - '='
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
+
version: 6.1.4.4
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
|
-
- -
|
39
|
+
- - '='
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
+
version: 6.1.4.4
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: bundler
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +127,16 @@ dependencies:
|
|
126
127
|
name: activesupport
|
127
128
|
requirement: !ruby/object:Gem::Requirement
|
128
129
|
requirements:
|
129
|
-
- -
|
130
|
+
- - '='
|
130
131
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
+
version: 6.1.4.4
|
132
133
|
type: :runtime
|
133
134
|
prerelease: false
|
134
135
|
version_requirements: !ruby/object:Gem::Requirement
|
135
136
|
requirements:
|
136
|
-
- -
|
137
|
+
- - '='
|
137
138
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
139
|
+
version: 6.1.4.4
|
139
140
|
- !ruby/object:Gem::Dependency
|
140
141
|
name: oj
|
141
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,18 +165,19 @@ dependencies:
|
|
164
165
|
- - ">="
|
165
166
|
- !ruby/object:Gem::Version
|
166
167
|
version: '0'
|
167
|
-
description:
|
168
|
+
description:
|
168
169
|
email:
|
169
170
|
- github@moo.gl
|
171
|
+
- rubygems@evilcookie.de
|
170
172
|
executables: []
|
171
173
|
extensions: []
|
172
174
|
extra_rdoc_files: []
|
173
175
|
files:
|
176
|
+
- ".github/workflows/ruby.yml"
|
174
177
|
- ".gitignore"
|
175
178
|
- ".rspec"
|
176
179
|
- ".rubocop.yml"
|
177
180
|
- ".rubocop_todo.yml"
|
178
|
-
- ".travis.yml"
|
179
181
|
- CHANGELOG.md
|
180
182
|
- Gemfile
|
181
183
|
- Gemfile.lock
|
@@ -214,10 +216,10 @@ files:
|
|
214
216
|
- lib/hcloud/version.rb
|
215
217
|
- lib/hcloud/volume.rb
|
216
218
|
- lib/hcloud/volume_resource.rb
|
217
|
-
homepage: https://github.com/tonobo/hcloud
|
219
|
+
homepage: https://github.com/tonobo/hcloud-ruby
|
218
220
|
licenses: []
|
219
221
|
metadata: {}
|
220
|
-
post_install_message:
|
222
|
+
post_install_message:
|
221
223
|
rdoc_options: []
|
222
224
|
require_paths:
|
223
225
|
- lib
|
@@ -225,15 +227,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
227
|
requirements:
|
226
228
|
- - ">="
|
227
229
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
230
|
+
version: 2.7.0
|
229
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
232
|
requirements:
|
231
233
|
- - ">="
|
232
234
|
- !ruby/object:Gem::Version
|
233
235
|
version: '0'
|
234
236
|
requirements: []
|
235
|
-
rubygems_version: 3.
|
236
|
-
signing_key:
|
237
|
+
rubygems_version: 3.2.22
|
238
|
+
signing_key:
|
237
239
|
specification_version: 4
|
238
240
|
summary: HetznerCloud native Ruby client
|
239
241
|
test_files: []
|