Class: Verizon::ClientLoggingApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/verizon/apis/client_logging_api.rb

Overview

ClientLoggingApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Verizon::BaseApi

Instance Method Details

#disable_device_logging(account, device_id) ⇒ ApiResponse

Disables logging for a specific device.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • device_id (String)

    Required parameter: Device IMEI identifier.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/verizon/apis/client_logging_api.rb', line 122

def disable_device_logging(,
                           device_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/logging/{account}/devices/{deviceId}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(device_id, key: 'deviceId')
                                .is_required(true)
                                .should_encode(true))
               .auth(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .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) ⇒ ApiResponse

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.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/verizon/apis/client_logging_api.rb', line 69

def disable_logging_for_devices(,
                                device_ids)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/logging/{account}/devices',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(device_ids, key: 'deviceIds')
                             .is_required(true))
               .auth(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .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) ⇒ ApiResponse

Enables logging for a specific device.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • device_id (String)

    Required parameter: Device IMEI identifier.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/verizon/apis/client_logging_api.rb', line 94

def enable_device_logging(,
                          device_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/logging/{account}/devices/{deviceId}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(device_id, key: 'deviceId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .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) ⇒ ApiResponse

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:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def enable_logging_for_devices(,
                               body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/logging/{account}/devices',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('*/*', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .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) ⇒ ApiResponse

Gets logs for a specific device.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • device_id (String)

    Required parameter: Device IMEI identifier.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/verizon/apis/client_logging_api.rb', line 148

def list_device_logs(,
                     device_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/logging/{account}/devices/{deviceId}/logs',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(device_id, key: 'deviceId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .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) ⇒ ApiResponse

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

Parameters:

  • account (String)

    Required parameter: Account identifier.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def list_devices_with_logging_enabled()
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/logging/{account}/devices',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .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