heroku-api-postgres 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 994386180c6760b3296b0dca9340a474d4fbe82ff098520a21f901726b19f1f5
4
- data.tar.gz: 3e007bb67207195fb2146c65413e9295815db7751f76ff853dcca6a4e96da424
3
+ metadata.gz: c7a09cc3fbeffddb666ebaf4aea6bcbaba6484444324fea9a9e1ebae90cdd60d
4
+ data.tar.gz: 37b4d464d7aa946682746bd681d249b734c25c7af135765a5918f1d602871b5b
5
5
  SHA512:
6
- metadata.gz: f3a8cdfddbfcc463f30058487aa1dcaa271245b169e2f558de0e689e287c3bc57dda924ed77c88d151c7282a5392270d1d0cdbdf314efc13fa6d7d7747579a14
7
- data.tar.gz: 94b4d88e580171e0edefc346207cc8e5a48fb47259c2e1930b49275cc4cdc1e0527c6cd75f542221085c97d49b9e9e065d51d4c39358515c4022a8eec2475097
6
+ metadata.gz: c993332ae8a356df764756757fcedf7d49aa434c8798272ace192615efe69df3af8e02ecc7e7d0d0ea6f9f44ca5a83d77ec1acaef728f3a8ab24e1ee3270bf0b
7
+ data.tar.gz: 0cf779f3a5dc93ce0b908d1cdc02e086fae30c993d71b1c5020ae2ab27f4ca22f11832ee2e71e2a2e7dcc3ecb9acca33fb90358ddfec769e623f97cda2e2607e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- heroku-api-postgres (0.7.0)
4
+ heroku-api-postgres (0.8.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -39,7 +39,6 @@ Even if this gem does not require `platform-api` to be installed, you probably w
39
39
  ```ruby
40
40
  # from platform api gem
41
41
  platform_api_client = PlatformAPI.connect_oauth(ENV['HEROKU_OAUTH_TOKEN'])
42
-
43
42
  ```
44
43
 
45
44
  this gem client needs to be instantiated as well in a similar way
@@ -51,28 +50,29 @@ postgres_api_client = Heroku::Api::Postgres.connect_oauth(ENV['HEROKU_OAUTH_TOKE
51
50
  Look into [Models](docs/models.rb) for a detailed description of the JSON objects returned by the APIs.
52
51
  Those are the bare objects returned by the official Heroku API.
53
52
 
54
- #### Wait
53
+ ### Databases
55
54
 
56
55
  ```ruby
57
- databases = postgres_api_client.wait(database_id, wait_interval: 5)
56
+ databases_client = postgres_api_client.databases
58
57
  ```
59
58
 
60
- Waits for the given database to be ready. Polls every `wait_interval` seconds (default 3).
61
-
62
-
63
- ### Databases
59
+ ---
64
60
 
65
61
  ```ruby
66
- databases_client = postgres_api_client.database
62
+ database_info = databases_client.info(database_id)
67
63
  ```
68
64
 
69
- #### Info
65
+ returns a [Database](docs/models.md#database).
66
+
67
+ ---
70
68
 
71
69
  ```ruby
72
- database_info = databases_client.info(database_id)
70
+ database = postgres_api_client.databases.wait(database_id, wait_interval: 5)
73
71
  ```
72
+ Waits for the given database to be ready.
73
+
74
+ Polls every `wait_interval` seconds (default 3).
74
75
 
75
- returns a [Database](docs/models.md#database).
76
76
 
77
77
  ### Backups
78
78
 
@@ -80,7 +80,7 @@ returns a [Database](docs/models.md#database).
80
80
  backups_client = postgres_api_client.backups
81
81
  ```
82
82
 
83
- #### Info
83
+ ---
84
84
 
85
85
  ```ruby
86
86
  backups = backups_client.info(app_id, backup_id)
@@ -88,7 +88,7 @@ backups = backups_client.info(app_id, backup_id)
88
88
 
89
89
  returns a [Backup](docs/models.md#backup).
90
90
 
91
- #### List
91
+ ---
92
92
 
93
93
  ```ruby
94
94
  backups = backups_client.list(app_id)
@@ -100,15 +100,17 @@ The app_id can be either the name of your heroku app or the id.
100
100
 
101
101
  [Check official API](https://devcenter.heroku.com/articles/platform-api-reference#app)
102
102
 
103
- #### Schedules
103
+ ---
104
104
 
105
105
  ```ruby
106
106
  schedules = backups_client.schedules(database_id)
107
107
  ```
108
108
 
109
- returns an array of [Schedule](docs/models.md#schedule)
109
+ Returns all the backup schedules associated with the database.
110
110
 
111
- ### Schedule
111
+ Returns an array of [Schedule](docs/models.md#schedule)
112
+
113
+ ---
112
114
 
113
115
  ```ruby
114
116
  schedule = backups_client.schedule(database_id)
@@ -118,25 +120,33 @@ Schedules the backups at 00:00 UTC.
118
120
 
119
121
  Returns a [Schedule](docs/models.md#schedule)
120
122
 
123
+ ---
121
124
 
122
- #### Capture
123
- Captures a new backup for the given database
124
125
 
125
126
  ```ruby
126
127
  backup = backups_client.capture(database_id)
127
128
  ```
129
+ Captures a new backup for the given database
128
130
 
129
- returns a [Backup](docs/models.md#backup)
131
+ Returns a [Backup](docs/models.md#backup)
130
132
 
131
- #### Url
133
+
134
+ ```ruby
135
+ backup_url = backups_client.url(app_id, backup_num)
136
+ ```
132
137
  Returns a temporary, public accessible URL to download a backup.
133
138
  Needs the `num` attribute of a Backup.
134
139
 
140
+ Returns a [BackupUrl](docs/models.md#backup_url)
141
+
142
+ ---
143
+
135
144
  ```ruby
136
- backup_url = backups_client.url(app_id, backup_num)
145
+ backup = postgres_api_client.backups.wait(app_id, backup_id, wait_interval: 5)
137
146
  ```
147
+ Waits for the given backup to be ready.
138
148
 
139
- returns a [BackupUrl](docs/models.md#backup_url)
149
+ Polls every `wait_interval` seconds (default 3).
140
150
 
141
151
 
142
152
  ### How do I get the database_id ?
@@ -38,6 +38,16 @@ module Heroku
38
38
  def url(app_id, backup_num)
39
39
  @client.perform_post_request("/client/v11/apps/#{app_id}/transfers/#{backup_num}/actions/public-url")
40
40
  end
41
+
42
+ def wait(app_id, backup_id, options = { wait_interval: 3 })
43
+ waiting = true
44
+ while waiting do
45
+ backup = info(app_id, backup_id)
46
+ break if backup[:finished_at] && backup[:succeeded]
47
+ sleep(options[:wait_interval])
48
+ end
49
+ backup
50
+ end
41
51
  end
42
52
  end
43
53
  end
@@ -11,18 +11,6 @@ module Heroku
11
11
  @basic_url = 'https://postgres-starter-api.heroku.com'
12
12
  end
13
13
 
14
- # original call returns simply a database object, therefore I call the info API.
15
- # perform_get_request "/client/v11/databases/#{database_id}/wait_status"
16
- def wait(database_id, options = { wait_interval: 3 })
17
- waiting = true
18
- while waiting do
19
- database = databases.info(database_id)
20
- break unless database[:waiting?]
21
- sleep(options[:wait_interval])
22
- end
23
- database
24
- end
25
-
26
14
  def backups
27
15
  @backups ||= Backups.new(self)
28
16
  end
@@ -9,6 +9,18 @@ module Heroku
9
9
  @client = client
10
10
  end
11
11
 
12
+ # original call returns simply a database object, therefore I call the info API.
13
+ # perform_get_request "/client/v11/databases/#{database_id}/wait_status"
14
+ def wait(database_id, options = { wait_interval: 3 })
15
+ waiting = true
16
+ while waiting do
17
+ database = info(database_id)
18
+ break unless database[:waiting?]
19
+ sleep(options[:wait_interval])
20
+ end
21
+ database
22
+ end
23
+
12
24
  def info(database_id)
13
25
  @client.perform_get_request("/client/v11/databases/#{database_id}")
14
26
  end
@@ -1,7 +1,7 @@
1
1
  module Heroku
2
2
  module Api
3
3
  module Postgres
4
- VERSION = '0.7.0'.freeze
4
+ VERSION = '0.8.0'.freeze
5
5
  end
6
6
  end
7
7
  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.7.0
4
+ version: 0.8.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: 2018-03-06 00:00:00.000000000 Z
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler