Class: Verizon::CampaignsV3Controller

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

Overview

CampaignsV3Controller

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

#cancel_campaign(acc, campaign_id) ⇒ FotaV3SuccessResult

This endpoint allows user to cancel a firmware campaign. A firmware campaign already started can not be cancelled. information.

Parameters:

  • acc (String)

    Required parameter: Account identifier.

  • campaign_id (String)

    Required parameter: Firmware upgrade

Returns:



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/campaigns_v3_controller.rb', line 140

def cancel_campaign(acc,
                    campaign_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/campaigns/{acc}/{campaignId}',
                                 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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(FotaV3SuccessResult.method(:from_hash))
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV3ResultException))
    .execute
end

#get_campaign_information(acc, campaign_id) ⇒ Campaign

This endpoint allows the user to retrieve campaign level information for a specified campaign. identifier.

Parameters:

  • acc (String)

    Required parameter: Account identifier.

  • campaign_id (String)

    Required parameter: Firmware upgrade

Returns:

  • (Campaign)

    response from the API call



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

def get_campaign_information(acc,
                             campaign_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/campaigns/{acc}/{campaignId}',
                                 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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(Campaign.method(:from_hash))
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV3ResultException))
    .execute
end

#schedule_campaign_firmware_upgrade(acc, body) ⇒ FirmwareCampaign

This endpoint allows a user to schedule a firmware upgrade for a list of devices. information.

Parameters:

  • acc (String)

    Required parameter: Account identifier.

  • body (CampaignFirmwareUpgrade)

    Required parameter: Firmware upgrade

Returns:



15
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/campaigns_v3_controller.rb', line 15

def schedule_campaign_firmware_upgrade(acc,
                                       body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/campaigns/firmware/{acc}',
                                 Server::SOFTWARE_MANAGEMENT_V3)
               .template_param(new_parameter(acc, key: 'acc')
                                .should_encode(true))
               .header_param(new_parameter('application/json', 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(FirmwareCampaign.method(:from_hash))
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV3ResultException))
    .execute
end

#update_campaign_dates(acc, campaign_id, body) ⇒ FirmwareCampaign

This endpoint allows user to change campaign dates and time windows. Fields which need to remain unchanged should be also provided. information. and time windows.

Parameters:

  • acc (String)

    Required parameter: Account identifier.

  • campaign_id (String)

    Required parameter: Firmware upgrade

  • body (V3ChangeCampaignDatesRequest)

    Required parameter: New dates

Returns:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/verizon/controllers/campaigns_v3_controller.rb', line 80

def update_campaign_dates(acc,
                          campaign_id,
                          body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/campaigns/firmware/{acc}/{campaignId}/dates',
                                 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))
               .header_param(new_parameter('application/json', 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(FirmwareCampaign.method(:from_hash))
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV3ResultException))
    .execute
end

#update_campaign_firmware_devices(acc, campaign_id, body) ⇒ V3AddOrRemoveDeviceResult

This endpoint allows user to Add or Remove devices to an existing campaign. campaign. device to existing upgrade information.

Parameters:

  • acc (String)

    Required parameter: Account identifier.

  • campaign_id (String)

    Required parameter: Unique identifier of a

  • body (V3AddOrRemoveDeviceRequest)

    Required parameter: Add or remove

Returns:



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

def update_campaign_firmware_devices(acc,
                                     campaign_id,
                                     body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/campaigns/firmware/{acc}/{campaignId}',
                                 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))
               .header_param(new_parameter('application/json', 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(V3AddOrRemoveDeviceResult.method(:from_hash))
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV3ResultException))
    .execute
end