Class: Verizon::ServiceProfilesApi

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

Overview

ServiceProfilesApi

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_service_profile(body) ⇒ ApiResponse

Creates a service profile that describes the resource requirements of a service. passes all of the needed parameters to create a service profile. Parameters will be edited here rather than the Parameters section above. The ‘maxLatencyMs` and `clientType` parameters are both required in the request body. Note: The `maxLatencyMs` value must be submitted in multiples of 5. Additionally, “GPU” is future functionality and the values are not captured.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/verizon/apis/service_profiles_api.rb', line 19

def create_service_profile(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/serviceprofiles',
                                 Server::EDGE_DISCOVERY)
               .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(CreateServiceProfileResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'HTTP 400 Bad Request.',
                             EdgeDiscoveryResultException)
                .local_error('401',
                             'HTTP 401 Unauthorized.',
                             EdgeDiscoveryResultException)
                .local_error('default',
                             'HTTP 500 Internal Server Error.',
                             EdgeDiscoveryResultException))
    .execute
end

#delete_service_profile(service_profile_id) ⇒ ApiResponse

Delete Service Profile based on unique service profile ID. description here

Parameters:

  • service_profile_id (String)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/verizon/apis/service_profiles_api.rb', line 146

def delete_service_profile(service_profile_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/serviceprofiles/{serviceProfileId}',
                                 Server::EDGE_DISCOVERY)
               .template_param(new_parameter(service_profile_id, key: 'serviceProfileId')
                                .is_required(true)
                                .should_encode(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(DeleteServiceProfileResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'HTTP 400 Bad Request.',
                             EdgeDiscoveryResultException)
                .local_error('401',
                             'HTTP 401 Unauthorized.',
                             EdgeDiscoveryResultException)
                .local_error('default',
                             'HTTP 500 Internal Server Error.',
                             EdgeDiscoveryResultException))
    .execute
end

#get_service_profile(service_profile_id) ⇒ ApiResponse

Returns a specified service profile. description here

Parameters:

  • service_profile_id (String)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/verizon/apis/service_profiles_api.rb', line 75

def get_service_profile(service_profile_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/serviceprofiles/{serviceProfileId}',
                                 Server::EDGE_DISCOVERY)
               .template_param(new_parameter(service_profile_id, key: 'serviceProfileId')
                                .is_required(true)
                                .should_encode(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(ResourcesServiceProfileWithId.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'HTTP 400 Bad Request.',
                             EdgeDiscoveryResultException)
                .local_error('401',
                             'HTTP 401 Unauthorized.',
                             EdgeDiscoveryResultException)
                .local_error('default',
                             'HTTP 500 Internal Server Error.',
                             EdgeDiscoveryResultException))
    .execute
end

#list_service_profilesApiResponse

List all service profiles registered under your API key.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/verizon/apis/service_profiles_api.rb', line 48

def list_service_profiles
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/serviceprofiles',
                                 Server::EDGE_DISCOVERY)
               .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(ListServiceProfilesResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'HTTP 400 Bad Request.',
                             EdgeDiscoveryResultException)
                .local_error('401',
                             'HTTP 401 Unauthorized.',
                             EdgeDiscoveryResultException)
                .local_error('default',
                             'HTTP 500 Internal Server Error.',
                             EdgeDiscoveryResultException))
    .execute
end

#update_service_profile(service_profile_id, body) ⇒ ApiResponse

Update the definition of a Service Profile. description here passes the rest of the needed parameters to create a service profile. The ‘maxLatencyMs` and `clientType` parameters are both required in the request body. Note: The `maxLatencyMs` value must be submitted in multiples of 5. Additionally, “GPU” is future functionality and the values are not captured. Default values to use are shown.

Parameters:

  • service_profile_id (String)

    Required parameter: TODO: type

  • body (ResourcesServiceProfile)

    Required parameter: The request body

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/verizon/apis/service_profiles_api.rb', line 111

def update_service_profile(service_profile_id,
                           body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/serviceprofiles/{serviceProfileId}',
                                 Server::EDGE_DISCOVERY)
               .template_param(new_parameter(service_profile_id, key: 'serviceProfileId')
                                .is_required(true)
                                .should_encode(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(UpdateServiceProfileResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'HTTP 400 Bad Request.',
                             EdgeDiscoveryResultException)
                .local_error('401',
                             'HTTP 401 Unauthorized.',
                             EdgeDiscoveryResultException)
                .local_error('default',
                             'HTTP 500 Internal Server Error.',
                             EdgeDiscoveryResultException))
    .execute
end