Class: Verizon::AppConfigServiceApi
- Defined in:
- lib/verizon/apis/app_config_service_api.rb
Overview
AppConfigServiceApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#create_configuration(vendor_id, body) ⇒ ApiResponse
This endpoint creates a new configuration in the system.
-
#delete_configuration(vendor_id, id) ⇒ ApiResponse
This endpoint deletes a specific configuration from the system.
-
#get_configuration(id, vendor_id) ⇒ ApiResponse
This endpoint fetches and returns a specific configuration’s details.
-
#get_configuration_list(vendor_id) ⇒ ApiResponse
This endpoint fetches and returns the list of configurations defined by the Vendor.
-
#update_configuration(vendor_id, id, body) ⇒ ApiResponse
This endpoint updates an existing configuration.
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_configuration(vendor_id, body) ⇒ ApiResponse
This endpoint creates a new configuration in the system. The data for the new configuration should be provided as JSON in the body of the POST request. The system will return with a unique ID for the configuration, which is needed for any further manipulation (update or delete) of the configuration. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API. description here
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/verizon/apis/app_config_service_api.rb', line 97 def create_configuration(vendor_id, body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/application/configurations/geofence', Server::IMP_SERVER) .header_param(new_parameter(vendor_id, key: 'VendorID') .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', 'SessionToken'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GeoFenceConfigurationResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid configuration', AppConfigResponseErrorException) .local_error('403', 'Forbidden', AppConfigResponseErrorException) .local_error('429', 'Too many requests', AppConfigResponseErrorException) .local_error('default', 'unexpected error', AppConfigResponseErrorException)) .execute end |
#delete_configuration(vendor_id, id) ⇒ ApiResponse
This endpoint deletes a specific configuration from the system. It requires the configuration ID parameter, which was provided by the POST (create) operation. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API.
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/verizon/apis/app_config_service_api.rb', line 187 def delete_configuration(vendor_id, id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/v1/application/configurations/geofence', Server::IMP_SERVER) .header_param(new_parameter(vendor_id, key: 'VendorID') .is_required(true)) .query_param(new_parameter(id, key: 'id') .is_required(true)) .auth(And.new('thingspace_oauth', 'SessionToken'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('403', 'Forbidden', AppConfigResponseErrorException) .local_error('429', 'Too many requests', AppConfigResponseErrorException) .local_error('default', 'unexpected error', AppConfigResponseErrorException)) .execute end |
#get_configuration(id, vendor_id) ⇒ ApiResponse
This endpoint fetches and returns a specific configuration’s details. The configuration ID parameter, which was provided when the configuration was created through the POST request, is need to retrieve the configuration details. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API.
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 82 83 84 |
# File 'lib/verizon/apis/app_config_service_api.rb', line 55 def get_configuration(id, vendor_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/application/configurations/geofence', Server::IMP_SERVER) .query_param(new_parameter(id, key: 'id') .is_required(true)) .header_param(new_parameter(vendor_id, key: 'VendorID') .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(And.new('thingspace_oauth', 'SessionToken'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GeoFenceConfigurationResponse.method(:from_hash)) .is_api_response(true) .local_error('403', 'Forbidden', AppConfigResponseErrorException) .local_error('404', 'Configuration not found', AppConfigResponseErrorException) .local_error('429', 'Too many requests', AppConfigResponseErrorException) .local_error('default', 'unexpected error', AppConfigResponseErrorException)) .execute end |
#get_configuration_list(vendor_id) ⇒ ApiResponse
This endpoint fetches and returns the list of configurations defined by the Vendor. The list contains the configurations’ identifier, name, description, and active flag. The vendor ID is provided when the configuration is created through the POST request. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API.
17 18 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/app_config_service_api.rb', line 17 def get_configuration_list(vendor_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/application/configurations/geofence/ids', Server::IMP_SERVER) .header_param(new_parameter(vendor_id, key: 'VendorID') .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(And.new('thingspace_oauth', 'SessionToken'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ConfigurationListItem.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('403', 'Forbidden', AppConfigResponseErrorException) .local_error('404', 'Configuration not found', AppConfigResponseErrorException) .local_error('429', 'Too many requests', AppConfigResponseErrorException) .local_error('default', 'unexpected error', AppConfigResponseErrorException)) .execute end |
#update_configuration(vendor_id, id, body) ⇒ ApiResponse
This endpoint updates an existing configuration. Similar to POST, the updated data for the configuration should be provided as JSON in the body of the PUT request. The configuration ID parameter, which was provided by the POST (create) operation, is required to do any updates on the configuration. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API. type description here
142 143 144 145 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 171 172 173 174 175 176 177 |
# File 'lib/verizon/apis/app_config_service_api.rb', line 142 def update_configuration(vendor_id, id, body) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/api/v1/application/configurations/geofence', Server::IMP_SERVER) .header_param(new_parameter(vendor_id, key: 'VendorID') .is_required(true)) .query_param(new_parameter(id, key: 'id') .is_required(true)) .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', 'SessionToken'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('400', 'Invalid configuration', AppConfigResponseErrorException) .local_error('403', 'Forbidden', AppConfigResponseErrorException) .local_error('404', 'Configuration not found', AppConfigResponseErrorException) .local_error('429', 'Too many requests', AppConfigResponseErrorException) .local_error('default', 'unexpected error', AppConfigResponseErrorException)) .execute end |