Class: Wechat::ShakeAround::DeviceGroupRelation
- Inherits:
-
Object
- Object
- Wechat::ShakeAround::DeviceGroupRelation
- Extended by:
- Common
- Defined in:
- lib/wechat/shake_around/device_group_relation.rb
Constant Summary
Constants included from Common
Class Method Summary collapse
- .create(access_token, device_id, group_id) ⇒ Object
- .destroy(access_token, device_id, group_id) ⇒ Object
Methods included from Common
normalize_date, normalize_device_id, normalize_page_ids
Class Method Details
.create(access_token, device_id, group_id) ⇒ Object
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。
40 41 42 43 44 45 46 47 48 |
# File 'lib/wechat/shake_around/device_group_relation.rb', line 40 def self.create(access_token, device_id, group_id) device_identifier = normalize_device_id device_id = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/group/adddevice?access_token=#{access_token}", { group_id: group_id.to_i, device_identifiers: [ device_identifier ] } .body end |
.destroy(access_token, device_id, group_id) ⇒ Object
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> }.
18 19 20 21 22 23 24 25 26 |
# File 'lib/wechat/shake_around/device_group_relation.rb', line 18 def self.destroy(access_token, device_id, group_id) device_identifier = normalize_device_id device_id = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/group/deletedevice?access_token=#{access_token}", { group_id: group_id.to_i, device_identifiers: [ device_identifier ] } .body end |