Class: Verizon::CampaignsV3Controller
- Inherits:
-
BaseController
- Object
- BaseController
- Verizon::CampaignsV3Controller
- Defined in:
- lib/verizon/controllers/campaigns_v3_controller.rb
Overview
CampaignsV3Controller
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#cancel_campaign(account_name, campaign_id) ⇒ ApiResponse
This endpoint allows user to cancel a firmware campaign.
-
#get_campaign_information(account_name, campaign_id) ⇒ ApiResponse
This endpoint allows the user to retrieve campaign level information for a specified campaign.
-
#schedule_campaign_firmware_upgrade(account_name, body) ⇒ ApiResponse
This endpoint allows a user to schedule a firmware upgrade for a list of devices.
-
#update_campaign_dates(acc, campaign_id, body) ⇒ ApiResponse
This endpoint allows user to change campaign dates and time windows.
-
#update_campaign_firmware_devices(acc, campaign_id, body) ⇒ ApiResponse
This endpoint allows user to Add or Remove devices to an existing campaign.
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_name, campaign_id) ⇒ ApiResponse
This endpoint allows user to cancel a firmware campaign. A firmware campaign already started can not be cancelled. information.
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(account_name, campaign_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/campaigns/{accountName}/{campaignId}', Server::SOFTWARE_MANAGEMENT_V3) .template_param(new_parameter(account_name, key: 'accountName') .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(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.
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(account_name, campaign_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/campaigns/{accountName}/{campaignId}', Server::SOFTWARE_MANAGEMENT_V3) .template_param(new_parameter(account_name, key: 'accountName') .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(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.
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(account_name, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/campaigns/firmware/{accountName}', Server::SOFTWARE_MANAGEMENT_V3) .template_param(new_parameter(account_name, key: 'accountName') .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(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.
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(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.
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(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 |