wechat-shake_around 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +22 -7
- data/ROADMAP.md +15 -0
- data/lib/wechat/shake_around/apply.rb +9 -4
- data/lib/wechat/shake_around/beacon.rb +9 -6
- data/lib/wechat/shake_around/beacon_page_relation.rb +7 -4
- data/lib/wechat/shake_around/beacon_poi_relation.rb +5 -2
- data/lib/wechat/shake_around/common.rb +14 -0
- data/lib/wechat/shake_around/device_daily_report.rb +6 -4
- data/lib/wechat/shake_around/device_group_relation.rb +7 -4
- data/lib/wechat/shake_around/device_report.rb +7 -4
- data/lib/wechat/shake_around/group.rb +19 -10
- data/lib/wechat/shake_around/icon.rb +4 -0
- data/lib/wechat/shake_around/license.rb +4 -0
- data/lib/wechat/shake_around/material.rb +1 -0
- data/lib/wechat/shake_around/page.rb +21 -15
- data/lib/wechat/shake_around/page_daily_report.rb +7 -4
- data/lib/wechat/shake_around/page_report.rb +7 -4
- data/lib/wechat/shake_around/registration.rb +6 -2
- data/lib/wechat/shake_around/shaking.rb +2 -2
- data/lib/wechat/shake_around/version.rb +1 -1
- data/wechat-shake_around.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 177d0d75231fe203ef8084aa6d4c7f863ff04aa9
|
4
|
+
data.tar.gz: a61ac48aafdf927758b663349a4f1b5afc431efd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30cf08bf88ed8086c918fb9e7323cb565d7a4f5ac4d2aee50dd0e344b33f0bcf5d1a155592a4141b5d296806622888ca4a666969bb44dcf9b4295411af920745
|
7
|
+
data.tar.gz: 6b417f865f6143e6af63e5c7afa5256ea9a8784d3773c2e1108fc9259d6ab85abe59f5c218984eb27f5acae4699478b05ffe78d1d5e3f64712dd1790c099909d
|
data/CHANGELOG.md
CHANGED
@@ -53,3 +53,18 @@
|
|
53
53
|
15. Improve the Page Report wrapper class for the argument validation & HTTP request
|
54
54
|
16. Improve the Registration wrapper class for the argument validation & HTTP request
|
55
55
|
17. Improve the Shaking wrapper class for the argument validation & HTTP request
|
56
|
+
|
57
|
+
## v0.9.2
|
58
|
+
1. Improve the Apply wrapper class for the HTTP request
|
59
|
+
2. Improve the Beacon wrapper class for the HTTP request
|
60
|
+
3. Improve the Beacon Page Relation wrapper class for the HTTP request
|
61
|
+
4. Improve the Beacon PoI Relation wrapper class for the HTTP request
|
62
|
+
5. Improve the Device Daily Report wrapper class for the HTTP request
|
63
|
+
6. Improve the Device Group Relation wrapper class for the HTTP request
|
64
|
+
7. Improve the Device Report wrapper class for the HTTP request
|
65
|
+
8. Improve the Group wrapper class for the HTTP request
|
66
|
+
9. Improve the Page wrapper class for the HTTP request
|
67
|
+
10. Improve the Page Daily Report wrapper class for the HTTP request
|
68
|
+
11. Improve the Page Report wrapper class for the HTTP request
|
69
|
+
12. Improve the Registration wrapper class for the HTTP request
|
70
|
+
13. Improve the Shaking wrapper class for the HTTP request
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,29 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wechat-shake_around (0.9)
|
5
|
-
httpclient (
|
4
|
+
wechat-shake_around (0.9.1)
|
5
|
+
httpclient (~> 2.8)
|
6
|
+
wechat-core (~> 0.4)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
activesupport (5.0.2)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (~> 0.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
concurrent-ruby (1.0.5)
|
17
|
+
diff-lcs (1.3)
|
18
|
+
httpclient (2.8.3)
|
19
|
+
i18n (0.8.1)
|
20
|
+
minitest (5.10.1)
|
21
|
+
rake (11.3.0)
|
13
22
|
rspec (3.5.0)
|
14
23
|
rspec-core (~> 3.5.0)
|
15
24
|
rspec-expectations (~> 3.5.0)
|
16
25
|
rspec-mocks (~> 3.5.0)
|
17
|
-
rspec-core (3.5.
|
26
|
+
rspec-core (3.5.4)
|
18
27
|
rspec-support (~> 3.5.0)
|
19
28
|
rspec-expectations (3.5.0)
|
20
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -23,6 +32,12 @@ GEM
|
|
23
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
24
33
|
rspec-support (~> 3.5.0)
|
25
34
|
rspec-support (3.5.0)
|
35
|
+
thread_safe (0.3.6)
|
36
|
+
tzinfo (1.2.3)
|
37
|
+
thread_safe (~> 0.1)
|
38
|
+
wechat-core (0.4.1)
|
39
|
+
activesupport (>= 4.2)
|
40
|
+
httpclient (>= 2.8)
|
26
41
|
|
27
42
|
PLATFORMS
|
28
43
|
ruby
|
@@ -34,4 +49,4 @@ DEPENDENCIES
|
|
34
49
|
wechat-shake_around!
|
35
50
|
|
36
51
|
BUNDLED WITH
|
37
|
-
1.
|
52
|
+
1.13.6
|
data/ROADMAP.md
CHANGED
@@ -54,6 +54,21 @@
|
|
54
54
|
16. Improve the Registration wrapper class for the argument validation & HTTP request
|
55
55
|
17. Improve the Shaking wrapper class for the argument validation & HTTP request
|
56
56
|
|
57
|
+
## v0.9.2
|
58
|
+
1. Improve the Apply wrapper class for the HTTP request
|
59
|
+
2. Improve the Beacon wrapper class for the HTTP request
|
60
|
+
3. Improve the Beacon Page Relation wrapper class for the HTTP request
|
61
|
+
4. Improve the Beacon PoI Relation wrapper class for the HTTP request
|
62
|
+
5. Improve the Device Daily Report wrapper class for the HTTP request
|
63
|
+
6. Improve the Device Group Relation wrapper class for the HTTP request
|
64
|
+
7. Improve the Device Report wrapper class for the HTTP request
|
65
|
+
8. Improve the Group wrapper class for the HTTP request
|
66
|
+
9. Improve the Page wrapper class for the HTTP request
|
67
|
+
10. Improve the Page Daily Report wrapper class for the HTTP request
|
68
|
+
11. Improve the Page Report wrapper class for the HTTP request
|
69
|
+
12. Improve the Registration wrapper class for the HTTP request
|
70
|
+
13. Improve the Shaking wrapper class for the HTTP request
|
71
|
+
|
57
72
|
## v1.0
|
58
73
|
1. Improve the wrapper classes to support the Keyword Arguments
|
59
74
|
2. Improve the wrapper classes for argument validation
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Apply 是批量申请 iBeacon 设备 UUID 、 Major 和 Minor 的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::Apply
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 查询设备ID申请审核状态
|
7
11
|
# http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E6.9F.A5.E8.AF.A2.E8.AE.BE.E5.A4.87ID.E7.94.B3.E8.AF.B7.E5.AE.A1.E6.A0.B8.E7.8A.B6.E6.80.81
|
8
12
|
#
|
@@ -22,10 +26,10 @@ class Wechat::ShakeAround::Apply
|
|
22
26
|
assert_present! :access_token, access_token
|
23
27
|
assert_present! :apply_id, apply_id
|
24
28
|
|
25
|
-
|
26
|
-
message.body
|
29
|
+
post_json "https://api.weixin.qq.com/shakearound/device/applystatus?access_token=#{access_token}", body: { apply_id: apply_id.to_i }
|
27
30
|
end
|
28
31
|
|
32
|
+
##
|
29
33
|
# 申请设备ID
|
30
34
|
# http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E7.94.B3.E8.AF.B7.E8.AE.BE.E5.A4.87ID
|
31
35
|
#
|
@@ -53,8 +57,9 @@ class Wechat::ShakeAround::Apply
|
|
53
57
|
options = { quantity: quantity, apply_reason: reason }
|
54
58
|
options[:comment] = comment if comment.present?
|
55
59
|
options[:poi_id] = poi_id if poi_id.present?
|
56
|
-
|
57
|
-
|
60
|
+
|
61
|
+
post_json "https://api.weixin.qq.com/shakearound/device/applyid?access_token=#{access_token}", body: options
|
62
|
+
|
58
63
|
end
|
59
64
|
|
60
65
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Beacon 是管理 iBeacon 设备的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::Beacon
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 查询设备列表
|
7
11
|
# http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E6.9F.A5.E8.AF.A2.E8.AE.BE.E5.A4.87.E5.88.97.E8.A1.A8
|
8
12
|
#
|
@@ -41,10 +45,10 @@ class Wechat::ShakeAround::Beacon
|
|
41
45
|
else
|
42
46
|
options[:type] = 2
|
43
47
|
end
|
44
|
-
|
45
|
-
message.body
|
48
|
+
post_json "https://api.weixin.qq.com/shakearound/device/search?access_token=#{access_token}", body: options
|
46
49
|
end
|
47
50
|
|
51
|
+
##
|
48
52
|
# 查询设备
|
49
53
|
# http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E6.9F.A5.E8.AF.A2.E8.AE.BE.E5.A4.87.E5.88.97.E8.A1.A8
|
50
54
|
#
|
@@ -78,14 +82,14 @@ class Wechat::ShakeAround::Beacon
|
|
78
82
|
assert_present! :device_id, device_id
|
79
83
|
|
80
84
|
device_identifier = self.normalize_device_id device_id
|
81
|
-
|
85
|
+
post_json "https://api.weixin.qq.com/shakearound/device/search?access_token=#{access_token}", body:
|
82
86
|
{
|
83
87
|
type: 1,
|
84
88
|
device_identifiers: [ device_identifier ]
|
85
89
|
}
|
86
|
-
message.body
|
87
90
|
end
|
88
91
|
|
92
|
+
##
|
89
93
|
# 编辑设备信息
|
90
94
|
# http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E7.BC.96.E8.BE.91.E8.AE.BE.E5.A4.87.E4.BF.A1.E6.81.AF
|
91
95
|
#
|
@@ -104,12 +108,11 @@ class Wechat::ShakeAround::Beacon
|
|
104
108
|
assert_present! :comment, comment
|
105
109
|
|
106
110
|
device_identifier = self.normalize_device_id device_id
|
107
|
-
|
111
|
+
post_json "https://api.weixin.qq.com/shakearound/device/update?access_token=#{access_token}", body:
|
108
112
|
{
|
109
113
|
device_identifier: device_identifier,
|
110
114
|
comment: comment
|
111
115
|
}
|
112
|
-
message.body
|
113
116
|
end
|
114
117
|
|
115
118
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Beacon Page Relation 是管理 iBeacon 设备和页面之间关系的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::BeaconPageRelation
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 删除设备与页面的关联关系
|
7
11
|
# http://mp.weixin.qq.com/wiki/12/c8120214ec0ba08af5dfcc0da1a11400.html
|
8
12
|
#
|
@@ -26,16 +30,16 @@ class Wechat::ShakeAround::BeaconPageRelation
|
|
26
30
|
device_identifier = normalize_device_id device_id
|
27
31
|
page_ids = normalize_page_ids page_id
|
28
32
|
|
29
|
-
|
33
|
+
post_json "https://api.weixin.qq.com/shakearound/device/bindpage?access_token=#{access_token}", body:
|
30
34
|
{
|
31
35
|
device_identifier: device_identifier,
|
32
36
|
page_ids: page_ids,
|
33
37
|
bind: 0,
|
34
38
|
append: 0
|
35
39
|
}
|
36
|
-
message.body
|
37
40
|
end
|
38
41
|
|
42
|
+
##
|
39
43
|
# 创建设备与页面的关联关系
|
40
44
|
# http://mp.weixin.qq.com/wiki/12/c8120214ec0ba08af5dfcc0da1a11400.html
|
41
45
|
#
|
@@ -59,14 +63,13 @@ class Wechat::ShakeAround::BeaconPageRelation
|
|
59
63
|
device_identifier = normalize_device_id device_id
|
60
64
|
page_ids = normalize_page_ids page_id
|
61
65
|
|
62
|
-
|
66
|
+
post_json "https://api.weixin.qq.com/shakearound/device/bindpage?access_token=#{access_token}", body:
|
63
67
|
{
|
64
68
|
device_identifier: device_identifier,
|
65
69
|
page_ids: page_ids,
|
66
70
|
bind: 1,
|
67
71
|
append: 1
|
68
72
|
}
|
69
|
-
message.body
|
70
73
|
end
|
71
74
|
|
72
75
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Beacon Poi Relation 是管理 iBeacon 设备和入口 (PoI, Point of Interest) 之间关系的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::BeaconPoiRelation
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 配置设备与门店的关联关系
|
7
11
|
# http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E9.85.8D.E7.BD.AE.E8.AE.BE.E5.A4.87.E4.B8.8E.E9.97.A8.E5.BA.97.E7.9A.84.E5.85.B3.E8.81.94.E5.85.B3.E7.B3.BB
|
8
12
|
#
|
@@ -21,12 +25,11 @@ class Wechat::ShakeAround::BeaconPoiRelation
|
|
21
25
|
assert_present! :poi_id, poi_id
|
22
26
|
|
23
27
|
device_identifier = self.normalize_device_id device_id
|
24
|
-
|
28
|
+
post_json "https://api.weixin.qq.com/shakearound/device/bindlocation?access_token=#{access_token}", body:
|
25
29
|
{
|
26
30
|
device_identifier: device_identifier,
|
27
31
|
poi_id: poi_id.to_i
|
28
32
|
}
|
29
|
-
message.body
|
30
33
|
end
|
31
34
|
|
32
35
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
##
|
2
|
+
# Common 是公共模块。
|
3
|
+
|
1
4
|
module Wechat::ShakeAround::Common
|
2
5
|
|
3
6
|
# http://mp.weixin.qq.com/wiki/5/fe90761a540f6fe056c774ab3df8afe9.html
|
@@ -78,11 +81,22 @@ module Wechat::ShakeAround::Common
|
|
78
81
|
9001091 => '活动已过期'
|
79
82
|
}.freeze
|
80
83
|
|
84
|
+
##
|
85
|
+
# 将日期文本或者日期对象转换为秒数。如:
|
86
|
+
# Wechat::ShakeAround::Common.normalize_date '2000-01-01'
|
87
|
+
# 或者
|
88
|
+
# Wechat::ShakeAround::Common.normalize_date Date.today
|
81
89
|
def normalize_date(date)
|
82
90
|
date = Date.parse date if date.is_a? String
|
83
91
|
date.to_time.to_i
|
84
92
|
end
|
85
93
|
|
94
|
+
##
|
95
|
+
# 将 device_id 转换为 Hash 格式。如:
|
96
|
+
# Wechat::ShakeAround::Common.normalize_device_id '1234' # { device_id: '1234' }
|
97
|
+
# 或者
|
98
|
+
# Wechat::ShakeAround::Common.normalize_device_id { uuid: 'c1de0c84-5997-40ea-b3cc-c102ead33483', major: 123, minor: 456 }
|
99
|
+
# # { uuid: 'c1de0c84-5997-40ea-b3cc-c102ead33483', major: 123, minor: 456 }
|
86
100
|
def normalize_device_id(device_id)
|
87
101
|
device_id.is_a?(Hash) ? device_id : { device_id: device_id.to_i }
|
88
102
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Device Daily Report 是 iBeacon 设备每日统计报表的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::DeviceDailyReport
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 以设备为维度的数据统计接口
|
7
11
|
# http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html#.E4.BB.A5.E8.AE.BE.E5.A4.87.E4.B8.BA.E7.BB.B4.E5.BA.A6.E7.9A.84.E6.95.B0.E6.8D.AE.E7.BB.9F.E8.AE.A1.E6.8E.A5.E5.8F.A3
|
8
12
|
#
|
@@ -33,14 +37,12 @@ class Wechat::ShakeAround::DeviceDailyReport
|
|
33
37
|
|
34
38
|
device_identifier = normalize_device_id device_id
|
35
39
|
|
36
|
-
|
40
|
+
post_json "https://api.weixin.qq.com/shakearound/statistics/device?access_token=#{access_token}", body:
|
37
41
|
{
|
38
42
|
device_identifier: device_identifier,
|
39
|
-
begin_date: normalize_date(date_range.min),
|
43
|
+
begin_date: normalize_date(date_range.min),
|
40
44
|
end_date: normalize_date(date_range.max)
|
41
45
|
}
|
42
|
-
message.body
|
43
|
-
|
44
46
|
end
|
45
47
|
|
46
48
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Device Group Relation 是管理 iBeacon 设备与设备分组关系的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::DeviceGroupRelation
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 从分组中移除设备
|
7
11
|
# http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E4.BB.8E.E5.88.86.E7.BB.84.E4.B8.AD.E7.A7.BB.E9.99.A4.E8.AE.BE.E5.A4.87
|
8
12
|
#
|
@@ -21,14 +25,14 @@ class Wechat::ShakeAround::DeviceGroupRelation
|
|
21
25
|
assert_present! :group_id, group_id
|
22
26
|
|
23
27
|
device_identifier = normalize_device_id device_id
|
24
|
-
|
28
|
+
post_json "https://api.weixin.qq.com/shakearound/device/group/deletedevice?access_token=#{access_token}", body:
|
25
29
|
{
|
26
30
|
group_id: group_id.to_i,
|
27
31
|
device_identifiers: [ device_identifier ]
|
28
32
|
}
|
29
|
-
message.body
|
30
33
|
end
|
31
34
|
|
35
|
+
##
|
32
36
|
# 添加设备到分组
|
33
37
|
# http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E6.B7.BB.E5.8A.A0.E8.AE.BE.E5.A4.87.E5.88.B0.E5.88.86.E7.BB.84
|
34
38
|
#
|
@@ -48,12 +52,11 @@ class Wechat::ShakeAround::DeviceGroupRelation
|
|
48
52
|
assert_present! :group_id, group_id
|
49
53
|
|
50
54
|
device_identifier = normalize_device_id device_id
|
51
|
-
|
55
|
+
post_json "https://api.weixin.qq.com/shakearound/device/group/adddevice?access_token=#{access_token}", body:
|
52
56
|
{
|
53
57
|
group_id: group_id.to_i,
|
54
58
|
device_identifiers: [ device_identifier ]
|
55
59
|
}
|
56
|
-
message.body
|
57
60
|
end
|
58
61
|
|
59
62
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Device Report 是 iBeacon 设备统计报表的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::DeviceReport
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 批量查询设备统计数据接口
|
7
11
|
# http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html#.E6.89.B9.E9.87.8F.E6.9F.A5.E8.AF.A2.E8.AE.BE.E5.A4.87.E7.BB.9F.E8.AE.A1.E6.95.B0.E6.8D.AE.E6.8E.A5.E5.8F.A3
|
8
12
|
#
|
@@ -27,7 +31,7 @@ class Wechat::ShakeAround::DeviceReport
|
|
27
31
|
# },
|
28
32
|
# date: <DATE>, // 所查询的日期时间戳
|
29
33
|
# total_count: <TOTAL_COUNT>, // 设备总数
|
30
|
-
# page_index: <PAGE_INDEX>, // 所查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页
|
34
|
+
# page_index: <PAGE_INDEX>, // 所查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页
|
31
35
|
# errcode: 0,
|
32
36
|
# errmsg: 'success.'
|
33
37
|
# }
|
@@ -40,12 +44,11 @@ class Wechat::ShakeAround::DeviceReport
|
|
40
44
|
assert_present! :date, date
|
41
45
|
assert_present! :page_index, page_index
|
42
46
|
|
43
|
-
|
47
|
+
post_json "https://api.weixin.qq.com/shakearound/statistics/devicelist?access_token=#{access_token}", body:
|
44
48
|
{
|
45
|
-
date: normalize_date(date),
|
49
|
+
date: normalize_date(date),
|
46
50
|
page_index: page_index.to_i
|
47
51
|
}
|
48
|
-
message.body
|
49
52
|
end
|
50
53
|
|
51
54
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Group 是 管理 iBeacon 设备分组的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::Group
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 查询分组列表
|
7
11
|
# 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
|
8
12
|
#
|
@@ -30,14 +34,14 @@ class Wechat::ShakeAround::Group
|
|
30
34
|
|
31
35
|
assert_present! :access_token, access_token
|
32
36
|
|
33
|
-
|
37
|
+
post_json "https://api.weixin.qq.com/shakearound/device/group/getlist?access_token=#{access_token}", body:
|
34
38
|
{
|
35
39
|
begin: offset.to_i,
|
36
40
|
count: limit.to_i
|
37
41
|
}
|
38
|
-
message.body
|
39
42
|
end
|
40
43
|
|
44
|
+
##
|
41
45
|
# 查询分组详情
|
42
46
|
# 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
|
43
47
|
#
|
@@ -73,15 +77,15 @@ class Wechat::ShakeAround::Group
|
|
73
77
|
assert_present! :access_token, access_token
|
74
78
|
assert_present! :group_id, group_id
|
75
79
|
|
76
|
-
|
80
|
+
post_json "https://api.weixin.qq.com/shakearound/device/group/getdetail?access_token=#{access_token}", body:
|
77
81
|
{
|
78
82
|
group_id: group_id.to_i,
|
79
83
|
begin: offset.to_i,
|
80
84
|
count: limit.to_i
|
81
85
|
}
|
82
|
-
message.body
|
83
86
|
end
|
84
87
|
|
88
|
+
##
|
85
89
|
# 删除分组
|
86
90
|
# http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E5.88.A0.E9.99.A4.E5.88.86.E7.BB.84
|
87
91
|
#
|
@@ -98,10 +102,13 @@ class Wechat::ShakeAround::Group
|
|
98
102
|
assert_present! :access_token, access_token
|
99
103
|
assert_present! :group_id, group_id
|
100
104
|
|
101
|
-
|
102
|
-
|
105
|
+
post_json "https://api.weixin.qq.com/shakearound/device/group/delete?access_token=#{access_token}", body:
|
106
|
+
{
|
107
|
+
group_id: group_id.to_i
|
108
|
+
}
|
103
109
|
end
|
104
110
|
|
111
|
+
##
|
105
112
|
# 编辑分组信息
|
106
113
|
# 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
|
107
114
|
#
|
@@ -120,14 +127,14 @@ class Wechat::ShakeAround::Group
|
|
120
127
|
assert_present! :group_id, group_id
|
121
128
|
assert_present! :name, name
|
122
129
|
|
123
|
-
|
130
|
+
post_json "https://api.weixin.qq.com/shakearound/device/group/update?access_token=#{access_token}", body:
|
124
131
|
{
|
125
132
|
group_id: group_id.to_i,
|
126
133
|
group_name: name
|
127
134
|
}
|
128
|
-
message.body
|
129
135
|
end
|
130
136
|
|
137
|
+
##
|
131
138
|
# 新增分组
|
132
139
|
# http://mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E6.96.B0.E5.A2.9E.E5.88.86.E7.BB.84
|
133
140
|
#
|
@@ -148,8 +155,10 @@ class Wechat::ShakeAround::Group
|
|
148
155
|
assert_present! :access_token, access_token
|
149
156
|
assert_present! :name, name
|
150
157
|
|
151
|
-
|
152
|
-
|
158
|
+
post_json "https://api.weixin.qq.com/shakearound/device/group/add?access_token=#{access_token}", body:
|
159
|
+
{
|
160
|
+
group_name: name
|
161
|
+
}
|
153
162
|
end
|
154
163
|
|
155
164
|
end
|
@@ -1,9 +1,13 @@
|
|
1
|
+
##
|
2
|
+
# Icon 是图标管理的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::Icon
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
extend Wechat::ShakeAround::Material
|
6
9
|
|
10
|
+
##
|
7
11
|
# 上传图片素材
|
8
12
|
# http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
|
9
13
|
#
|
@@ -1,9 +1,13 @@
|
|
1
|
+
##
|
2
|
+
# License 是许可证管理的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::License
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
extend Wechat::ShakeAround::Material
|
6
9
|
|
10
|
+
##
|
7
11
|
# 上传图片素材
|
8
12
|
# http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
|
9
13
|
#
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Page 是管理页面的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::Page
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 查询页面列表
|
7
11
|
# http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html#.E6.9F.A5.E8.AF.A2.E9.A1.B5.E9.9D.A2.E5.88.97.E8.A1.A8
|
8
12
|
#
|
@@ -16,7 +20,7 @@ class Wechat::ShakeAround::Page
|
|
16
20
|
# comment: <COMMENT>, // 页面的备注信息
|
17
21
|
# description: <DESCRIPTION>, // 在摇一摇页面展示的副标题
|
18
22
|
# icon_url: <ICON_LINK>, // 在摇一摇页面展示的图片
|
19
|
-
# page_id: <PAGE_ID>, // 摇周边页面唯一ID
|
23
|
+
# page_id: <PAGE_ID>, // 摇周边页面唯一ID
|
20
24
|
# page_url: <PAGE_LINK>, // 跳转链接
|
21
25
|
# title: <TITLE> // 在摇一摇页面展示的主标题
|
22
26
|
# },
|
@@ -33,15 +37,15 @@ class Wechat::ShakeAround::Page
|
|
33
37
|
assert_present! :offset, offset
|
34
38
|
assert_present! :limit, limit
|
35
39
|
|
36
|
-
|
40
|
+
post_json "https://api.weixin.qq.com/shakearound/page/search?access_token=#{access_token}", body:
|
37
41
|
{
|
38
|
-
type: 2,
|
42
|
+
type: 2,
|
39
43
|
begin: offset.to_i,
|
40
44
|
count: limit.to_i
|
41
45
|
}
|
42
|
-
message.body
|
43
46
|
end
|
44
47
|
|
48
|
+
##
|
45
49
|
# 查询页面列表
|
46
50
|
# http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html#.E6.9F.A5.E8.AF.A2.E9.A1.B5.E9.9D.A2.E5.88.97.E8.A1.A8
|
47
51
|
#
|
@@ -55,7 +59,7 @@ class Wechat::ShakeAround::Page
|
|
55
59
|
# comment: <COMMENT>, // 页面的备注信息
|
56
60
|
# description: <DESCRIPTION>, // 在摇一摇页面展示的副标题
|
57
61
|
# icon_url: <ICON_LINK>, // 在摇一摇页面展示的图片
|
58
|
-
# page_id: <PAGE_ID>, // 摇周边页面唯一ID
|
62
|
+
# page_id: <PAGE_ID>, // 摇周边页面唯一ID
|
59
63
|
# page_url: <PAGE_LINK>, // 跳转链接
|
60
64
|
# title: <TITLE> // 在摇一摇页面展示的主标题
|
61
65
|
# },
|
@@ -73,14 +77,14 @@ class Wechat::ShakeAround::Page
|
|
73
77
|
assert_present! :access_token, access_token
|
74
78
|
assert_present! :page_id, page_id
|
75
79
|
|
76
|
-
|
80
|
+
post_json "https://api.weixin.qq.com/shakearound/page/search?access_token=#{access_token}", body:
|
77
81
|
{
|
78
82
|
type: 1,
|
79
83
|
page_ids: normalize_page_ids(page_id)
|
80
84
|
}
|
81
|
-
message.body
|
82
85
|
end
|
83
86
|
|
87
|
+
##
|
84
88
|
# 删除页面
|
85
89
|
# http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html#.E5.88.A0.E9.99.A4.E9.A1.B5.E9.9D.A2
|
86
90
|
#
|
@@ -95,10 +99,13 @@ class Wechat::ShakeAround::Page
|
|
95
99
|
assert_present! :access_token, access_token
|
96
100
|
assert_present! :page_id, page_id
|
97
101
|
|
98
|
-
|
99
|
-
|
102
|
+
post_json "https://api.weixin.qq.com/shakearound/page/delete?access_token=#{access_token}", body:
|
103
|
+
{
|
104
|
+
page_id: page_id.to_i
|
105
|
+
}
|
100
106
|
end
|
101
107
|
|
108
|
+
##
|
102
109
|
# 编辑页面信息
|
103
110
|
# http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html#.E7.BC.96.E8.BE.91.E9.A1.B5.E9.9D.A2.E4.BF.A1.E6.81.AF
|
104
111
|
#
|
@@ -112,7 +119,7 @@ class Wechat::ShakeAround::Page
|
|
112
119
|
# title 在摇一摇页面展示的主标题,不超过6个汉字或12个英文字母。
|
113
120
|
# description 在摇一摇页面展示的副标题,不超过7个汉字或14个英文字母。
|
114
121
|
# comment 页面的备注信息,不超过15个汉字或30个英文字母。
|
115
|
-
# icon_link 在摇一摇页面展示的图片。图片需先上传至微信侧服务器,用“素材管理-上传图片素材”接口上传图片,返回的图片URL再配置在此处。
|
122
|
+
# icon_link 在摇一摇页面展示的图片。图片需先上传至微信侧服务器,用“素材管理-上传图片素材”接口上传图片,返回的图片URL再配置在此处。
|
116
123
|
def self.update(access_token, page_id, title, description, comment, page_link, icon_link)
|
117
124
|
|
118
125
|
assert_present! :access_token, access_token
|
@@ -123,7 +130,7 @@ class Wechat::ShakeAround::Page
|
|
123
130
|
assert_present! :page_link, page_link
|
124
131
|
assert_present! :icon_link, icon_link
|
125
132
|
|
126
|
-
|
133
|
+
post_json "https://api.weixin.qq.com/shakearound/page/update?access_token=#{access_token}", body:
|
127
134
|
{
|
128
135
|
page_id: page_id.to_i,
|
129
136
|
title: title,
|
@@ -132,9 +139,9 @@ class Wechat::ShakeAround::Page
|
|
132
139
|
comment: comment,
|
133
140
|
icon_url: icon_link
|
134
141
|
}
|
135
|
-
message.body
|
136
142
|
end
|
137
143
|
|
144
|
+
##
|
138
145
|
# 新增页面
|
139
146
|
# http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html#.E6.96.B0.E5.A2.9E.E9.A1.B5.E9.9D.A2
|
140
147
|
#
|
@@ -148,7 +155,7 @@ class Wechat::ShakeAround::Page
|
|
148
155
|
# title 在摇一摇页面展示的主标题,不超过6个汉字或12个英文字母。
|
149
156
|
# description 在摇一摇页面展示的副标题,不超过7个汉字或14个英文字母。
|
150
157
|
# comment 页面的备注信息,不超过15个汉字或30个英文字母。
|
151
|
-
# icon_link 在摇一摇页面展示的图片。图片需先上传至微信侧服务器,用“素材管理-上传图片素材”接口上传图片,返回的图片URL再配置在此处。
|
158
|
+
# icon_link 在摇一摇页面展示的图片。图片需先上传至微信侧服务器,用“素材管理-上传图片素材”接口上传图片,返回的图片URL再配置在此处。
|
152
159
|
def self.create(access_token, title, description, comment, page_link, icon_link)
|
153
160
|
|
154
161
|
assert_present! :access_token, access_token
|
@@ -158,7 +165,7 @@ class Wechat::ShakeAround::Page
|
|
158
165
|
assert_present! :page_link, page_link
|
159
166
|
assert_present! :icon_link, icon_link
|
160
167
|
|
161
|
-
|
168
|
+
post_json "https://api.weixin.qq.com/shakearound/page/add?access_token=#{access_token}", body:
|
162
169
|
{
|
163
170
|
title: title,
|
164
171
|
description: description,
|
@@ -166,7 +173,6 @@ class Wechat::ShakeAround::Page
|
|
166
173
|
comment: comment,
|
167
174
|
icon_url: icon_link
|
168
175
|
}
|
169
|
-
message.body
|
170
176
|
end
|
171
177
|
|
172
178
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Page Daily Report 是页面每日统计报表的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::PageDailyReport
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 以页面为维度的数据统计接口
|
7
11
|
# http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html#.E4.BB.A5.E9.A1.B5.E9.9D.A2.E4.B8.BA.E7.BB.B4.E5.BA.A6.E7.9A.84.E6.95.B0.E6.8D.AE.E7.BB.9F.E8.AE.A1.E6.8E.A5.E5.8F.A3
|
8
12
|
#
|
@@ -23,7 +27,7 @@ class Wechat::ShakeAround::PageDailyReport
|
|
23
27
|
# errmsg: 'success.'
|
24
28
|
# }
|
25
29
|
#
|
26
|
-
# page_id is an integer 指定页面的ID
|
30
|
+
# page_id is an integer 指定页面的ID
|
27
31
|
# date_range is a string range like 'yyyy-mm-dd'..'yyyy-mm-dd'.
|
28
32
|
def self.index(access_token, page_id, date_range)
|
29
33
|
|
@@ -31,13 +35,12 @@ class Wechat::ShakeAround::PageDailyReport
|
|
31
35
|
assert_present! :page_id, page_id
|
32
36
|
assert_present! :date_range, date_range
|
33
37
|
|
34
|
-
|
38
|
+
post_json "https://api.weixin.qq.com/shakearound/statistics/page?access_token=#{access_token}", body:
|
35
39
|
{
|
36
40
|
page_id: page_id.to_i,
|
37
|
-
begin_date: normalize_date(date_range.min),
|
41
|
+
begin_date: normalize_date(date_range.min),
|
38
42
|
end_date: normalize_date(date_range.max)
|
39
43
|
}
|
40
|
-
message.body
|
41
44
|
end
|
42
45
|
|
43
46
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Page Report 是页面统计报表的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::PageReport
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 批量查询页面统计数据接口
|
7
11
|
# http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html#.E6.89.B9.E9.87.8F.E6.9F.A5.E8.AF.A2.E9.A1.B5.E9.9D.A2.E7.BB.9F.E8.AE.A1.E6.95.B0.E6.8D.AE.E6.8E.A5.E5.8F.A3
|
8
12
|
#
|
@@ -24,7 +28,7 @@ class Wechat::ShakeAround::PageReport
|
|
24
28
|
# },
|
25
29
|
# date: <DATE>, // 所查询的日期时间戳
|
26
30
|
# total_count: <TOTAL_COUNT>, // 页面总数
|
27
|
-
# page_index: <PAGE_INDEX>, // 所查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页
|
31
|
+
# page_index: <PAGE_INDEX>, // 所查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页
|
28
32
|
# errcode: 0,
|
29
33
|
# errmsg: 'success.'
|
30
34
|
# }
|
@@ -37,12 +41,11 @@ class Wechat::ShakeAround::PageReport
|
|
37
41
|
assert_present! :date, date
|
38
42
|
assert_present! :page_index, page_index
|
39
43
|
|
40
|
-
|
44
|
+
post_json "https://api.weixin.qq.com/shakearound/statistics/pagelist?access_token=#{access_token}", body:
|
41
45
|
{
|
42
|
-
date: normalize_date(date),
|
46
|
+
date: normalize_date(date),
|
43
47
|
page_index: page_index.to_i
|
44
48
|
}
|
45
|
-
message.body
|
46
49
|
end
|
47
50
|
|
48
51
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
##
|
2
|
+
# Registration 是账号注册管理的封装类。
|
3
|
+
|
1
4
|
class Wechat::ShakeAround::Registration
|
2
5
|
|
3
6
|
extend Wechat::Core::Common
|
4
7
|
extend Wechat::ShakeAround::Common
|
5
8
|
|
9
|
+
##
|
6
10
|
# 查询审核状态
|
7
11
|
# http://mp.weixin.qq.com/wiki/13/025f1d471dc999928340161c631c6635.html#.E6.9F.A5.E8.AF.A2.E5.AE.A1.E6.A0.B8.E7.8A.B6.E6.80.81
|
8
12
|
#
|
@@ -26,10 +30,10 @@ class Wechat::ShakeAround::Registration
|
|
26
30
|
|
27
31
|
assert_present! :access_token, access_token
|
28
32
|
|
29
|
-
|
30
|
-
message.body
|
33
|
+
get_json "https://api.weixin.qq.com/shakearound/account/auditstatus?access_token=#{access_token}"
|
31
34
|
end
|
32
35
|
|
36
|
+
##
|
33
37
|
# 申请开通功能
|
34
38
|
# http://mp.weixin.qq.com/wiki/13/025f1d471dc999928340161c631c6635.html#.E7.94.B3.E8.AF.B7.E5.BC.80.E9.80.9A.E5.8A.9F.E8.83.BD
|
35
39
|
# 成功提交申请请求后,工作人员会在三个工作日内完成审核。
|
@@ -6,6 +6,7 @@ class Wechat::ShakeAround::Shaking
|
|
6
6
|
extend Wechat::Core::Common
|
7
7
|
extend Wechat::ShakeAround::Common
|
8
8
|
|
9
|
+
##
|
9
10
|
# 获取摇周边的设备及用户信息
|
10
11
|
# http://mp.weixin.qq.com/wiki/3/34904a5db3d0ec7bb5306335b8da1faf.html
|
11
12
|
#
|
@@ -32,12 +33,11 @@ class Wechat::ShakeAround::Shaking
|
|
32
33
|
assert_present! :access_token, access_token
|
33
34
|
assert_present! :ticket, ticket
|
34
35
|
|
35
|
-
|
36
|
+
post_json "https://api.weixin.qq.com/shakearound/user/getshakeinfo?access_token=#{access_token}", body:
|
36
37
|
{
|
37
38
|
ticket: ticket,
|
38
39
|
need_poi: 1
|
39
40
|
}
|
40
|
-
message.body
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
data/wechat-shake_around.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'rake', '~> 11.0'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
32
|
|
33
|
-
spec.add_dependency 'httpclient', '
|
33
|
+
spec.add_dependency 'httpclient', '~> 2.8'
|
34
34
|
spec.add_dependency 'wechat-core', '~> 0.4'
|
35
35
|
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wechat-shake_around
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: httpclient
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.8'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|