Class: Verizon::ClientLoggingController

Inherits:
BaseController show all
Defined in:
lib/verizon/controllers/client_logging_controller.rb

Overview

ClientLoggingController

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 Verizon::BaseController

Instance Method Details

#disable_device_logging(account, device_id) ⇒ void

This method returns an undefined value.

Disables logging for a specific device.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • device_id (String)

    Required parameter: Device IMEI identifier.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/verizon/controllers/client_logging_controller.rb', line 115

def disable_device_logging(,
                           device_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/logging/{account}/devices/{deviceId}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .template_param(new_parameter(device_id, key: 'deviceId')
                                .should_encode(true))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .is_response_void(true)
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV2ResultException))
    .execute
end

#disable_logging_for_devices(account, device_ids) ⇒ void

This method returns an undefined value.

Turn logging off for a list of devices.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • device_ids (String)

    Required parameter: The list of device IDs.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/verizon/controllers/client_logging_controller.rb', line 66

def disable_logging_for_devices(,
                                device_ids)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/logging/{account}/devices',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .query_param(new_parameter(device_ids, key: 'deviceIds'))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .is_response_void(true)
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV2ResultException))
    .execute
end

#enable_device_logging(account, device_id) ⇒ DeviceLoggingStatus

Enables logging for a specific device.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • device_id (String)

    Required parameter: Device IMEI identifier.

Returns:



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/verizon/controllers/client_logging_controller.rb', line 89

def enable_device_logging(,
                          device_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/logging/{account}/devices/{deviceId}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .template_param(new_parameter(device_id, key: 'deviceId')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(DeviceLoggingStatus.method(:from_hash))
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV2ResultException))
    .execute
end

#enable_logging_for_devices(account, body) ⇒ Array[DeviceLoggingStatus]

Each customer may have a maximum of 20 devices enabled for logging. information.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • body (DeviceLoggingRequest)

    Required parameter: Device logging

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/verizon/controllers/client_logging_controller.rb', line 38

def enable_logging_for_devices(,
                               body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/logging/{account}/devices',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .header_param(new_parameter('*/*', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(DeviceLoggingStatus.method(:from_hash))
               .is_api_response(true)
               .is_response_array(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV2ResultException))
    .execute
end

#list_device_logs(account, device_id) ⇒ Array[DeviceLog]

Gets logs for a specific device.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • device_id (String)

    Required parameter: Device IMEI identifier.

Returns:

  • (Array[DeviceLog])

    response from the API call



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/verizon/controllers/client_logging_controller.rb', line 139

def list_device_logs(,
                     device_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/logging/{account}/devices/{deviceId}/logs',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .template_param(new_parameter(device_id, key: 'deviceId')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(DeviceLog.method(:from_hash))
               .is_api_response(true)
               .is_response_array(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV2ResultException))
    .execute
end

#list_devices_with_logging_enabled(account) ⇒ Array[DeviceLoggingStatus]

Returns an array of all devices in the specified account for which logging is enabled.

Parameters:

  • account (String)

    Required parameter: Account identifier.

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/verizon/controllers/client_logging_controller.rb', line 13

def list_devices_with_logging_enabled()
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/logging/{account}/devices',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(DeviceLoggingStatus.method(:from_hash))
               .is_api_response(true)
               .is_response_array(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV2ResultException))
    .execute
end