Class: Verizon::CampaignsV2Controller
- Inherits:
-
BaseController
- Object
- BaseController
- Verizon::CampaignsV2Controller
- Defined in:
- lib/verizon/controllers/campaigns_v2_controller.rb
Overview
CampaignsV2Controller
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
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 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(account, campaign_id) ⇒ ApiResponse
This endpoint allows user to cancel software upgrade. A software upgrade already started can not be cancelled. campaign.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/verizon/controllers/campaigns_v2_controller.rb', line 104 def cancel_campaign(account, campaign_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/campaigns/{account}/{campaignId}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .should_encode(true)) .template_param(new_parameter(campaign_id, key: 'campaignId') .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.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/verizon/controllers/campaigns_v2_controller.rb', line 42 def get_campaign_information(account, campaign_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/campaigns/{account}/{campaignId}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .should_encode(true)) .template_param(new_parameter(campaign_id, key: 'campaignId') .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 |
# File 'lib/verizon/controllers/campaigns_v2_controller.rb', line 14 def schedule_campaign_firmware_upgrade(account, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/campaigns/{account}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .should_encode(true)) .header_param(new_parameter('*/*', 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(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.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/verizon/controllers/campaigns_v2_controller.rb', line 166 def schedule_file_upgrade(acc, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/campaigns/files/{acc}', Server::SOFTWARE_MANAGEMENT_V2) .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(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.
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/verizon/controllers/campaigns_v2_controller.rb', line 195 def schedule_sw_upgrade_http_devices(acc, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/campaigns/software/{acc}', Server::SOFTWARE_MANAGEMENT_V2) .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(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.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/verizon/controllers/campaigns_v2_controller.rb', line 134 def update_campaign_dates(account, campaign_id, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/campaigns/{account}/{campaignId}/dates', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .should_encode(true)) .template_param(new_parameter(campaign_id, key: 'campaignId') .should_encode(true)) .header_param(new_parameter('*/*', 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(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.
72 73 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/campaigns_v2_controller.rb', line 72 def update_campaign_firmware_devices(account, campaign_id, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/campaigns/{account}/{campaignId}', Server::SOFTWARE_MANAGEMENT_V2) .template_param(new_parameter(account, key: 'account') .should_encode(true)) .template_param(new_parameter(campaign_id, key: 'campaignId') .should_encode(true)) .header_param(new_parameter('*/*', 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(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 |