Class: Verizon::ConfigurationFilesController

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

Overview

ConfigurationFilesController

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

#get_list_of_files(acc, distribution_type) ⇒ RetrievesAvailableFilesResponseList

You can retrieve a list of configuration or supplementary of files for an account. distributionType to only retrieve files for a specific distribution type.

Parameters:

  • Required parameter: Account identifier.

  • Required parameter: Filter the

Returns:

  • response from the API call



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/verizon/controllers/configuration_files_controller.rb', line 16

def get_list_of_files(acc,
                      distribution_type)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/files/{acc}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(acc, key: 'acc')
                                .should_encode(true))
               .query_param(new_parameter(distribution_type, key: 'distributionType'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(RetrievesAvailableFilesResponseList.method(:from_hash))
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV2ResultException))
    .execute
end

#upload_config_file(acc, fileupload: nil, file_version: nil, make: nil, model: nil, local_target_path: nil) ⇒ UploadConfigurationFilesResponse

Uploads a configuration/supplementary file for an account. ThingSpace generates a fileName after the upload and is returned in the response. upload. make. model. the device.

Parameters:

  • Required parameter: Account identifier.

  • (defaults to: nil)

    Optional parameter: The file to

  • (defaults to: nil)

    Optional parameter: Version of the file.

  • (defaults to: nil)

    Optional parameter: The software-applicable device

  • (defaults to: nil)

    Optional parameter: The software-applicable device

  • (defaults to: nil)

    Optional parameter: Local target path on

Returns:

  • response from the API call



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
76
77
78
# File 'lib/verizon/controllers/configuration_files_controller.rb', line 50

def upload_config_file(acc,
                       fileupload: nil,
                       file_version: nil,
                       make: nil,
                       model: nil,
                       local_target_path: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/files/{acc}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(acc, key: 'acc')
                                .should_encode(true))
               .multipart_param(new_parameter(fileupload, key: 'fileupload')
                                 .default_content_type('application/octet-stream'))
               .form_param(new_parameter(file_version, key: 'fileVersion'))
               .form_param(new_parameter(make, key: 'make'))
               .form_param(new_parameter(model, key: 'model'))
               .form_param(new_parameter(local_target_path, key: 'localTargetPath'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(UploadConfigurationFilesResponse.method(:from_hash))
               .is_api_response(true)
               .local_error('400',
                            'Unexpected error.',
                            FotaV2ResultException))
    .execute
end