Class: Wechat::ShakeAround::DeviceGroupRelation
- Inherits:
-
Object
- Object
- Wechat::ShakeAround::DeviceGroupRelation
- Extended by:
- Core::Common, Common
- Defined in:
- lib/wechat/shake_around/device_group_relation.rb
Overview
Device Group Relation 是管理 iBeacon 设备与设备分组关系的封装类。
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:
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# 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) ⇒ Object
Return hash format if success: { data: {}, errcode: 0, errmsg: 'success.' }
device_id is an integer or a hash like { uuid:
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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 |