Class: Morpheus::DashboardInterface

Inherits:
APIClient
  • Object
show all
Defined in:
lib/morpheus/api/dashboard_interface.rb

Instance Method Summary collapse

Methods inherited from APIClient

#accounts, #app_templates, #apps, #clouds, #custom_instance_types, #deploy, #deployments, #groups, #instance_types, #instances, #key_pairs, #license, #load_balancers, #logs, #options, #provision_types, #roles, #security_group_rules, #security_groups, #servers, #task_sets, #tasks, #users, #virtual_images, #whoami

Constructor Details

#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ DashboardInterface

Returns a new instance of DashboardInterface.



5
6
7
8
9
10
# File 'lib/morpheus/api/dashboard_interface.rb', line 5

def initialize(access_token, refresh_token,expires_at = nil, base_url=nil) 
	@access_token = access_token
	@refresh_token = refresh_token
	@base_url = base_url
	@expires_at = expires_at
end

Instance Method Details

#dashboard(options = {}) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/morpheus/api/dashboard_interface.rb', line 16

def dashboard(options={})
  url = "#{@base_url}/api/dashboard"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  headers[:params].merge!(options)
  response = Morpheus::RestClient.execute(method: :get, url: url,
                          timeout: 30, headers: headers, verify_ssl: false)
  JSON.parse(response.to_s)
end

#get(options = {}) ⇒ Object



12
13
14
# File 'lib/morpheus/api/dashboard_interface.rb', line 12

def get(options={})
  dashboard(options)
end

#recent_activity(account_id = nil, options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/morpheus/api/dashboard_interface.rb', line 25

def recent_activity(=nil, options={})
  url = "#{@base_url}/api/dashboard/recentActivity"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  headers[:params].merge!(options)
  headers[:params]['accountId'] =  if 
  response = Morpheus::RestClient.execute(method: :get, url: url,
                          timeout: 10, headers: headers)
  JSON.parse(response.to_s)
end