Class: CtdDocumentation::InsightsController

Inherits:
BaseController show all
Defined in:
lib/ctd_documentation/controllers/insights_controller.rb

Overview

InsightsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from CtdDocumentation::BaseController

Instance Method Details

#get_insight_details_by_name(insight_name, format: 'insight_page', page: 1, per_page: 10, site_id__exact: 1, ghost__exact: false, special_hint__exact: nil, insight_status__exact: nil) ⇒ void

This method returns an undefined value.

In order to retrieve all the assets associated with a specific Insight: Step 2 (Step1 is in ‘Get Insights Summary’ endpoint):

  1. Enter (paste) the insight name from above into the insight_name field

  2. Apply the relevant site number in the site_id__exact field

  3. Click Execute

  4. From the Response Body, Select the FILTER_KEY

  5. Copy the string of the FILTER_KEY

  6. Find further instructions in /ranger/assets

per page Site related to the Insight not this is a ghost asset: TRUE = Ghost Example: The status of the Insight associated with this Asset – this is a dropdown for choosing the integer type: 0 = Open 1 = Hidden 2 = Completed

Parameters:

  • insight_name (String)

    Required parameter: Example:

  • format (String) (defaults to: 'insight_page')

    Optional parameter: Example:insight_page

  • page (Integer) (defaults to: 1)

    Optional parameter: The actual page offset

  • per_page (Integer) (defaults to: 10)

    Optional parameter: Number of Insights to pull

  • site_id__exact (Integer) (defaults to: 1)

    Optional parameter: The identifier of the

  • ghost__exact (TrueClass|FalseClass) (defaults to: false)

    Optional parameter: Whether or

  • special_hint__exact (SpecialHintExactEnum) (defaults to: nil)

    Optional parameter:

  • insight_status__exact (InsightStatusExact1Enum) (defaults to: nil)

    Optional parameter:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/ctd_documentation/controllers/insights_controller.rb', line 84

def get_insight_details_by_name(insight_name,
                                format: 'insight_page',
                                page: 1,
                                per_page: 10,
                                site_id__exact: 1,
                                ghost__exact: false,
                                special_hint__exact: nil,
                                insight_status__exact: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/ranger/insight_details/{insight_name}',
                                 Server::DEFAULT)
               .template_param(new_parameter(insight_name, key: 'insight_name')
                                .should_encode(true))
               .query_param(new_parameter(format, key: 'format'))
               .query_param(new_parameter(page, key: 'page'))
               .query_param(new_parameter(per_page, key: 'per_page'))
               .query_param(new_parameter(site_id__exact, key: 'site_id__exact'))
               .query_param(new_parameter(ghost__exact, key: 'ghost__exact'))
               .query_param(new_parameter(special_hint__exact, key: 'special_hint__exact'))
               .query_param(new_parameter(insight_status__exact, key: 'insight_status__exact'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .is_response_void(true))
    .execute
end

#get_insights_summary(format, sort, content_type, page: 1, per_page: 50, site_id__exact: 1, ghost__exact: false, special_hint__exact: nil, insight_status__exact: nil) ⇒ void

This method returns an undefined value.

In order to retrieve all the assets associated with a specific Insight Step 1:

  1. Apply the relevant site number in the site_id__exact field

  2. Click “Try It Out”

  3. From the Response body, select the insight of interest, e.g. Assets

Accessed SMB shares

  1. Copy the string of the insight name e.g. “Assets Accessed SMB shares”

  2. Find further instructions in ‘Get Insight Details by Name’ API endpoint

per page Site related to the Insight not this is a ghost asset: TRUE = Ghost Example: The status of the Insight associated with this Asset – this is a dropdown for choosing the integer type: 0 = Open 1 = Hidden 2 = Completed

Parameters:

  • format (String)

    Required parameter: Example:

  • sort (String)

    Required parameter: Example:

  • content_type (ContentTypeEnum)

    Required parameter: Example:

  • page (Integer) (defaults to: 1)

    Optional parameter: The actual page offset

  • per_page (Integer) (defaults to: 50)

    Optional parameter: Number of Insights to pull

  • site_id__exact (Integer) (defaults to: 1)

    Optional parameter: The identifier of the

  • ghost__exact (TrueClass|FalseClass) (defaults to: false)

    Optional parameter: Whether or

  • special_hint__exact (SpecialHintExactEnum) (defaults to: nil)

    Optional parameter:

  • insight_status__exact (InsightStatusExact1Enum) (defaults to: nil)

    Optional parameter:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ctd_documentation/controllers/insights_controller.rb', line 33

def get_insights_summary(format,
                         sort,
                         content_type,
                         page: 1,
                         per_page: 50,
                         site_id__exact: 1,
                         ghost__exact: false,
                         special_hint__exact: nil,
                         insight_status__exact: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/ranger/insights_summary',
                                 Server::DEFAULT)
               .query_param(new_parameter(format, key: 'format'))
               .query_param(new_parameter(sort, key: 'sort'))
               .header_param(new_parameter(content_type, key: 'Content-Type'))
               .query_param(new_parameter(page, key: 'page'))
               .query_param(new_parameter(per_page, key: 'per_page'))
               .query_param(new_parameter(site_id__exact, key: 'site_id__exact'))
               .query_param(new_parameter(ghost__exact, key: 'ghost__exact'))
               .query_param(new_parameter(special_hint__exact, key: 'special_hint__exact'))
               .query_param(new_parameter(insight_status__exact, key: 'insight_status__exact'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .is_response_void(true))
    .execute
end