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) ⇒ ApiResponse

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:

  • acc (String)

    Required parameter: Account identifier.

  • distribution_type (String)

    Required parameter: Filter the

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



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(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .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) ⇒ ApiResponse

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:

  • acc (String)

    Required parameter: Account identifier.

  • fileupload (File | UploadIO) (defaults to: nil)

    Optional parameter: The file to

  • file_version (String) (defaults to: nil)

    Optional parameter: Version of the file.

  • make (String) (defaults to: nil)

    Optional parameter: The software-applicable device

  • model (String) (defaults to: nil)

    Optional parameter: The software-applicable device

  • local_target_path (String) (defaults to: nil)

    Optional parameter: Local target path on

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



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(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .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