Class: Verizon::DeviceGroupsController
- Inherits:
-
BaseController
- Object
- BaseController
- Verizon::DeviceGroupsController
- Defined in:
- lib/verizon/controllers/device_groups_controller.rb
Overview
DeviceGroupsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_device_group(body) ⇒ ConnectivityManagementSuccessResult
Create a new device group and optionally add devices to the group.
-
#delete_device_group(aname, gname) ⇒ ConnectivityManagementSuccessResult
Deletes a device group from the account.
-
#get_device_group_information(aname, gname, mnext: nil) ⇒ DeviceGroupDevicesData
When HTTP status is 202, a URL will be returned in the Location header of the form /groups/aname/name/gname/?next=token.
-
#list_device_groups(aname) ⇒ Array[DeviceGroup]
Returns a list of all device groups in a specified account.
-
#update_device_group(aname, gname, body) ⇒ ConnectivityManagementSuccessResult
Make changes to a device group, including changing the name and description, and adding or removing devices.
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_device_group(body) ⇒ ConnectivityManagementSuccessResult
Create a new device group and optionally add devices to the group. Device groups can make it easier to manage similar devices and to get reports on their usage. create a new device group.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/verizon/controllers/device_groups_controller.rb', line 15 def create_device_group(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/m2m/v1/groups', Server::THINGSPACE) .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(ConnectivityManagementSuccessResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Error response.', ConnectivityManagementResultException)) .execute end |
#delete_device_group(aname, gname) ⇒ ConnectivityManagementSuccessResult
Deletes a device group from the account. Devices in the group are moved to the default device group and are not deleted from the account.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/verizon/controllers/device_groups_controller.rb', line 128 def delete_device_group(aname, gname) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/m2m/v1/groups/{aname}/name/{gname}', Server::THINGSPACE) .template_param(new_parameter(aname, key: 'aname') .should_encode(true)) .template_param(new_parameter(gname, key: 'gname') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oAuth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ConnectivityManagementSuccessResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Error response.', ConnectivityManagementResultException)) .execute end |
#get_device_group_information(aname, gname, mnext: nil) ⇒ DeviceGroupDevicesData
When HTTP status is 202, a URL will be returned in the Location header of the form /groups/aname/name/gname/?next=token. This URL can be used to request the next set of groups. from the pageUrl pagetoken.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/verizon/controllers/device_groups_controller.rb', line 66 def get_device_group_information(aname, gname, mnext: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/m2m/v1/groups/{aname}/name/{gname}', Server::THINGSPACE) .template_param(new_parameter(aname, key: 'aname') .should_encode(true)) .template_param(new_parameter(gname, key: 'gname') .should_encode(true)) .query_param(new_parameter(mnext, key: 'next')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oAuth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(DeviceGroupDevicesData.method(:from_hash)) .is_api_response(true) .local_error('400', 'Error response.', ConnectivityManagementResultException)) .execute end |
#list_device_groups(aname) ⇒ Array[DeviceGroup]
Returns a list of all device groups in a specified account.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/verizon/controllers/device_groups_controller.rb', line 38 def list_device_groups(aname) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/m2m/v1/groups/{aname}', Server::THINGSPACE) .template_param(new_parameter(aname, key: 'aname') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oAuth2'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(DeviceGroup.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Error response.', ConnectivityManagementResultException)) .execute end |
#update_device_group(aname, gname, body) ⇒ ConnectivityManagementSuccessResult
Make changes to a device group, including changing the name and description, and adding or removing devices. update device group.
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 |
# File 'lib/verizon/controllers/device_groups_controller.rb', line 97 def update_device_group(aname, gname, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/m2m/v1/groups/{aname}/name/{gname}', Server::THINGSPACE) .template_param(new_parameter(aname, key: 'aname') .should_encode(true)) .template_param(new_parameter(gname, key: 'gname') .should_encode(true)) .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(ConnectivityManagementSuccessResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Error response.', ConnectivityManagementResultException)) .execute end |