Class: Verizon::SoftwareManagementReportsV3Controller

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

Overview

SoftwareManagementReportsV3Controller

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(acc, campaign_id, last_seen_device_id: nil) ⇒ ApiResponse

Retrieve a list of all devices in a campaign and the status of each device. identifier.

Parameters:

  • acc (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.



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

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

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

Retrieve a list of campaigns for an account that have a specified campaign status. status. campaign Id.

Parameters:

  • acc (String)

    Required parameter: Account identifier.

  • campaign_status (CampaignStatusEnum)

    Required parameter: Campaign

  • last_seen_campaign_id (String) (defaults to: nil)

    Optional parameter: Last seen

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



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

def get_campaign_history_by_status(acc,
                                   campaign_status,
                                   last_seen_campaign_id: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reports/{acc}/firmware/campaigns',
                                 Server::SOFTWARE_MANAGEMENT_V3)
               .template_param(new_parameter(acc, key: 'acc')
                                .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(V3CampaignHistory.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV3ResultException))
    .execute
end

#get_device_firmware_upgrade_history(acc, device_id) ⇒ ApiResponse

Retrieve campaign history for a specific device.

Parameters:

  • acc (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.



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

def get_device_firmware_upgrade_history(acc,
                                        device_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reports/{acc}/devices/{deviceId}',
                                 Server::SOFTWARE_MANAGEMENT_V3)
               .template_param(new_parameter(acc, key: 'acc')
                                .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(DeviceFirmwareUpgrade.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV3ResultException))
    .execute
end