scalingo 3.0.0.beta.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publish.yml +28 -0
  3. data/.github/workflows/ruby.yml +45 -0
  4. data/.rubocop.yml +16 -0
  5. data/CHANGELOG.md +24 -0
  6. data/README.md +25 -20
  7. data/lib/scalingo/api/client.rb +38 -10
  8. data/lib/scalingo/api/endpoint.rb +12 -2
  9. data/lib/scalingo/api/response.rb +11 -2
  10. data/lib/scalingo/auth/keys.rb +4 -4
  11. data/lib/scalingo/auth/scm_integrations.rb +4 -4
  12. data/lib/scalingo/auth/tokens.rb +6 -6
  13. data/lib/scalingo/auth/two_factor_auth.rb +4 -4
  14. data/lib/scalingo/auth/user.rb +15 -2
  15. data/lib/scalingo/bearer_token.rb +15 -0
  16. data/lib/scalingo/billing/profile.rb +3 -3
  17. data/lib/scalingo/client.rb +26 -113
  18. data/lib/scalingo/configuration.rb +8 -36
  19. data/lib/scalingo/core_client.rb +106 -0
  20. data/lib/scalingo/regional/addons.rb +21 -8
  21. data/lib/scalingo/regional/apps.rb +8 -8
  22. data/lib/scalingo/regional/autoscalers.rb +70 -0
  23. data/lib/scalingo/regional/collaborators.rb +4 -4
  24. data/lib/scalingo/regional/containers.rb +4 -4
  25. data/lib/scalingo/regional/deployments.rb +3 -3
  26. data/lib/scalingo/regional/domains.rb +5 -5
  27. data/lib/scalingo/regional/environment.rb +6 -6
  28. data/lib/scalingo/regional/events.rb +4 -4
  29. data/lib/scalingo/regional/logs.rb +2 -2
  30. data/lib/scalingo/regional/metrics.rb +3 -2
  31. data/lib/scalingo/regional/notifiers.rb +7 -7
  32. data/lib/scalingo/regional/operations.rb +1 -1
  33. data/lib/scalingo/regional/scm_repo_links.rb +8 -8
  34. data/lib/scalingo/regional.rb +2 -0
  35. data/lib/scalingo/token_holder.rb +31 -0
  36. data/lib/scalingo/version.rb +1 -1
  37. data/samples/auth/user/stop-free-trial.json +24 -0
  38. data/samples/regional/addons/token-200.json +49 -0
  39. data/samples/regional/addons/token-404.json +24 -0
  40. data/samples/regional/autoscalers/_meta.json +27 -0
  41. data/samples/regional/autoscalers/create-201.json +49 -0
  42. data/samples/regional/autoscalers/create-500.json +32 -0
  43. data/samples/regional/autoscalers/destroy-204.json +20 -0
  44. data/samples/regional/autoscalers/destroy-404.json +25 -0
  45. data/samples/regional/autoscalers/find-200.json +39 -0
  46. data/samples/regional/autoscalers/find-404.json +25 -0
  47. data/samples/regional/autoscalers/for-200.json +41 -0
  48. data/samples/regional/autoscalers/update-200.json +45 -0
  49. data/samples/regional/autoscalers/update-404.json +31 -0
  50. data/samples/regional/autoscalers/update-500.json +30 -0
  51. data/scalingo.gemspec +8 -8
  52. data/spec/scalingo/api/client_spec.rb +60 -13
  53. data/spec/scalingo/api/endpoint_spec.rb +18 -3
  54. data/spec/scalingo/api/response_spec.rb +32 -16
  55. data/spec/scalingo/auth/user_spec.rb +6 -0
  56. data/spec/scalingo/auth_spec.rb +1 -1
  57. data/spec/scalingo/billing_spec.rb +11 -0
  58. data/spec/scalingo/client_spec.rb +2 -2
  59. data/spec/scalingo/configuration_spec.rb +32 -30
  60. data/spec/scalingo/regional/addons_spec.rb +16 -0
  61. data/spec/scalingo/regional/autoscalers_spec.rb +84 -0
  62. data/spec/scalingo/regional_spec.rb +3 -3
  63. metadata +69 -47
  64. data/.travis.yml +0 -24
