Class: ApiConnectClient::Application

Inherits:
Base
  • Object
show all
Defined in:
lib/api_connect_client/application.rb

Instance Method Summary collapse

Constructor Details

#initialize(org_id, user, pass) ⇒ Application

Returns a new instance of Application.



3
4
5
6
7
# File 'lib/api_connect_client/application.rb', line 3

def initialize(org_id, user, pass)
  super()
  @headers = { 'X-IBM-APIManagement-Context': ApiConnectClient::Config.context }
  @owner = { id: org_id, username: user, password: pass }
end

Instance Method Details

#allObject



9
10
11
# File 'lib/api_connect_client/application.rb', line 9

def all
  get("/orgs/#{@owner[:id]}/apps", @owner[:username], @owner[:password])
end

#create(body) ⇒ Object



13
14
15
# File 'lib/api_connect_client/application.rb', line 13

def create(body)
  post("/orgs/#{@owner[:id]}/apps", body, @owner[:username], @owner[:password])
end

#list_subscriptions(app_id) ⇒ Object



37
38
39
# File 'lib/api_connect_client/application.rb', line 37

def list_subscriptions(app_id)
  get("/orgs/#{@owner[:id]}/apps/#{app_id}/subscriptions", @owner[:username], @owner[:password])
end

#remove(app_id) ⇒ Object



21
22
23
# File 'lib/api_connect_client/application.rb', line 21

def remove(app_id)
  delete("/orgs/#{@owner[:id]}/apps/#{app_id}", @owner[:username], @owner[:password])
end

#show(app_id) ⇒ Object



17
18
19
# File 'lib/api_connect_client/application.rb', line 17

def show(app_id)
  get("/orgs/#{@owner[:id]}/apps/#{app_id}", @owner[:username], @owner[:password])
end

#subscribe(app_id, body) ⇒ Object



33
34
35
# File 'lib/api_connect_client/application.rb', line 33

def subscribe(app_id, body)
  post("/orgs/#{@owner[:id]}/apps/#{app_id}/subscriptions", body, @owner[:username], @owner[:password])
end

#unsubscribe(app_id, subscription_id) ⇒ Object



41
42
43
# File 'lib/api_connect_client/application.rb', line 41

def unsubscribe(app_id, subscription_id)
  delete("/orgs/#{@owner[:id]}/apps/#{app_id}/subscriptions/#{subscription_id}", @owner[:username], @owner[:password])
end

#update(app_id, body) ⇒ Object



25
26
27
# File 'lib/api_connect_client/application.rb', line 25

def update(app_id, body)
  put("/orgs/#{@owner[:id]}/apps/#{app_id}", body, @owner[:username], @owner[:password])
end

#update_credentials(app_id, body) ⇒ Object



29
30
31
# File 'lib/api_connect_client/application.rb', line 29

def update_credentials(app_id, body)
  put("/orgs/#{@owner[:id]}/apps/#{app_id}/credentials", body, @owner[:username], @owner[:password])
end