scalingo 3.2.0 → 3.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc653c0172dd4bc1b2b1cb80948582e0069c058d615f74dcc2bb9fac3d467245
4
- data.tar.gz: 4482433e8ca28c3a7ab72d2f22471f2ef2f61a5aa6b0f34d40c2faba9ecb5d98
3
+ metadata.gz: bd6577391c3a1b7c40866c6fbcc56eff45216d448f415ceb16a4ebfbe8ce4f38
4
+ data.tar.gz: 02d3d754ec2c0216b95a254621d5d06a09114131a6ea661699124039b6ead7c7
5
5
  SHA512:
6
- metadata.gz: 708a8fbe40bf16f20e0cb2fcd94506d2e2e21d3c02c0d9e521fc02396897835efb695fda4b472f0eafb48d29e262e3f679166af8c5e1efeab4978bf841539d15
7
- data.tar.gz: 5d75e30a6bdef5ae37be20869ffb81da7ceb82cd01d1a6cb97387054de87c3e1b4c6e2d6927deaaee22eb8195dd5d6ab0b51e177dfd66b57fc0fca6ec4a289ff
6
+ metadata.gz: d11cd9d73cba2c8890949db5fb3e9f450ae5db662e7a5f9c91e7dedfeb2f96be72468b1f56000a0dd250379d1b979572283c4e3ef866fef72556e0563852f331
7
+ data.tar.gz: 3b3cf9f52ba33b05d14941c5e83aa0ef618bf0b85339a1b55212336b162131ea49265cfa9d051f591886f67d988473c7927108ea6595ea9d70792cffd2a19307
@@ -27,7 +27,7 @@ jobs:
27
27
  runs-on: ubuntu-latest
28
28
  strategy:
29
29
  matrix:
30
- ruby-version: ['2.6', '2.7', '3.0']
30
+ ruby-version: ['2.6', '2.7', '3.0', '3.2']
31
31
  steps:
32
32
  - uses: actions/checkout@v3
33
33
  - name: Set up Ruby
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 3.3.0 - 2023-01-03
4
+
5
+ * Bugfix: response of Backups#create was not properly unpacked ([#44](https://github.com/Scalingo/scalingo-ruby-api/issues/44))
6
+ * New: Add default region for database API ([#45](https://github.com/Scalingo/scalingo-ruby-api/issues/44))
7
+
3
8
  ## 3.2.0 - 2022-12-23
4
9
 
5
10
  * Removal: `Scalingo::Client#agora_fr1` had been removed since the region no longer exists.
data/README.md CHANGED
@@ -174,6 +174,10 @@ scalingo.db_api_osc_fr1.backups.for(addon_id)
174
174
 
175
175
  # get URL to download backup archive
176
176
  scalingo.db_api_osc_fr1.backups.archive(addon_id, backup_id)
177
+
178
+ # you can omit the region to use the default one
179
+ scalingo.databases.find(addon_id)
180
+
177
181
  ```
178
182
 
179
183
  ## Development
@@ -41,6 +41,10 @@ module Scalingo
41
41
  public_send(name || config.default_region)
42
42
  end
43
43
 
44
+ def database_region(name = nil)
45
+ public_send(name || "db_api_#{config.default_region}")
46
+ end
47
+
44
48
  ## Authentication helpers / Token management
45
49
  def authenticate_with(access_token: nil, bearer_token: nil, expires_at: nil)
46
50
  if !access_token && !bearer_token
@@ -102,5 +106,8 @@ module Scalingo
102
106
  def_delegator :region, :notifiers
103
107
  def_delegator :region, :operations
104
108
  def_delegator :region, :scm_repo_links
109
+
110
+ def_delegator :database_region, :databases
111
+ def_delegator :database_region, :backups
105
112
  end
106
113
  end
@@ -12,7 +12,7 @@ module Scalingo
12
12
  &block
13
13
  )
14
14
 
15
- unpack { response }
15
+ unpack(:database_backup) { response }
16
16
  end
17
17
 
18
18
  def for(addon_id, headers = nil, &block)
@@ -1,3 +1,3 @@
1
1
  module Scalingo
2
- VERSION = "3.2.0"
2
+ VERSION = "3.3.0"
3
3
  end
@@ -18,13 +18,15 @@
18
18
  "Referrer-Policy": "strict-origin-when-cross-origin"
19
19
  },
20
20
  "json_body": {
21
- "id": "5b8b36104ffb090be1ac3ce1",
22
- "created_at": "2019-07-18T03:00:00.178+02:00",
23
- "name": "20180902010000_kibana-3938",
24
- "size": 0,
25
- "status": "pending",
26
- "database_id": "597601234ffb097af4f3099b",
27
- "type": "postgresql"
21
+ "database_backup": {
22
+ "id": "5b8b36104ffb090be1ac3ce1",
23
+ "created_at": "2019-07-18T03:00:00.178+02:00",
24
+ "name": "20180902010000_kibana-3938",
25
+ "size": 0,
26
+ "status": "pending",
27
+ "database_id": "597601234ffb097af4f3099b",
28
+ "type": "postgresql"
29
+ }
28
30
  }
29
31
  }
30
32
  }
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Scalingo::CoreClient do
4
+ subject { described_class.new }
5
+
6
+ describe "#database_region" do
7
+ it "forwards call to the specified region" do
8
+ allow(subject).to receive("db_api_osc_secnum_fr1")
9
+
10
+ subject.database_region("db_api_osc_secnum_fr1")
11
+
12
+ expect(subject).to have_received("db_api_osc_secnum_fr1")
13
+ end
14
+
15
+ it "forwards call to default db_api region" do
16
+ allow(subject).to receive("db_api_#{subject.config.default_region}")
17
+
18
+ subject.database_region
19
+
20
+ expect(subject).to have_received("db_api_#{subject.config.default_region}")
21
+ end
22
+ end
23
+ end
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.2.0
4
+ version: 3.3.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: 2022-12-23 00:00:00.000000000 Z
12
+ date: 2023-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -443,6 +443,7 @@ files:
443
443
  - spec/scalingo/billing_spec.rb
444
444
  - spec/scalingo/client_spec.rb
445
445
  - spec/scalingo/configuration_spec.rb
446
+ - spec/scalingo/core_client_spec.rb
446
447
  - spec/scalingo/regional/addons_spec.rb
447
448
  - spec/scalingo/regional/apps_spec.rb
448
449
  - spec/scalingo/regional/autoscalers_spec.rb
@@ -486,7 +487,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
486
487
  - !ruby/object:Gem::Version
487
488
  version: '0'
488
489
  requirements: []
489
- rubygems_version: 3.3.26
490
+ rubygems_version: 3.4.1
490
491
  signing_key:
491
492
  specification_version: 4
492
493
  summary: Ruby client for Scalingo APIs
@@ -505,6 +506,7 @@ test_files:
505
506
  - spec/scalingo/billing_spec.rb
506
507
  - spec/scalingo/client_spec.rb
507
508
  - spec/scalingo/configuration_spec.rb
509
+ - spec/scalingo/core_client_spec.rb
508
510
  - spec/scalingo/regional/addons_spec.rb
509
511
  - spec/scalingo/regional/apps_spec.rb
510
512
  - spec/scalingo/regional/autoscalers_spec.rb