Class: Verizon::TargetsApi

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

Overview

TargetsApi

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

#create_azure_central_io_t_application(billingaccount_id, body) ⇒ ApiResponse

Deploy a new Azure IoT Central application based on the Verizon ARM template within the specified Azure Active Directory account. of the authenticating billing account. body must include the UUID of the subscription that you want to update plus any properties that you want to change.

Parameters:

  • billingaccount_id (String)

    Required parameter: TThe ThingSpace ID

  • body (CreateIoTApplicationRequest)

    Required parameter: The request

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/verizon/apis/targets_api.rb', line 108

def create_azure_central_io_t_application(billingaccount_id,
                                          body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/targets/actions/newaic',
                                 Server::CLOUD_CONNECTOR)
               .header_param(new_parameter(billingaccount_id, key: 'BillingaccountID')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .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(CreateIoTApplicationResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#create_target(body) ⇒ ApiResponse

Define a target to receive data streams, alerts, or callbacks. After creating the target resource, use its ID in a subscription to set up a data stream. provides the details of the target that you want to create.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/verizon/apis/targets_api.rb', line 59

def create_target(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/targets',
                                 Server::CLOUD_CONNECTOR)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .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(Target.method(:from_hash))
                .is_api_response(true))
    .execute
end

#delete_target(body) ⇒ ApiResponse

Remove a target from a ThingSpace account. identifies the target to delete.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/verizon/apis/targets_api.rb', line 37

def delete_target(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/targets/actions/delete',
                                 Server::CLOUD_CONNECTOR)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('thingspace_oauth', 'VZ-M2M-Token')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end

#generate_target_external_id(body) ⇒ ApiResponse

Create a unique string that ThingSpace will pass to AWS for increased security. body only contains the authenticating account.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/verizon/apis/targets_api.rb', line 82

def generate_target_external_id(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/targets/actions/newextid',
                                 Server::CLOUD_CONNECTOR)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .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(GenerateExternalIdResult.method(:from_hash))
                .is_api_response(true))
    .execute
end

#query_target(body) ⇒ ApiResponse

Search for targets by property values. Returns an array of all matching target resources. property values.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/verizon/apis/targets_api.rb', line 14

def query_target(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/targets/actions/query',
                                 Server::CLOUD_CONNECTOR)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .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(Target.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true))
    .execute
end