Class: Heroku::Api::Postgres::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku/api/postgres/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



23
24
25
# File 'lib/heroku/api/postgres/client.rb', line 23

def initialize
  @api_host = 'https://postgres-api.heroku.com'
end

Instance Attribute Details

#api_hostObject

Returns the value of attribute api_host.



21
22
23
# File 'lib/heroku/api/postgres/client.rb', line 21

def api_host
  @api_host
end

#api_keyObject

Returns the value of attribute api_key.



21
22
23
# File 'lib/heroku/api/postgres/client.rb', line 21

def api_key
  @api_key
end

#heroku_clientObject

Returns the value of attribute heroku_client.



21
22
23
# File 'lib/heroku/api/postgres/client.rb', line 21

def heroku_client
  @heroku_client
end

#oauth_client_keyObject

Returns the value of attribute oauth_client_key.



21
22
23
# File 'lib/heroku/api/postgres/client.rb', line 21

def oauth_client_key
  @oauth_client_key
end

Instance Method Details

#backupsObject



27
28
29
# File 'lib/heroku/api/postgres/client.rb', line 27

def backups
  @backups ||= Backups.new(self)
end

#credentialsObject



35
36
37
# File 'lib/heroku/api/postgres/client.rb', line 35

def credentials
  @credentials ||= Credentials.new(self)
end

#databasesObject



31
32
33
# File 'lib/heroku/api/postgres/client.rb', line 31

def databases
  @databases ||= Databases.new(self)
end

#perform_get_request(path, options = {}) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/heroku/api/postgres/client.rb', line 39

def perform_get_request(path, options = {})
  url = build_uri(path, **options)
  req = Net::HTTP::Get.new(url)
  add_auth_headers(req)
  response = start_request(req, url)
  parse_response(response)
end

#perform_post_request(path, params = {}, options = {}) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/heroku/api/postgres/client.rb', line 47

def perform_post_request(path, params = {}, options = {})
  url = build_uri(path, **options)
  req = Net::HTTP::Post.new(url)
  add_auth_headers(req)
  req.body = params.to_json
  response = start_request(req, url)
  parse_response(response)
end