heroku-api-postgres 0.12.0 → 0.13.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: 33fc320b5b73a7a140e6af276b8f7f69b9ae4ef97170edf19e462fab253991db
4
- data.tar.gz: 14d7757c4b7a78e5f9a5cc7da37143c808d83622374fd333303eebedeecbe5b5
3
+ metadata.gz: 96105ebed19f8f800dfb2dc71a8ce22d58feac51f07e7ea6963b64558c7eaea9
4
+ data.tar.gz: 34aea14eb3bf6b0639f3f66f93b9a42862e564e8d106b4c1de7fa8fb00c2561c
5
5
  SHA512:
6
- metadata.gz: bfaaa61d427515bec615afb3bc59dfe7950238654e497e9784fd6965a0bc4b5ca2fec3a9388648644fa94d7f9dd7a1bbee4e2c05b47f02bbc115fe965262beef
7
- data.tar.gz: 5503f7c5feda7c5cddbad119efccba8370e2a90117ffa30101f90317871c04cb501b715febbdf1f3e215788d3850d0e888434b261c7605a0f39fa56386f8ac23
6
+ metadata.gz: 9006afb4de11724c4f3b57fb9ecb19cc09b51361cdc1dd9d157fd3123f339f83321bbc8be1ce9f2dc1ee17d2398ca9f23edbe67cec940caa1b8a63bd262568cb
7
+ data.tar.gz: 80e566c5ee325a112cec56a3af719ef996759482f165122b059d743389dbf1292b0f30c41d2c70f1625fa09a678778f80f3eca54240fe47c05ff55cdaa527911
@@ -0,0 +1,23 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+
6
+ jobs:
7
+ lint:
8
+ runs-on: ubuntu-24.04
9
+ steps:
10
+ - name: Checkout code
11
+ uses: actions/checkout@v4
12
+
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 3.2
17
+ bundler-cache: true
18
+
19
+ - name: Setup env variables
20
+ run: cp .example.env .env
21
+
22
+ - name: Tests
23
+ run: bin/check
data/.rubocop.yml CHANGED
@@ -1,7 +1,11 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+
1
5
  Style/Documentation:
2
6
  Enabled: false
3
7
 
4
- Metrics/LineLength:
8
+ Layout/LineLength:
5
9
  Max: 120
6
10
 
7
11
  Metrics/BlockLength:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.3
1
+ 3.2.7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.13.0
2
+
3
+ * Update of dependencies and minimum ruby version set to 3.2.7. ([@coorasse][])
4
+ * Allow to connect using an API Key. ([@coorasse][])
5
+
1
6
  ## 0.12.0
2
7
 
3
8
  * [#18](https://github.com/coorasse/heroku-api-postgres/pull/18): Support ruby 3.0. ([@louism517][])
@@ -8,3 +13,4 @@
8
13
  [@avokhmin]: https://github.com/avokhmin
9
14
  [@deepakmahakale]: https://github.com/deepakmahakale
10
15
  [@louism517]: https://github.com/louism517
16
+ [@coorasse]: https://github.com/coorasse
data/Gemfile CHANGED
@@ -6,3 +6,12 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  # Specify your gem's dependencies in heroku-api-postgres.gemspec
8
8
  gemspec
9
+
10
+ gem 'bundler', '~> 2'
11
+ gem 'dotenv'
12
+ gem 'pry'
13
+ gem 'rake', '~> 13.0'
14
+ gem 'rspec', '~> 3.0'
15
+ gem 'rubocop', '1.74.0'
16
+ gem 'vcr', '~> 6.3'
17
+ gem 'webmock', '~> 3.25'
data/README.md CHANGED
@@ -7,9 +7,6 @@
7
7
  Ruby library to invoke Heroku Postgres APIs.
8
8
  An extension to the official [Platform API](https://github.com/heroku/platform-api) gem to introduce the missing APIs for Postgres.
9
9
 
10
- [![Build Status](https://travis-ci.org/coorasse/heroku-api-postgres.svg?branch=master)](https://travis-ci.org/coorasse/heroku-api-postgres)
11
- [![Maintainability](https://api.codeclimate.com/v1/badges/4eead5d8263c37498953/maintainability)](https://codeclimate.com/github/coorasse/heroku-api-postgres/maintainability)
12
-
13
10
  **This gem is not officialy supported**. We use the same APIs that the offical Heroku Toolbelt uses,
14
11
  therefore is unrealistic that a breaking change in the APIs would break it, since it means it would break
15
12
  both this gem and the official Heroku CLI.
@@ -40,7 +37,12 @@ Or install it yourself as:
40
37
  ## Usage
41
38
 
42
39
  This gem client needs to be instantiated in a similar way to the [PlatformAPI](https://github.com/heroku/platform-api).
43
- You can use the same oauth key that you use for the PlatformAPI.
40
+ You can use the same oauth key or API key that you use for the PlatformAPI.
41
+
42
+ ```ruby
43
+ postgres_api_client = Heroku::Api::Postgres.connect(ENV['HEROKU_API_KEY'])
44
+ ```
45
+
44
46
 
45
47
  ```ruby
46
48
  postgres_api_client = Heroku::Api::Postgres.connect_oauth(ENV['HEROKU_OAUTH_TOKEN'])
@@ -113,6 +115,9 @@ The app_id can be either the name of your heroku app or the id.
113
115
 
114
116
  [Check official API](https://devcenter.heroku.com/articles/platform-api-reference#app)
115
117
 
118
+ To retrieve the APP_ID and DATABASE_ID needed to run the tests you can use the name of the app as APP_ID and execute:
119
+ `heroku addons --json --app YOUR_APP` to retrieve the DATABASE_ID.
120
+
116
121
  ---
117
122
 
118
123
  ```ruby
@@ -209,14 +214,7 @@ and push the `.gem` file to [rubygems.org](https://rubygems.org).
209
214
  ## Contributing
210
215
 
211
216
  Bug reports and pull requests are welcome on GitHub at https://github.com/coorasse/heroku-api-postgres.
212
- This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
213
- the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
214
217
 
215
218
  ## License
216
219
 
217
220
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
218
-
219
- ## Code of Conduct
220
-
221
- Everyone interacting in the `Heroku::Api::Postgres` project’s codebases, issue trackers, chat rooms and mailing lists is
222
- expected to follow the [code of conduct](https://github.com/coorasse/heroku-api-postgres/blob/master/CODE_OF_CONDUCT.md).
@@ -15,25 +15,20 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = 'https://github.com/coorasse/heroku-api-postgres'
16
16
  spec.license = 'MIT'
17
17
 
18
- spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = "https://github.com/coorasse/heroku-api-postgres"
20
- spec.metadata["changelog_uri"] = "https://github.com/coorasse/heroku-api-postgres/blob/main/CHANGELOG.md"
21
- spec.metadata["funding_uri"] = "https://github.com/sponsors/coorasse"
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://github.com/coorasse/heroku-api-postgres'
20
+ spec.metadata['changelog_uri'] = 'https://github.com/coorasse/heroku-api-postgres/blob/main/CHANGELOG.md'
21
+ spec.metadata['funding_uri'] = 'https://github.com/sponsors/coorasse'
22
22
 
23
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
24
24
  f.match(%r{^(test|spec|features)/})
25
25
  end
26
26
  spec.bindir = 'exe'
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
+ spec.required_ruby_version = '>= 3.2.0'
29
30
 
30
31
  spec.add_dependency 'platform-api'
31
- spec.add_development_dependency 'bundler', '~> 1.17'
32
- spec.add_development_dependency 'dotenv'
33
- spec.add_development_dependency 'pry'
34
- spec.add_development_dependency 'rake', '~> 13.0'
35
- spec.add_development_dependency 'rspec', '~> 3.0'
36
- spec.add_development_dependency 'rubocop', '0.60.0'
37
- spec.add_development_dependency 'vcr', '~> 4.0.0'
38
- spec.add_development_dependency 'webmock', '~> 3.3.0'
32
+
33
+ spec.metadata['rubygems_mfa_required'] = 'true'
39
34
  end
@@ -35,9 +35,9 @@ module Heroku
35
35
  schedule_name: 'DATABASE_URL' }, host: db_host(app_id, database_id))
36
36
  end
37
37
 
38
- def capture(app_id, database_id)
38
+ def capture(app_id, database_id, options = {})
39
39
  @client.perform_post_request("/client/v11/databases/#{database_id}/backups",
40
- {},
40
+ options,
41
41
  host: db_host(app_id, database_id))
42
42
  end
43
43
 
@@ -3,20 +3,28 @@
3
3
  module Heroku
4
4
  module Api
5
5
  module Postgres
6
- def self.connect_oauth(oauth_client_key = ENV['HEROKU_OAUTH_TOKEN'])
7
- Client.new(oauth_client_key)
6
+ def self.connect(api_key = ENV.fetch('HEROKU_API_KEY', nil))
7
+ Client.new.tap do |c|
8
+ c.api_key = api_key
9
+ c.heroku_client = PlatformAPI.connect(api_key)
10
+ end
11
+ end
12
+
13
+ def self.connect_oauth(oauth_client_key = ENV.fetch('HEROKU_OAUTH_TOKEN', nil))
14
+ Client.new.tap do |c|
15
+ c.oauth_client_key = oauth_client_key
16
+ c.heroku_client = PlatformAPI.connect_oauth(oauth_client_key)
17
+ end
8
18
  end
9
19
 
10
20
  class Client
11
21
  STARTER_HOST = 'https://postgres-starter-api.heroku.com'
12
22
  PRO_HOST = 'https://postgres-api.heroku.com'
13
23
 
14
- attr_reader :oauth_client_key, :heroku_client
24
+ attr_accessor :api_key, :oauth_client_key, :heroku_client
15
25
 
16
- def initialize(oauth_client_key)
17
- @oauth_client_key = oauth_client_key
26
+ def initialize
18
27
  @basic_url = STARTER_HOST
19
- @heroku_client = PlatformAPI.connect_oauth(oauth_client_key)
20
28
  end
21
29
 
22
30
  def backups
@@ -3,7 +3,7 @@
3
3
  module Heroku
4
4
  module Api
5
5
  module Postgres
6
- VERSION = '0.12.0'
6
+ VERSION = '0.13.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-api-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Rodi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-23 00:00:00.000000000 Z
11
+ date: 2025-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: platform-api
@@ -24,118 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.17'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.17'
41
- - !ruby/object:Gem::Dependency
42
- name: dotenv
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '13.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '13.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.0'
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 0.60.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 0.60.0
111
- - !ruby/object:Gem::Dependency
112
- name: vcr
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 4.0.0
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 4.0.0
125
- - !ruby/object:Gem::Dependency
126
- name: webmock
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 3.3.0
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 3.3.0
139
27
  description: Ruby library to invoke Heroku Postgres APIs
140
28
  email:
141
29
  - coorasse@gmail.com
@@ -145,15 +33,13 @@ extra_rdoc_files: []
145
33
  files:
146
34
  - ".example.env"
147
35
  - ".github/FUNDING.yml"
36
+ - ".github/workflows/ci.yml"
148
37
  - ".gitignore"
149
38
  - ".rspec"
150
39
  - ".rubocop.yml"
151
40
  - ".ruby-version"
152
- - ".travis.yml"
153
41
  - CHANGELOG.md
154
- - CODE_OF_CONDUCT.md
155
42
  - Gemfile
156
- - LICENSE.txt
157
43
  - README.md
158
44
  - Rakefile
159
45
  - bin/check
@@ -176,6 +62,7 @@ metadata:
176
62
  source_code_uri: https://github.com/coorasse/heroku-api-postgres
177
63
  changelog_uri: https://github.com/coorasse/heroku-api-postgres/blob/main/CHANGELOG.md
178
64
  funding_uri: https://github.com/sponsors/coorasse
65
+ rubygems_mfa_required: 'true'
179
66
  post_install_message:
180
67
  rdoc_options: []
181
68
  require_paths:
@@ -184,14 +71,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
71
  requirements:
185
72
  - - ">="
186
73
  - !ruby/object:Gem::Version
187
- version: '0'
74
+ version: 3.2.0
188
75
  required_rubygems_version: !ruby/object:Gem::Requirement
189
76
  requirements:
190
77
  - - ">="
191
78
  - !ruby/object:Gem::Version
192
79
  version: '0'
193
80
  requirements: []
194
- rubygems_version: 3.3.10
81
+ rubygems_version: 3.4.19
195
82
  signing_key:
196
83
  specification_version: 4
197
84
  summary: Ruby library to invoke Heroku Postgres APIs
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1
6
- before_script:
7
- - cp .example.env .env
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at alessandro.rodi@renuo.ch. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Alessandro Rodi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.