@@ -0,0 +1,84 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Scalingo::Regional::Autoscalers do
4
+ describe_method "create" do
5
+ context "success" do
6
+ let(:arguments) { [meta[:app_id], meta[:create][:valid]] }
7
+ let(:stub_pattern) { "create-201" }
8
+
9
+ it_behaves_like "a singular object response", 201
10
+ end
11
+
12
+ context "failure" do
13
+ let(:arguments) { [meta[:app_id], meta[:create][:invalid]] }
14
+ let(:stub_pattern) { "create-500" }
15
+
16
+ it_behaves_like "a server error"
17
+ end
18
+ end
19
+
20
+ describe_method "for" do
21
+ context "success" do
22
+ let(:arguments) { meta[:app_id] }
23
+ let(:stub_pattern) { "for-200" }
24
+
25
+ it_behaves_like "a collection response"
26
+ it_behaves_like "a non-paginated collection"
27
+ end
28
+ end
29
+
30
+ describe_method "find" do
31
+ context "success" do
32
+ let(:arguments) { [meta[:app_id], meta[:id]] }
33
+ let(:stub_pattern) { "find-200" }
34
+
35
+ it_behaves_like "a singular object response"
36
+ end
37
+
38
+ context "not found" do
39
+ let(:arguments) { [meta[:app_id], meta[:not_found_id]] }
40
+ let(:stub_pattern) { "find-404" }
41
+
42
+ it_behaves_like "a not found response"
43
+ end
44
+ end
45
+
46
+ describe_method "update" do
47
+ context "success" do
48
+ let(:arguments) { [meta[:app_id], meta[:id], meta[:update][:valid]] }
49
+ let(:stub_pattern) { "update-200" }
50
+
51
+ it_behaves_like "a singular object response"
52
+ end
53
+
54
+ context "failure" do
55
+ let(:arguments) { [meta[:app_id], meta[:id], meta[:update][:invalid]] }
56
+ let(:stub_pattern) { "update-500" }
57
+
58
+ it_behaves_like "a server error"
59
+ end
60
+
61
+ context "not found" do
62
+ let(:arguments) { [meta[:app_id], meta[:not_found_id], meta[:update][:valid]] }
63
+ let(:stub_pattern) { "update-404" }
64
+
65
+ it_behaves_like "a not found response"
66
+ end
67
+ end
68
+
69
+ describe_method "destroy" do
70
+ context "success" do
71
+ let(:arguments) { [meta[:app_id], meta[:id]] }
72
+ let(:stub_pattern) { "destroy-204" }
73
+
74
+ it_behaves_like "an empty response"
75
+ end
76
+
77
+ context "not found" do
78
+ let(:arguments) { [meta[:app_id], meta[:not_found_id]] }
79
+ let(:stub_pattern) { "destroy-404" }
80
+
81
+ it_behaves_like "a not found response"
82
+ end
83
+ end
84
+ end
@@ -1,11 +1,11 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe Scalingo::Regional do
4
- subject { described_class.new(:client, :url) }
4
+ subject { described_class.new("url") }
5
5
 
6
6
  %w[
7
- addons apps collaborators containers deployments domains environment events
8
- logs metrics notifiers operations scm_repo_links
7
+ addons apps autoscalers collaborators containers deployments domains
8
+ environment events logs metrics notifiers operations scm_repo_links
9
9
  ].each do |section|
10
10
  it "handles requests for #{section}" do
11
11
  expect(subject.respond_to?(section)).to be true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scalingo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Unbekandt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-06-18 00:00:00.000000000 Z
12
+ date: 2021-12-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '5'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '7'
23
+ version: '8'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,55 +30,55 @@ dependencies:
30
30
  version: '5'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '7'
33
+ version: '8'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: faraday
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.1
40
+ version: '1.0'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.1
47
+ version: '1.0'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: faraday_middleware
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
54
+ version: '1.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0
61
+ version: '1.0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: multi_json
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
66
  - - ">="
70
67
  - !ruby/object:Gem::Version
71
68
  version: 1.0.3
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '1.0'
72
72
  type: :runtime
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - "~>"
77
- - !ruby/object:Gem::Version
78
- version: '1.0'
79
76
  - - ">="
80
77
  - !ruby/object:Gem::Version
81
78
  version: 1.0.3
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.0'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: bundler
84
84
  requirement: !ruby/object:Gem::Requirement
@@ -122,61 +122,61 @@ dependencies:
122
122
  - !ruby/object:Gem::Version
123
123
  version: '3.0'
124
124
  - !ruby/object:Gem::Dependency
125
- name: rubocop
125
+ name: standard
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: 0.83.0
130
+ version: 1.1.0
131
131
  type: :development
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: 0.83.0
137
+ version: 1.1.0
138
138
  - !ruby/object:Gem::Dependency
139
- name: standard
139
+ name: rubocop-rspec
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - "~>"
142
+ - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: 0.4.2
144
+ version: '0'
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - "~>"
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
- version: 0.4.2
151
+ version: '0'
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: pry
154
154
  requirement: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: 0.13.1
