Class: Verizon::CampaignsV2Api
- Defined in:
- lib/verizon/apis/campaigns_v2_api.rb
Overview
CampaignsV2Api
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#cancel_campaign(account, campaign_id) ⇒ ApiResponse
This endpoint allows user to cancel software upgrade.
-
#get_campaign_information(account, campaign_id) ⇒ ApiResponse
This endpoint allows user to get information of a software upgrade.
-
#schedule_campaign_firmware_upgrade(account, body) ⇒ ApiResponse
This endpoint allows user to schedule a software upgrade.
-
#schedule_file_upgrade(acc, body) ⇒ ApiResponse
You can upload configuration files and schedule them in a campaign to devices.
-
#schedule_sw_upgrade_http_devices(acc, body) ⇒ ApiResponse
Campaign time windows for downloading and installing software are available as long as the device OEM supports this.
-
#update_campaign_dates(account, campaign_id, body) ⇒ ApiResponse
This endpoint allows user to change campaign dates and time windows.
-
#update_campaign_firmware_devices(account, campaign_id, body) ⇒ ApiResponse
This endpoint allows user to Add or Remove devices to an existing software upgrade.
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, campaign_id) ⇒ ApiResponse
This endpoint allows user to cancel software upgrade. A software upgrade already started can not be cancelled. campaign.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/verizon/apis/campaigns_v2_api.rb', line 111 def cancel_campaign(account, campaign_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/campaigns/{account}/{campaignId}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .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(FotaV2SuccessResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error.', FotaV2ResultException)) .execute end |
#get_campaign_information(account, campaign_id) ⇒ ApiResponse
This endpoint allows user to get information of a software upgrade. identifier.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/verizon/apis/campaigns_v2_api.rb', line 44 def get_campaign_information(account, campaign_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/campaigns/{account}/{campaignId}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .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(CampaignSoftware.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error.', FotaV2ResultException)) .execute end |
#schedule_campaign_firmware_upgrade(account, body) ⇒ ApiResponse
This endpoint allows user to schedule a software upgrade. information.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/verizon/apis/campaigns_v2_api.rb', line 14 def schedule_campaign_firmware_upgrade(account, body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/campaigns/{account}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, 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(CampaignSoftware.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error.', FotaV2ResultException)) .execute end |
#schedule_file_upgrade(acc, body) ⇒ ApiResponse
You can upload configuration files and schedule them in a campaign to devices. logging information.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/verizon/apis/campaigns_v2_api.rb', line 178 def schedule_file_upgrade(acc, body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/campaigns/files/{acc}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(acc, key: 'acc') .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(UploadAndScheduleFileResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error.', FotaV2ResultException)) .execute end |
#schedule_sw_upgrade_http_devices(acc, body) ⇒ ApiResponse
Campaign time windows for downloading and installing software are available as long as the device OEM supports this. logging information.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/verizon/apis/campaigns_v2_api.rb', line 209 def schedule_sw_upgrade_http_devices(acc, body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/campaigns/software/{acc}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(acc, key: 'acc') .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(UploadAndScheduleFileResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error.', FotaV2ResultException)) .execute end |
#update_campaign_dates(account, 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.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/verizon/apis/campaigns_v2_api.rb', line 143 def update_campaign_dates(account, campaign_id, body) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/campaigns/{account}/{campaignId}/dates', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .is_required(true) .should_encode(true)) .template_param(new_parameter(campaign_id, key: 'campaignId') .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(CampaignSoftware.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error.', FotaV2ResultException)) .execute end |
#update_campaign_firmware_devices(account, campaign_id, body) ⇒ ApiResponse
This endpoint allows user to Add or Remove devices to an existing software upgrade. information. add or remove device to existing software upgrade information.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/verizon/apis/campaigns_v2_api.rb', line 76 def update_campaign_firmware_devices(account, campaign_id, body) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/campaigns/{account}/{campaignId}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .is_required(true) .should_encode(true)) .template_param(new_parameter(campaign_id, key: 'campaignId') .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(V2AddOrRemoveDeviceResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error.', FotaV2ResultException)) .execute end |