Class: MistApi::MSPsTickets

Inherits:
BaseController show all
Defined in:
lib/mist_api/controllers/ms_ps_tickets.rb

Overview

MSPsTickets

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_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from MistApi::BaseController

Instance Method Details

#count_msp_tickets(msp_id, distinct: MspTicketsCountDistinctEnum::STATUS, limit: 100) ⇒ ApiResponse

Count by Distinct Attributes of tickets here Example:status

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • distinct (MspTicketsCountDistinctEnum) (defaults to: MspTicketsCountDistinctEnum::STATUS)

    Optional parameter:

  • limit (Integer) (defaults to: 100)

    Optional parameter: Example:100

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/mist_api/controllers/ms_ps_tickets.rb', line 65

def count_msp_tickets(msp_id,
                      distinct: MspTicketsCountDistinctEnum::STATUS,
                      limit: 100)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/tickets/count',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .query_param(new_parameter(distinct, key: 'distinct'))
               .query_param(new_parameter(limit, key: 'limit'))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ResponseCount.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Syntax',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             APIException)
                .local_error('403',
                             'Permission Denied',
                             APIException)
                .local_error('404',
                             'Not found. The API endpoint doesn’t exist or resource doesn’ t'\
                              ' exist',
                             APIException)
                .local_error('429',
                             'Too Many Request. The API Token used for the request reached'\
                              ' the 5000 API Calls per hour threshold',
                             APIException))
    .execute
end

#list_msp_tickets(msp_id, start: nil, mend: nil, duration: '1d') ⇒ ApiResponse

Get List of Tickets of a MSP here seconds, or relative string like “-1d”, “-1w”) seconds, or relative string like “-1d”, “-2h”, “now”)

Parameters:

  • msp_id (UUID | String)

    Required parameter: TODO: type description

  • start (String) (defaults to: nil)

    Optional parameter: Start time (epoch timestamp in

  • mend (String) (defaults to: nil)

    Optional parameter: End time (epoch timestamp in

  • duration (String) (defaults to: '1d')

    Optional parameter: Duration like 7d, 2w

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/mist_api/controllers/ms_ps_tickets.rb', line 18

def list_msp_tickets(msp_id,
                     start: nil,
                     mend: nil,
                     duration: '1d')
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/msps/{msp_id}/tickets',
                                 Server::API_HOST)
               .template_param(new_parameter(msp_id, key: 'msp_id')
                                .should_encode(true))
               .query_param(new_parameter(start, key: 'start'))
               .query_param(new_parameter(mend, key: 'end'))
               .query_param(new_parameter(duration, key: 'duration'))
               .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken'))))
    .response(new_response_handler
                .is_nullify404(true)
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Ticket.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Bad Syntax',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             APIException)
                .local_error('403',
                             'Permission Denied',
                             APIException)
                .local_error('404',
                             'Not found. The API endpoint doesn’t exist or resource doesn’ t'\
                              ' exist',
                             APIException)
                .local_error('429',
                             'Too Many Request. The API Token used for the request reached'\
                              ' the 5000 API Calls per hour threshold',
                             APIException))
    .execute
end