class Wechat::ShakeAround::DeviceGroupRelation
Device Group Relation 是管理 iBeacon 设备与设备分组关系的封装类。
Public Class Methods
create(access_token, device_id, group_id)
click to toggle source
Return hash format if success: {
data: {}, errcode: 0, errmsg: 'success.'
}
device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }. 每个分组能够持有的设备上限为10000,并且每次添加操作的添加上限为1000。
# File lib/wechat/shake_around/device_group_relation.rb, line 48 def self.create(access_token, device_id, group_id) assert_present! :access_token, access_token assert_present! :device_id, device_id assert_present! :group_id, group_id device_identifier = normalize_device_id device_id post_json "https://api.weixin.qq.com/shakearound/device/group/adddevice?access_token=#{access_token}", body: { group_id: group_id.to_i, device_identifiers: [ device_identifier ] } end
destroy(access_token, device_id, group_id)
click to toggle source
Return hash format if success: {
data: {}, errcode: 0, errmsg: 'success.'
}
device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }.
# File lib/wechat/shake_around/device_group_relation.rb, line 21 def self.destroy(access_token, device_id, group_id) assert_present! :access_token, access_token assert_present! :device_id, device_id assert_present! :group_id, group_id device_identifier = normalize_device_id device_id post_json "https://api.weixin.qq.com/shakearound/device/group/deletedevice?access_token=#{access_token}", body: { group_id: group_id.to_i, device_identifiers: [ device_identifier ] } end