Class: Conversant::V3::Services::Portal::Dashboard

Inherits:
Object
  • Object
show all
Defined in:
lib/conversant/v3/services/portal/dashboard.rb

Overview

Dashboard service for Portal customer metadata and reporting

Provides access to customer-related metadata including product usage, geographic distribution, industry classification, and organizational hierarchy.

Since:

  • 1.0.8

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Dashboard

Initialize dashboard service

Parameters:

  • parent (Portal)

    the parent Portal service instance

Since:

  • 1.0.8



20
21
22
# File 'lib/conversant/v3/services/portal/dashboard.rb', line 20

def initialize(parent)
  @parent = parent
end

Instance Attribute Details

#parentPortal (readonly)

Returns the parent Portal service instance.

Returns:

  • (Portal)

    the parent Portal service instance

Since:

  • 1.0.8



15
16
17
# File 'lib/conversant/v3/services/portal/dashboard.rb', line 15

def parent
  @parent
end

Instance Method Details

#countriesArray<Hash>

Get list of countries

Retrieves the list of countries available in the system, typically used for filtering or categorizing customers by geographic location.

Examples:

Get all countries

countries = portal.dashboard.countries
countries.each { |country| puts "#{country['name']} (#{country['code']})" }

Returns:

  • (Array<Hash>)

    array of country data, or empty array on error

Since:

  • 1.0.8



61
62
63
64
65
66
67
# File 'lib/conversant/v3/services/portal/dashboard.rb', line 61

def countries
  response = @parent.send(:call, 'GET', '/getCountry')
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  []
end

#industriesArray<Hash>

Get list of industries

Retrieves the list of industry classifications available in the system, used for categorizing customers by business sector.

Examples:

Get all industries

industries = portal.dashboard.industries
industries.each { |industry| puts "#{industry['name']}" }

Returns:

  • (Array<Hash>)

    array of industry data, or empty array on error

Since:

  • 1.0.8



81
82
83
84
85
86
87
# File 'lib/conversant/v3/services/portal/dashboard.rb', line 81

def industries
  response = @parent.send(:call, 'GET', '/getIndustry')
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  []
end

#products(params = {}) ⇒ Hash

Get product usage report for a customer

Retrieves information about which products (CDN, LMS, VMS, OSS) the customer is using and their usage statistics.

Examples:

Get product report

report = portal.dashboard.products(customerId: "31723", _: Time.now.to_i * 1000)
puts "CDN enabled: #{report['cdn_enabled']}"

Parameters:

  • params (Hash) (defaults to: {})

    query parameters

Options Hash (params):

  • :customerId (String, Integer)

    customer ID

  • :_ (Integer)

    timestamp in milliseconds (for cache busting)

Returns:

  • (Hash)

    product report data, or empty hash on error

Since:

  • 1.0.8



40
41
42
43
44
45
46
47
# File 'lib/conversant/v3/services/portal/dashboard.rb', line 40

def products(params = {})
  query_string = params.map { |k, v| "#{k}=#{v}" }.join('&')
  response = @parent.send(:call, 'GET', "/getProductReport?#{query_string}")
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  {}
end

#tree_view(payload = {}) ⇒ Hash

Get customer organizational tree view

Retrieves the hierarchical organization structure showing parent-child relationships between customers, useful for partner/reseller views.

Examples:

Get customer tree

tree = portal.dashboard.tree_view
puts "Root customers: #{tree['children'].length}"

Parameters:

  • payload (Hash) (defaults to: {})

    tree view query parameters (optional)

Returns:

  • (Hash)

    tree structure data, or empty hash on error

Since:

  • 1.0.8



103
104
105
106
107
108
109
# File 'lib/conversant/v3/services/portal/dashboard.rb', line 103

def tree_view(payload = {})
  response = @parent.send(:call, 'POST', '/customer/tree_view/', payload)
  JSON.parse(response)
rescue StandardError => e
  @parent.send(:logger).error "#{@parent.send(:identifier)}.METHOD:#{__method__}.EXCEPTION:#{e.message}"
  {}
end