Class: Verizon::CampaignsV3Api

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

Overview

CampaignsV3Api

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

#cancel_campaign(account_name, campaign_id) ⇒ ApiResponse

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

Parameters:

  • account_name (String)

    Required parameter: Account identifier.

  • campaign_id (String)

    Required parameter: Firmware upgrade

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def cancel_campaign(,
                    campaign_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/campaigns/{accountName}/{campaignId}',
                                 Server::SOFTWARE_MANAGEMENT_V3)
               .template_param(new_parameter(, key: 'accountName')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignId')
                                .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(FotaV3SuccessResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV3ResultException))
    .execute
end

#get_campaign_information(account_name, campaign_id) ⇒ ApiResponse

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

Parameters:

  • account_name (String)

    Required parameter: Account identifier.

  • campaign_id (String)

    Required parameter: Firmware upgrade

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



120
121
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/campaigns_v3_api.rb', line 120

def get_campaign_information(,
                             campaign_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/campaigns/{accountName}/{campaignId}',
                                 Server::SOFTWARE_MANAGEMENT_V3)
               .template_param(new_parameter(, key: 'accountName')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignId')
                                .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(Campaign.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             FotaV3ResultException))
    .execute
end

#schedule_campaign_firmware_upgrade(account_name, body) ⇒ ApiResponse

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

Parameters:

  • account_name (String)

    Required parameter: Account identifier.

  • body (CampaignFirmwareUpgrade)

    Required parameter: Firmware upgrade

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



15
16
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/apis/campaigns_v3_api.rb', line 15

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

#update_campaign_dates(acc, campaign_id, body) ⇒ ApiResponse

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:

  • (ApiResponse)

    Complete http response with raw body and status code.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/verizon/apis/campaigns_v3_api.rb', line 85

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

#update_campaign_firmware_devices(acc, campaign_id, body) ⇒ ApiResponse

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:

  • (ApiResponse)

    Complete http response with raw body and status code.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/verizon/apis/campaigns_v3_api.rb', line 48

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