lib/wechat/shake_around/group.rb in wechat-shake_around-0.9.1 vs lib/wechat/shake_around/group.rb in wechat-shake_around-0.9.2

- old
+ new

@@ -1,10 +1,14 @@ +## +# Group 是 管理 iBeacon 设备分组的封装类。 + class Wechat::ShakeAround::Group extend Wechat::Core::Common extend Wechat::ShakeAround::Common + ## # 查询分组列表 # http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E6.9F.A5.E8.AF.A2.E5.88.86.E7.BB.84.E5.88.97.E8.A1.A8 # # Return hash format if success: # { @@ -28,18 +32,18 @@ # limit: 待查询的分组数量,不能超过1000个 def self.index(access_token, offset: 0, limit: 1000) assert_present! :access_token, access_token - message = post_json "https://api.weixin.qq.com/shakearound/device/group/getlist?access_token=#{access_token}", body: + post_json "https://api.weixin.qq.com/shakearound/device/group/getlist?access_token=#{access_token}", body: { begin: offset.to_i, count: limit.to_i } - message.body end + ## # 查询分组详情 # http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E6.9F.A5.E8.AF.A2.E5.88.86.E7.BB.84.E8.AF.A6.E6.83.85 # # Return hash format if success: # { @@ -71,19 +75,19 @@ def self.load(access_token, group_id, offset: 0, limit: 1000) assert_present! :access_token, access_token assert_present! :group_id, group_id - message = post_json "https://api.weixin.qq.com/shakearound/device/group/getdetail?access_token=#{access_token}", body: + post_json "https://api.weixin.qq.com/shakearound/device/group/getdetail?access_token=#{access_token}", body: { group_id: group_id.to_i, begin: offset.to_i, count: limit.to_i } - message.body end + ## # 删除分组 # http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E5.88.A0.E9.99.A4.E5.88.86.E7.BB.84 # # Return hash format if success: # { @@ -96,14 +100,17 @@ def self.destroy(access_token, group_id) assert_present! :access_token, access_token assert_present! :group_id, group_id - message = post_json "https://api.weixin.qq.com/shakearound/device/group/delete?access_token=#{access_token}", body: { group_id: group_id.to_i } - message.body + post_json "https://api.weixin.qq.com/shakearound/device/group/delete?access_token=#{access_token}", body: + { + group_id: group_id.to_i + } end + ## # 编辑分组信息 # http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E7.BC.96.E8.BE.91.E5.88.86.E7.BB.84.E4.BF.A1.E6.81.AF # # Return hash format if success: # { @@ -118,18 +125,18 @@ assert_present! :access_token, access_token assert_present! :group_id, group_id assert_present! :name, name - message = post_json "https://api.weixin.qq.com/shakearound/device/group/update?access_token=#{access_token}", body: + post_json "https://api.weixin.qq.com/shakearound/device/group/update?access_token=#{access_token}", body: { group_id: group_id.to_i, group_name: name } - message.body end + ## # 新增分组 # http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E6.96.B0.E5.A2.9E.E5.88.86.E7.BB.84 # # Return hash format if success: # { @@ -146,10 +153,12 @@ def self.create(access_token, name) assert_present! :access_token, access_token assert_present! :name, name - message = post_json "https://api.weixin.qq.com/shakearound/device/group/add?access_token=#{access_token}", body: { group_name: name } - message.body + post_json "https://api.weixin.qq.com/shakearound/device/group/add?access_token=#{access_token}", body: + { + group_name: name + } end end