158
+ version: 0.14.1
159
159
  type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: 0.13.1
165
+ version: 0.14.1
166
166
  - !ruby/object:Gem::Dependency
167
167
  name: webmock
168
168
  requirement: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: 3.8.0
172
+ version: 3.12.2
173
173
  type: :development
174
174
  prerelease: false
175
175
  version_requirements: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: 3.8.0
179
+ version: 3.12.2
180
180
  description: Ruby client library for the web APIs of Scalingo, a european Platform-as-a-Service
181
181
  email:
182
182
  - leo@scalingo.com
@@ -185,9 +185,10 @@ executables: []
185
185
  extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
+ - ".github/workflows/publish.yml"
189
+ - ".github/workflows/ruby.yml"
188
190
  - ".gitignore"
189
191
  - ".rubocop.yml"
190
- - ".travis.yml"
191
192
  - CHANGELOG.md
192
193
  - Gemfile
193
194
  - LICENSE.txt
@@ -210,12 +211,14 @@ files:
210
211
  - lib/scalingo/billing/profile.rb
211
212
  - lib/scalingo/client.rb
212
213
  - lib/scalingo/configuration.rb
214
+ - lib/scalingo/core_client.rb
213
215
  - lib/scalingo/error/expired_token.rb
214
216
  - lib/scalingo/error/unauthenticated.rb
215
217
  - lib/scalingo/errors.rb
216
218
  - lib/scalingo/regional.rb
217
219
  - lib/scalingo/regional/addons.rb
218
220
  - lib/scalingo/regional/apps.rb
221
+ - lib/scalingo/regional/autoscalers.rb
219
222
  - lib/scalingo/regional/collaborators.rb
220
223
  - lib/scalingo/regional/containers.rb
221
224
  - lib/scalingo/regional/deployments.rb
@@ -227,6 +230,7 @@ files:
227
230
  - lib/scalingo/regional/notifiers.rb
228
231
  - lib/scalingo/regional/operations.rb
229
232
  - lib/scalingo/regional/scm_repo_links.rb
233
+ - lib/scalingo/token_holder.rb
230
234
  - lib/scalingo/version.rb
231
235
  - samples/auth/keys/_meta.json
232
236
  - samples/auth/keys/all-200.json
@@ -265,6 +269,7 @@ files:
265
269
  - samples/auth/two_factor_auth/validate-wrong.json
266
270
  - samples/auth/user/_meta.json
267
271
  - samples/auth/user/self.json
272
+ - samples/auth/user/stop-free-trial.json
268
273
  - samples/auth/user/update-200.json
269
274
  - samples/auth/user/update-422.json
270
275
  - samples/billing/profile/_meta.json
@@ -289,6 +294,8 @@ files:
289
294
  - samples/regional/addons/provision-400.json
290
295
  - samples/regional/addons/sso-200.json
291
296
  - samples/regional/addons/sso-404.json
297
+ - samples/regional/addons/token-200.json
298
+ - samples/regional/addons/token-404.json
292
299
  - samples/regional/addons/update-200.json
293
300
  - samples/regional/addons/update-404.json
294
301
  - samples/regional/apps/_meta.json
@@ -309,6 +316,17 @@ files:
309
316
  - samples/regional/apps/transfer-422.json
310
317
  - samples/regional/apps/update-200.json
311
318
  - samples/regional/apps/update-stack-404.json
319
+ - samples/regional/autoscalers/_meta.json
320
+ - samples/regional/autoscalers/create-201.json
321
+ - samples/regional/autoscalers/create-500.json
322
+ - samples/regional/autoscalers/destroy-204.json
323
+ - samples/regional/autoscalers/destroy-404.json
324
+ - samples/regional/autoscalers/find-200.json
325
+ - samples/regional/autoscalers/find-404.json
326
+ - samples/regional/autoscalers/for-200.json
327
+ - samples/regional/autoscalers/update-200.json
328
+ - samples/regional/autoscalers/update-404.json
329
+ - samples/regional/autoscalers/update-500.json
312
330
  - samples/regional/collaborators/_meta.json
313
331
  - samples/regional/collaborators/accept-200.json
314
332
  - samples/regional/collaborators/accept-400.json
@@ -407,10 +425,12 @@ files:
407
425
  - spec/scalingo/auth_spec.rb
408
426
  - spec/scalingo/bearer_token_spec.rb
409
427
  - spec/scalingo/billing/profile_spec.rb
428
+ - spec/scalingo/billing_spec.rb
410
429
  - spec/scalingo/client_spec.rb
