Class: Verizon::TargetsController

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

Overview

TargetsController

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

#create_azure_central_io_t_application(billingaccount_id, body) ⇒ CreateIoTApplicationResponse

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:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/verizon/controllers/targets_controller.rb', line 103

def create_azure_central_io_t_application(billingaccount_id,
                                          body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/targets/actions/newaic',
                                 Server::CLOUD_CONNECTOR)
               .header_param(new_parameter(billingaccount_id, key: 'BillingaccountID'))
               .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(Single.new('oAuth2')))
    .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) ⇒ Target

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:

  • (Target)

    response from the API call



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/verizon/controllers/targets_controller.rb', line 57

def create_target(body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/targets',
                                 Server::CLOUD_CONNECTOR)
               .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(Single.new('oAuth2')))
    .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) ⇒ void

This method returns an undefined value.

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

Parameters:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/verizon/controllers/targets_controller.rb', line 36

def delete_target(body)
  new_api_call_builder
    .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))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oAuth2')))
    .response(new_response_handler
               .is_response_void(true)
               .is_api_response(true))
    .execute
end

#generate_target_external_id(body) ⇒ GenerateExternalIDResult

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

Parameters:

Returns:



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/verizon/controllers/targets_controller.rb', line 79

def generate_target_external_id(body)
  new_api_call_builder
    .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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .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) ⇒ Array[Target]

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

Parameters:

Returns:

  • (Array[Target])

    response from the API call



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

def query_target(body)
  new_api_call_builder
    .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))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oAuth2')))
    .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