Class: Verizon::ConfigurationFilesApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/verizon/apis/configuration_files_api.rb

Overview

ConfigurationFilesApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

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

#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)

    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
36
37
# File 'lib/verizon/apis/configuration_files_api.rb', line 16

def get_list_of_files(acc,
                      distribution_type)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/files/{acc}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(acc, key: 'acc')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(distribution_type, key: 'distributionType')
                             .is_required(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(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)

    Complete http response with raw body and status code.



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
79
80
81
# File 'lib/verizon/apis/configuration_files_api.rb', line 52

def upload_config_file(acc,
                       fileupload: nil,
                       file_version: nil,
                       make: nil,
                       model: nil,
                       local_target_path: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/files/{acc}',
                                 Server::SOFTWARE_MANAGEMENT_V2)
               .template_param(new_parameter(acc, key: 'acc')
                                .is_required(true)
                                .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