411
430
  - spec/scalingo/configuration_spec.rb
412
431
  - spec/scalingo/regional/addons_spec.rb
413
432
  - spec/scalingo/regional/apps_spec.rb
433
+ - spec/scalingo/regional/autoscalers_spec.rb
414
434
  - spec/scalingo/regional/collaborators_spec.rb
415
435
  - spec/scalingo/regional/containers_spec.rb
416
436
  - spec/scalingo/regional/deployments_spec.rb
@@ -443,39 +463,41 @@ required_ruby_version: !ruby/object:Gem::Requirement
443
463
  version: '0'
444
464
  required_rubygems_version: !ruby/object:Gem::Requirement
445
465
  requirements:
446
- - - ">"
466
+ - - ">="
447
467
  - !ruby/object:Gem::Version
448
- version: 1.3.1
468
+ version: '0'
449
469
  requirements: []
450
- rubygems_version: 3.0.3
470
+ rubygems_version: 3.2.32
451
471
  signing_key:
452
472
  specification_version: 4
453
473
  summary: Ruby client for Scalingo APIs
454
474
  test_files:
455
- - spec/scalingo/client_spec.rb
475
+ - spec/scalingo/api/client_spec.rb
476
+ - spec/scalingo/api/endpoint_spec.rb
477
+ - spec/scalingo/api/response_spec.rb
478
+ - spec/scalingo/auth/keys_spec.rb
456
479
  - spec/scalingo/auth/scm_integrations_spec.rb
457
480
  - spec/scalingo/auth/tokens_spec.rb
458
- - spec/scalingo/auth/keys_spec.rb
459
481
  - spec/scalingo/auth/two_factor_auth_spec.rb
460
482
  - spec/scalingo/auth/user_spec.rb
483
+ - spec/scalingo/auth_spec.rb
484
+ - spec/scalingo/bearer_token_spec.rb
485
+ - spec/scalingo/billing/profile_spec.rb
486
+ - spec/scalingo/billing_spec.rb
487
+ - spec/scalingo/client_spec.rb
461
488
  - spec/scalingo/configuration_spec.rb
462
- - spec/scalingo/api/client_spec.rb
463
- - spec/scalingo/api/endpoint_spec.rb
464
- - spec/scalingo/api/response_spec.rb
489
+ - spec/scalingo/regional/addons_spec.rb
490
+ - spec/scalingo/regional/apps_spec.rb
491
+ - spec/scalingo/regional/autoscalers_spec.rb
465
492
  - spec/scalingo/regional/collaborators_spec.rb
466
- - spec/scalingo/regional/operations_spec.rb
467
- - spec/scalingo/regional/notifiers_spec.rb
468
- - spec/scalingo/regional/environment_spec.rb
493
+ - spec/scalingo/regional/containers_spec.rb
469
494
  - spec/scalingo/regional/deployments_spec.rb
470
- - spec/scalingo/regional/apps_spec.rb
471
- - spec/scalingo/regional/metrics_spec.rb
472
495
  - spec/scalingo/regional/domains_spec.rb
473
- - spec/scalingo/regional/scm_repo_links_spec.rb
474
- - spec/scalingo/regional/addons_spec.rb
475
- - spec/scalingo/regional/logs_spec.rb
476
- - spec/scalingo/regional/containers_spec.rb
496
+ - spec/scalingo/regional/environment_spec.rb
477
497
  - spec/scalingo/regional/events_spec.rb
478
- - spec/scalingo/bearer_token_spec.rb
479
- - spec/scalingo/auth_spec.rb
480
- - spec/scalingo/billing/profile_spec.rb
498
+ - spec/scalingo/regional/logs_spec.rb
499
+ - spec/scalingo/regional/metrics_spec.rb
500
+ - spec/scalingo/regional/notifiers_spec.rb
501
+ - spec/scalingo/regional/operations_spec.rb
502
+ - spec/scalingo/regional/scm_repo_links_spec.rb
481
503
  - spec/scalingo/regional_spec.rb
data/.travis.yml DELETED
@@ -1,24 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.5.8
5
- - 2.6.6
6
- - 2.7.1
7
- before_install:
8
- - gem install bundler
9
- install: bundle update --jobs=3 --retry=3
10
-
11
- stages:
12
- - lint
13
- - test
14
-
15
- jobs:
16
- include:
17
- - stage: lint
18
- name: "Linter"
19
- language: ruby
20
- rvm: 2.7.1
21
- before_install:
22
- - gem install bundler
23
- install: bundle update --jobs=3 --retry=3
24
- script: bundle exec rubocop