Class: Verizon::SoftwareManagementReportsV2Controller

Inherits:
BaseController
  • Object
show all
Defined in:
lib/verizon/controllers/software_management_reports_v2_controller.rb

Overview

SoftwareManagementReportsV2Controller

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

#get_campaign_device_status(account, campaign_id, last_seen_device_id: nil) ⇒ ApiResponse

The report endpoint allows user to get the full list of device of a campaign. identifier.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • campaign_id (String)

    Required parameter: Campaign identifier.

  • last_seen_device_id (String) (defaults to: nil)

    Optional parameter: Last seen device

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/verizon/controllers/software_management_reports_v2_controller.rb', line 135

def get_campaign_device_status(,
                               campaign_id,
                               last_seen_device_id: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reports/{account}/campaigns/{campaignId}/devices',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignId')
                                .should_encode(true))
               .query_param(new_parameter(last_seen_device_id, key: 'lastSeenDeviceId'))
               .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(V2CampaignDevice.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV2ResultException))
    .execute
end

#get_campaign_history_by_status(account, campaign_status, last_seen_campaign_id: nil) ⇒ ApiResponse

The report endpoint allows user to get campaign history of an account for specified status. campaign. campaign Id.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • campaign_status (String)

    Required parameter: Status of the

  • last_seen_campaign_id (String) (defaults to: nil)

    Optional parameter: Last seen

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/verizon/controllers/software_management_reports_v2_controller.rb', line 105

def get_campaign_history_by_status(,
                                   campaign_status,
                                   last_seen_campaign_id: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reports/{account}/campaigns',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .query_param(new_parameter(campaign_status, key: 'campaignStatus'))
               .query_param(new_parameter(last_seen_campaign_id, key: 'lastSeenCampaignId'))
               .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(V2CampaignHistory.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV2ResultException))
    .execute
end

#get_device_firmware_upgrade_history(account, device_id) ⇒ ApiResponse

The endpoint allows user to get software upgrade history of a device based on device IMEI.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • device_id (String)

    Required parameter: Device IMEI identifier.

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/verizon/controllers/software_management_reports_v2_controller.rb', line 74

def get_device_firmware_upgrade_history(,
                                        device_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reports/{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(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DeviceSoftwareUpgrade.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV2ResultException))
    .execute
end

#list_account_devices(account, last_seen_device_id: nil, distribution_type: nil) ⇒ ApiResponse

The device endpoint gets devices information of an account. identifier. distributionType to get specific type of devices. Values is LWM2M, OMD-DM or HTTP.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • last_seen_device_id (String) (defaults to: nil)

    Optional parameter: Last seen device

  • distribution_type (String) (defaults to: nil)

    Optional parameter: Filter

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/verizon/controllers/software_management_reports_v2_controller.rb', line 46

def (,
                         last_seen_device_id: nil,
                         distribution_type: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/devices/{account}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .query_param(new_parameter(last_seen_device_id, key: 'lastSeenDeviceId'))
               .query_param(new_parameter(distribution_type, key: 'distributionType'))
               .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(V2AccountDeviceList.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV2ResultException))
    .execute
end

#list_available_software(account, distribution_type: nil) ⇒ ApiResponse

This endpoint allows user to list a certain type of software of an account. distributionType to get specific type of software. Value is LWM2M, OMD-DM or HTTP.

Parameters:

  • account (String)

    Required parameter: Account identifier.

  • distribution_type (String) (defaults to: nil)

    Optional parameter: Filter

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/verizon/controllers/software_management_reports_v2_controller.rb', line 16

def list_available_software(,
                            distribution_type: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/software/{account}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .query_param(new_parameter(distribution_type, key: 'distributionType'))
               .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(SoftwarePackage.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV2ResultException))
    .execute
end