wechat-shake_around 0.9 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +31 -6
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +37 -0
- data/README.md +42 -5
- data/ROADMAP.md +23 -0
- data/_config.yml +1 -0
- data/bin/console +3 -3
- data/lib/wechat/shake_around/apply.rb +13 -6
- data/lib/wechat/shake_around/beacon.rb +22 -9
- data/lib/wechat/shake_around/beacon_page_relation.rb +14 -7
- data/lib/wechat/shake_around/beacon_poi_relation.rb +8 -4
- data/lib/wechat/shake_around/common.rb +0 -1
- data/lib/wechat/shake_around/device_daily_report.rb +7 -4
- data/lib/wechat/shake_around/device_group_relation.rb +14 -5
- data/lib/wechat/shake_around/device_report.rb +8 -4
- data/lib/wechat/shake_around/group.rb +29 -10
- data/lib/wechat/shake_around/icon.rb +7 -2
- data/lib/wechat/shake_around/license.rb +8 -3
- data/lib/wechat/shake_around/material.rb +5 -0
- data/lib/wechat/shake_around/page.rb +37 -8
- data/lib/wechat/shake_around/page_daily_report.rb +7 -4
- data/lib/wechat/shake_around/page_report.rb +9 -5
- data/lib/wechat/shake_around/registration.rb +13 -5
- data/lib/wechat/shake_around/shaking.rb +9 -3
- data/lib/wechat/shake_around/version.rb +1 -1
- data/wechat-shake_around.gemspec +4 -3
- metadata +23 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5270efec3abd0ac53118428e68c3142f3ac0694e
|
4
|
+
data.tar.gz: 7e9172ab08dde86672339fc1bf81912be998d7fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7ce0edef4fa1f9b935fba765d541814096680727b1a4fe0f6c7e9de9d73a2c37d751249e58a1e3479e8b8170a4cc5be5d028967b39ff16084138a455863cc68
|
7
|
+
data.tar.gz: 1451363f97346acd16639704433fa11a7565e2a25a1e7ae163bf30debe3f46d72e078d363ba1efb96a6d3e4fd7a779f23f94f8bc2cd17829a1b47182e597472a
|
data/.gitignore
CHANGED
@@ -1,10 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
/_yardoc/
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
5
4
|
/coverage/
|
6
|
-
/
|
5
|
+
/InstalledFiles
|
7
6
|
/pkg/
|
8
7
|
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
9
10
|
/tmp/
|
10
|
-
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/CHANGELOG.md
CHANGED
@@ -34,3 +34,22 @@
|
|
34
34
|
|
35
35
|
## v0.9
|
36
36
|
1. Registration wrapper class
|
37
|
+
|
38
|
+
## v0.9.1
|
39
|
+
1. Improve the Ruby Gem Specification to depend on [wechat-core](https://github.com/topbitdu/wechat-core) v0.4
|
40
|
+
2. Improve the Apply wrapper class for the argument validation & HTTP request
|
41
|
+
3. Improve the Beacon wrapper class for the argument validation & HTTP request
|
42
|
+
4. Improve the Beacon Page Relation wrapper class for the argument validation & HTTP request
|
43
|
+
5. Improve the Beacon PoI Relation wrapper class for the argument validation & HTTP request
|
44
|
+
6. Improve the Device Daily Report wrapper class for the argument validation & HTTP request
|
45
|
+
7. Improve the Device Group Relation wrapper class for the argument validation & HTTP request
|
46
|
+
8. Improve the Device Report wrapper class for the argument validation & HTTP request
|
47
|
+
9. Improve the Group wrapper class for the argument validation & HTTP request
|
48
|
+
10. Improve the Icon wrapper class for the argument validation
|
49
|
+
11. Improve the License wrapper class for the argument validation
|
50
|
+
12. Improve the Material module for the argument validation
|
51
|
+
13. Improve the Page wrapper class for the argument validation & HTTP request
|
52
|
+
14. Improve the Page Daily Report wrapper class for the argument validation & HTTP request
|
53
|
+
15. Improve the Page Report wrapper class for the argument validation & HTTP request
|
54
|
+
16. Improve the Registration wrapper class for the argument validation & HTTP request
|
55
|
+
17. Improve the Shaking wrapper class for the argument validation & HTTP request
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
wechat-shake_around (0.9)
|
5
|
+
httpclient (>= 2.8)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.2.5)
|
11
|
+
httpclient (2.8.0)
|
12
|
+
rake (11.2.2)
|
13
|
+
rspec (3.5.0)
|
14
|
+
rspec-core (~> 3.5.0)
|
15
|
+
rspec-expectations (~> 3.5.0)
|
16
|
+
rspec-mocks (~> 3.5.0)
|
17
|
+
rspec-core (3.5.1)
|
18
|
+
rspec-support (~> 3.5.0)
|
19
|
+
rspec-expectations (3.5.0)
|
20
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
+
rspec-support (~> 3.5.0)
|
22
|
+
rspec-mocks (3.5.0)
|
23
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
+
rspec-support (~> 3.5.0)
|
25
|
+
rspec-support (3.5.0)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
bundler (~> 1.11)
|
32
|
+
rake (~> 11.0)
|
33
|
+
rspec (~> 3.0)
|
34
|
+
wechat-shake_around!
|
35
|
+
|
36
|
+
BUNDLED WITH
|
37
|
+
1.12.5
|
data/README.md
CHANGED
@@ -1,11 +1,22 @@
|
|
1
1
|
# Wechat Shake Around 微信摇周边库
|
2
2
|
|
3
|
+
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/wechat-shake_around/frames)
|
3
4
|
[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
|
5
|
+
|
4
6
|
[![Gem Version](https://badge.fury.io/rb/wechat-shake_around.svg)](https://badge.fury.io/rb/wechat-shake_around)
|
7
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/wechat-shake_around.svg)](https://gemnasium.com/github.com/topbitdu/wechat-shake_around)
|
5
8
|
|
6
9
|
The Wechat Shake Around Library is a code base to call the Wechat Shake Around APIs.
|
7
10
|
微信摇周边库用于调用[微信摇周边API](http://mp.weixin.qq.com/wiki/19/9fe9fdbb50fee9f9660438c551142ccf.html)。
|
8
11
|
|
12
|
+
|
13
|
+
|
14
|
+
## Recent Update
|
15
|
+
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
16
|
+
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
17
|
+
|
18
|
+
|
19
|
+
|
9
20
|
## Installation
|
10
21
|
|
11
22
|
Add this line to your application's Gemfile:
|
@@ -22,6 +33,8 @@ Or install it yourself as:
|
|
22
33
|
|
23
34
|
$ gem install wechat-shake_around
|
24
35
|
|
36
|
+
|
37
|
+
|
25
38
|
## Usage
|
26
39
|
|
27
40
|
|
@@ -57,6 +70,29 @@ end
|
|
57
70
|
|
58
71
|
|
59
72
|
|
73
|
+
### Material 上传素材
|
74
|
+
[Upload License 上传许可证素材](http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html)
|
75
|
+
```ruby
|
76
|
+
response = Wechat::ShakeAround::License.create(access_token, Pathname.new('var/ftp/license.jpg'))
|
77
|
+
if response.present? && 0==response['errcode'].to_i
|
78
|
+
license_link = response['data']['pic_url']
|
79
|
+
else
|
80
|
+
# Show response['errmsg']
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
[Upload Icon 上传图标素材](http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html)
|
85
|
+
```ruby
|
86
|
+
response = Wechat::ShakeAround::Icon.create(access_token, Pathname.new('var/ftp/article-icon.jpg'))
|
87
|
+
if response.present? && 0==response['errcode'].to_i
|
88
|
+
icon_link = response['data']['pic_url']
|
89
|
+
else
|
90
|
+
# Show response['errmsg']
|
91
|
+
end
|
92
|
+
```
|
93
|
+
|
94
|
+
|
95
|
+
|
60
96
|
### Handle the Callback of Shaking 处理摇周边行为的回调
|
61
97
|
[Get Beacon & PoI & Page & Shaker 获取摇周边的设备及用户信息](http://mp.weixin.qq.com/wiki/3/34904a5db3d0ec7bb5306335b8da1faf.html)
|
62
98
|
```ruby
|
@@ -84,7 +120,8 @@ quantity = 500
|
|
84
120
|
reason = 'Test Purpose'
|
85
121
|
comment = 'Some Mall' # optional
|
86
122
|
poi_id = nil # optional Some PoI ID
|
87
|
-
response = Wechat::ShakeAround::Apply.create access_token, quantity, apply_reason, comment, poi_id
|
123
|
+
response = Wechat::ShakeAround::Apply.create access_token, quantity, apply_reason, comment: comment, poi_id: poi_id
|
124
|
+
# or for short: Wechat::ShakeAround::Apply.create access_token, quantity, apply_reason
|
88
125
|
if response.present? && 0==response['errcode'].to_i
|
89
126
|
apply_id = response['data']['apply_id']
|
90
127
|
audit_status = response['data']['audit_status']
|
@@ -130,7 +167,7 @@ if response.present? && 0==response['errcode'].to_i
|
|
130
167
|
status = device['status']
|
131
168
|
# 0:未激活,1:已激活
|
132
169
|
last_active_time = device['last_active_time']
|
133
|
-
# 设备最近一次被摇到的日期(最早只能获取前一天的数据);新申请的设备该字段值为0
|
170
|
+
# 设备最近一次被摇到的日期(最早只能获取前一天的数据);新申请的设备该字段值为0
|
134
171
|
poi_id = device['poi_id']
|
135
172
|
# 设备关联的门店ID,关联门店后,在门店1KM的范围内有优先摇出信息的机会
|
136
173
|
end
|
@@ -153,7 +190,7 @@ if response.present? && 0==response['errcode'].to_i
|
|
153
190
|
status = device['status']
|
154
191
|
# 0:未激活,1:已激活
|
155
192
|
last_active_time = device['last_active_time']
|
156
|
-
# 设备最近一次被摇到的日期(最早只能获取前一天的数据);新申请的设备该字段值为0
|
193
|
+
# 设备最近一次被摇到的日期(最早只能获取前一天的数据);新申请的设备该字段值为0
|
157
194
|
poi_id = device['poi_id']
|
158
195
|
# 设备关联的门店ID,关联门店后,在门店1KM的范围内有优先摇出信息的机会
|
159
196
|
end
|
@@ -275,7 +312,7 @@ if response.present? && 0==response['errcode'].to_i
|
|
275
312
|
comment = page['comment'] # 页面的备注信息
|
276
313
|
description = page['description'] # 在摇一摇页面展示的副标题
|
277
314
|
icon_url = page['icon_url'] # 在摇一摇页面展示的图片
|
278
|
-
page_id = page['page_id'] # 摇周边页面唯一ID
|
315
|
+
page_id = page['page_id'] # 摇周边页面唯一ID
|
279
316
|
page_url = page['page_url'] # 跳转链接
|
280
317
|
title = page['title'] # 在摇一摇页面展示的主标题
|
281
318
|
end
|
@@ -293,7 +330,7 @@ if response.present? && 0==response['errcode'].to_i
|
|
293
330
|
comment = page['comment'] # 页面的备注信息
|
294
331
|
description = page['description'] # 在摇一摇页面展示的副标题
|
295
332
|
icon_url = page['icon_url'] # 在摇一摇页面展示的图片
|
296
|
-
page_id = page['page_id'] # 摇周边页面唯一ID
|
333
|
+
page_id = page['page_id'] # 摇周边页面唯一ID
|
297
334
|
page_url = page['page_url'] # 跳转链接
|
298
335
|
title = page['title'] # 在摇一摇页面展示的主标题
|
299
336
|
else
|
data/ROADMAP.md
CHANGED
@@ -34,3 +34,26 @@
|
|
34
34
|
|
35
35
|
## v0.9
|
36
36
|
1. Registration wrapper class
|
37
|
+
|
38
|
+
## v0.9.1
|
39
|
+
1. Improve the Ruby Gem Specification to depend on [wechat-core](https://github.com/topbitdu/wechat-core) v0.4
|
40
|
+
2. Improve the Apply wrapper class for the argument validation & HTTP request
|
41
|
+
3. Improve the Beacon wrapper class for the argument validation & HTTP request
|
42
|
+
4. Improve the Beacon Page Relation wrapper class for the argument validation & HTTP request
|
43
|
+
5. Improve the Beacon PoI Relation wrapper class for the argument validation & HTTP request
|
44
|
+
6. Improve the Device Daily Report wrapper class for the argument validation & HTTP request
|
45
|
+
7. Improve the Device Group Relation wrapper class for the argument validation & HTTP request
|
46
|
+
8. Improve the Device Report wrapper class for the argument validation & HTTP request
|
47
|
+
9. Improve the Group wrapper class for the argument validation & HTTP request
|
48
|
+
10. Improve the Icon wrapper class for the argument validation
|
49
|
+
11. Improve the License wrapper class for the argument validation
|
50
|
+
12. Improve the Material module for the argument validation
|
51
|
+
13. Improve the Page wrapper class for the argument validation & HTTP request
|
52
|
+
14. Improve the Page Daily Report wrapper class for the argument validation & HTTP request
|
53
|
+
15. Improve the Page Report wrapper class for the argument validation & HTTP request
|
54
|
+
16. Improve the Registration wrapper class for the argument validation & HTTP request
|
55
|
+
17. Improve the Shaking wrapper class for the argument validation & HTTP request
|
56
|
+
|
57
|
+
## v1.0
|
58
|
+
1. Improve the wrapper classes to support the Keyword Arguments
|
59
|
+
2. Improve the wrapper classes for argument validation
|
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
markdown: kramdown
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'wechat/shake_around'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "wechat/shake_around"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::Apply
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 查询设备ID申请审核状态
|
8
7
|
# 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
|
@@ -20,7 +19,10 @@ class Wechat::ShakeAround::Apply
|
|
20
19
|
# errmsg: 'success.'
|
21
20
|
# }
|
22
21
|
def self.load(access_token, apply_id)
|
23
|
-
|
22
|
+
assert_present! :access_token, access_token
|
23
|
+
assert_present! :apply_id, apply_id
|
24
|
+
|
25
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/applystatus?access_token=#{access_token}", body: { apply_id: apply_id.to_i }
|
24
26
|
message.body
|
25
27
|
end
|
26
28
|
|
@@ -42,11 +44,16 @@ class Wechat::ShakeAround::Apply
|
|
42
44
|
# quantity: 申请的设备ID的数量,单次新增设备超过500个,需走人工审核流程。
|
43
45
|
# reason: 申请理由,不超过100个汉字或200个英文字母。
|
44
46
|
# comment: 备注,不超过15个汉字或30个英文字母。
|
45
|
-
def self.create(access_token, quantity, reason, comment
|
47
|
+
def self.create(access_token, quantity, reason, comment: nil, poi_id: nil)
|
48
|
+
|
49
|
+
assert_present! :access_token, access_token
|
50
|
+
assert_present! :quantity, quantity
|
51
|
+
assert_present! :reason, reason
|
52
|
+
|
46
53
|
options = { quantity: quantity, apply_reason: reason }
|
47
54
|
options[:comment] = comment if comment.present?
|
48
55
|
options[:poi_id] = poi_id if poi_id.present?
|
49
|
-
message =
|
56
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/applyid?access_token=#{access_token}", body: options
|
50
57
|
message.body
|
51
58
|
end
|
52
59
|
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::Beacon
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 查询设备列表
|
8
7
|
# 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
|
@@ -19,7 +18,7 @@ class Wechat::ShakeAround::Beacon
|
|
19
18
|
# major: <MAJOR>,
|
20
19
|
# minor: <MINOR>,
|
21
20
|
# status: <STATUS>, // 激活状态,0:未激活,1:已激活
|
22
|
-
# last_active_time: <LAST_ACTIVE_TIME>, // 设备最近一次被摇到的日期(最早只能获取前一天的数据);新申请的设备该字段值为0
|
21
|
+
# last_active_time: <LAST_ACTIVE_TIME>, // 设备最近一次被摇到的日期(最早只能获取前一天的数据);新申请的设备该字段值为0
|
23
22
|
# poi_id: <POI_ID>, // 设备关联的门店ID,关联门店后,在门店1KM的范围内有优先摇出信息的机会。门店相关信息具体可查看门店相关的接口文档
|
24
23
|
# uuid: <UUID>
|
25
24
|
# }
|
@@ -29,7 +28,12 @@ class Wechat::ShakeAround::Beacon
|
|
29
28
|
# errcode: 0,
|
30
29
|
# errmsg: 'success.'
|
31
30
|
# }
|
32
|
-
def self.index(access_token, offset, limit, apply_id
|
31
|
+
def self.index(access_token, offset, limit, apply_id: nil)
|
32
|
+
|
33
|
+
assert_present! :access_token, access_token
|
34
|
+
assert_present! :offset, offset
|
35
|
+
assert_present! :limit, limit
|
36
|
+
|
33
37
|
options = { begin: offset, count: limit }
|
34
38
|
if apply_id.present?
|
35
39
|
options[:apply_id] = apply_id
|
@@ -37,7 +41,7 @@ class Wechat::ShakeAround::Beacon
|
|
37
41
|
else
|
38
42
|
options[:type] = 2
|
39
43
|
end
|
40
|
-
message =
|
44
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/search?access_token=#{access_token}", body: options
|
41
45
|
message.body
|
42
46
|
end
|
43
47
|
|
@@ -56,7 +60,7 @@ class Wechat::ShakeAround::Beacon
|
|
56
60
|
# major: <MAJOR>,
|
57
61
|
# minor: <MINOR>,
|
58
62
|
# status: <STATUS>, // 激活状态,0:未激活,1:已激活
|
59
|
-
# last_active_time: <LAST_ACTIVE_TIME>, // 设备最近一次被摇到的日期(最早只能获取前一天的数据);新申请的设备该字段值为0
|
63
|
+
# last_active_time: <LAST_ACTIVE_TIME>, // 设备最近一次被摇到的日期(最早只能获取前一天的数据);新申请的设备该字段值为0
|
60
64
|
# poi_id: <POI_ID>, // 设备关联的门店ID,关联门店后,在门店1KM的范围内有优先摇出信息的机会。门店相关信息具体可查看门店相关的接口文档
|
61
65
|
# uuid: <UUID>
|
62
66
|
# }
|
@@ -69,8 +73,12 @@ class Wechat::ShakeAround::Beacon
|
|
69
73
|
#
|
70
74
|
# device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }.
|
71
75
|
def self.load(access_token, device_id)
|
76
|
+
|
77
|
+
assert_present! :access_token, access_token
|
78
|
+
assert_present! :device_id, device_id
|
79
|
+
|
72
80
|
device_identifier = self.normalize_device_id device_id
|
73
|
-
message =
|
81
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/search?access_token=#{access_token}", body:
|
74
82
|
{
|
75
83
|
type: 1,
|
76
84
|
device_identifiers: [ device_identifier ]
|
@@ -90,8 +98,13 @@ class Wechat::ShakeAround::Beacon
|
|
90
98
|
#
|
91
99
|
# device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }.
|
92
100
|
def self.update(access_token, device_id, comment)
|
101
|
+
|
102
|
+
assert_present! :access_token, access_token
|
103
|
+
assert_present! :device_id, device_id
|
104
|
+
assert_present! :comment, comment
|
105
|
+
|
93
106
|
device_identifier = self.normalize_device_id device_id
|
94
|
-
message =
|
107
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/update?access_token=#{access_token}",
|
95
108
|
{
|
96
109
|
device_identifier: device_identifier,
|
97
110
|
comment: comment
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::BeaconPageRelation
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 删除设备与页面的关联关系
|
8
7
|
# http://mp.weixin.qq.com/wiki/12/c8120214ec0ba08af5dfcc0da1a11400.html
|
@@ -20,13 +19,17 @@ class Wechat::ShakeAround::BeaconPageRelation
|
|
20
19
|
# append 新增操作标志位,0为覆盖,1为新增
|
21
20
|
def self.destroy(access_token, device_id, page_id)
|
22
21
|
|
22
|
+
assert_present! :access_token, access_token
|
23
|
+
assert_present! :device_id, device_id
|
24
|
+
assert_present! :page_id, page_id
|
25
|
+
|
23
26
|
device_identifier = normalize_device_id device_id
|
24
27
|
page_ids = normalize_page_ids page_id
|
25
28
|
|
26
|
-
message =
|
29
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/bindpage?access_token=#{access_token}", body:
|
27
30
|
{
|
28
31
|
device_identifier: device_identifier,
|
29
|
-
page_ids: page_ids,
|
32
|
+
page_ids: page_ids,
|
30
33
|
bind: 0,
|
31
34
|
append: 0
|
32
35
|
}
|
@@ -49,13 +52,17 @@ class Wechat::ShakeAround::BeaconPageRelation
|
|
49
52
|
# append 新增操作标志位,0为覆盖,1为新增
|
50
53
|
def self.create(access_token, device_id, page_id)
|
51
54
|
|
55
|
+
assert_present! :access_token, access_token
|
56
|
+
assert_present! :device_id, device_id
|
57
|
+
assert_present! :page_id, page_id
|
58
|
+
|
52
59
|
device_identifier = normalize_device_id device_id
|
53
60
|
page_ids = normalize_page_ids page_id
|
54
61
|
|
55
|
-
message =
|
62
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/bindpage?access_token=#{access_token}", body:
|
56
63
|
{
|
57
64
|
device_identifier: device_identifier,
|
58
|
-
page_ids: page_ids,
|
65
|
+
page_ids: page_ids,
|
59
66
|
bind: 1,
|
60
67
|
append: 1
|
61
68
|
}
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::BeaconPoiRelation
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 配置设备与门店的关联关系
|
8
7
|
# 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
|
@@ -16,8 +15,13 @@ class Wechat::ShakeAround::BeaconPoiRelation
|
|
16
15
|
#
|
17
16
|
# device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }.
|
18
17
|
def self.create(access_token, device_id, poi_id)
|
18
|
+
|
19
|
+
assert_present! :access_token, access_token
|
20
|
+
assert_present! :device_id, device_id
|
21
|
+
assert_present! :poi_id, poi_id
|
22
|
+
|
19
23
|
device_identifier = self.normalize_device_id device_id
|
20
|
-
message =
|
24
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/bindlocation?access_token=#{access_token}", body:
|
21
25
|
{
|
22
26
|
device_identifier: device_identifier,
|
23
27
|
poi_id: poi_id.to_i
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::DeviceDailyReport
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 以设备为维度的数据统计接口
|
8
7
|
# 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
|
@@ -28,9 +27,13 @@ class Wechat::ShakeAround::DeviceDailyReport
|
|
28
27
|
# date_range is a string range like 'yyyy-mm-dd'..'yyyy-mm-dd'.
|
29
28
|
def self.index(access_token, device_id, date_range)
|
30
29
|
|
30
|
+
assert_present! :access_token, access_token
|
31
|
+
assert_present! :device_id, device_id
|
32
|
+
assert_present! :date_range, date_range
|
33
|
+
|
31
34
|
device_identifier = normalize_device_id device_id
|
32
35
|
|
33
|
-
message =
|
36
|
+
message = post_json "https://api.weixin.qq.com/shakearound/statistics/device?access_token=#{access_token}", body:
|
34
37
|
{
|
35
38
|
device_identifier: device_identifier,
|
36
39
|
begin_date: normalize_date(date_range.min),
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::DeviceGroupRelation
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 从分组中移除设备
|
8
7
|
# 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
|
@@ -16,8 +15,13 @@ class Wechat::ShakeAround::DeviceGroupRelation
|
|
16
15
|
#
|
17
16
|
# device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }.
|
18
17
|
def self.destroy(access_token, device_id, group_id)
|
18
|
+
|
19
|
+
assert_present! :access_token, access_token
|
20
|
+
assert_present! :device_id, device_id
|
21
|
+
assert_present! :group_id, group_id
|
22
|
+
|
19
23
|
device_identifier = normalize_device_id device_id
|
20
|
-
message =
|
24
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/group/deletedevice?access_token=#{access_token}", body:
|
21
25
|
{
|
22
26
|
group_id: group_id.to_i,
|
23
27
|
device_identifiers: [ device_identifier ]
|
@@ -38,8 +42,13 @@ class Wechat::ShakeAround::DeviceGroupRelation
|
|
38
42
|
# device_id is an integer or a hash like { uuid: <UUID>, major: <MAJOR>, minor: <MINOR> }.
|
39
43
|
# 每个分组能够持有的设备上限为10000,并且每次添加操作的添加上限为1000。
|
40
44
|
def self.create(access_token, device_id, group_id)
|
45
|
+
|
46
|
+
assert_present! :access_token, access_token
|
47
|
+
assert_present! :device_id, device_id
|
48
|
+
assert_present! :group_id, group_id
|
49
|
+
|
41
50
|
device_identifier = normalize_device_id device_id
|
42
|
-
message =
|
51
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/group/adddevice?access_token=#{access_token}", body:
|
43
52
|
{
|
44
53
|
group_id: group_id.to_i,
|
45
54
|
device_identifiers: [ device_identifier ]
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::DeviceReport
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 批量查询设备统计数据接口
|
8
7
|
# 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
|
@@ -36,7 +35,12 @@ class Wechat::ShakeAround::DeviceReport
|
|
36
35
|
# date: 指定查询日期时间戳,单位为秒。
|
37
36
|
# page_index: 指定查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页,从1开始。
|
38
37
|
def self.index(access_token, date, page_index = 1)
|
39
|
-
|
38
|
+
|
39
|
+
assert_present! :access_token, access_token
|
40
|
+
assert_present! :date, date
|
41
|
+
assert_present! :page_index, page_index
|
42
|
+
|
43
|
+
message = post_json "https://api.weixin.qq.com/shakearound/statistics/devicelist?access_token=#{access_token}", body:
|
40
44
|
{
|
41
45
|
date: normalize_date(date),
|
42
46
|
page_index: page_index.to_i
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::Group
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 查询分组列表
|
8
7
|
# 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
|
@@ -27,8 +26,11 @@ class Wechat::ShakeAround::Group
|
|
27
26
|
#
|
28
27
|
# offset: 分组列表的起始索引值
|
29
28
|
# limit: 待查询的分组数量,不能超过1000个
|
30
|
-
def self.index(access_token, offset
|
31
|
-
|
29
|
+
def self.index(access_token, offset: 0, limit: 1000)
|
30
|
+
|
31
|
+
assert_present! :access_token, access_token
|
32
|
+
|
33
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/group/getlist?access_token=#{access_token}", body:
|
32
34
|
{
|
33
35
|
begin: offset.to_i,
|
34
36
|
count: limit.to_i
|
@@ -66,8 +68,12 @@ class Wechat::ShakeAround::Group
|
|
66
68
|
# group_id: 分组唯一标识,全局唯一
|
67
69
|
# offset: 分组里设备的起始索引值
|
68
70
|
# limit: 待查询的分组里设备的数量,不能超过1000个
|
69
|
-
def self.load(access_token, group_id, offset
|
70
|
-
|
71
|
+
def self.load(access_token, group_id, offset: 0, limit: 1000)
|
72
|
+
|
73
|
+
assert_present! :access_token, access_token
|
74
|
+
assert_present! :group_id, group_id
|
75
|
+
|
76
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/group/getdetail?access_token=#{access_token}", body:
|
71
77
|
{
|
72
78
|
group_id: group_id.to_i,
|
73
79
|
begin: offset.to_i,
|
@@ -88,7 +94,11 @@ class Wechat::ShakeAround::Group
|
|
88
94
|
#
|
89
95
|
# group_id: 分组唯一标识,全局唯一
|
90
96
|
def self.destroy(access_token, group_id)
|
91
|
-
|
97
|
+
|
98
|
+
assert_present! :access_token, access_token
|
99
|
+
assert_present! :group_id, group_id
|
100
|
+
|
101
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/group/delete?access_token=#{access_token}", body: { group_id: group_id.to_i }
|
92
102
|
message.body
|
93
103
|
end
|
94
104
|
|
@@ -105,7 +115,12 @@ class Wechat::ShakeAround::Group
|
|
105
115
|
# group_id: 分组唯一标识,全局唯一
|
106
116
|
# name: 分组名称,不超过100汉字或200个英文字母
|
107
117
|
def self.update(access_token, group_id, name)
|
108
|
-
|
118
|
+
|
119
|
+
assert_present! :access_token, access_token
|
120
|
+
assert_present! :group_id, group_id
|
121
|
+
assert_present! :name, name
|
122
|
+
|
123
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/group/update?access_token=#{access_token}", body:
|
109
124
|
{
|
110
125
|
group_id: group_id.to_i,
|
111
126
|
group_name: name
|
@@ -129,7 +144,11 @@ class Wechat::ShakeAround::Group
|
|
129
144
|
#
|
130
145
|
# name: 分组名称,不超过100汉字或200个英文字母
|
131
146
|
def self.create(access_token, name)
|
132
|
-
|
147
|
+
|
148
|
+
assert_present! :access_token, access_token
|
149
|
+
assert_present! :name, name
|
150
|
+
|
151
|
+
message = post_json "https://api.weixin.qq.com/shakearound/device/group/add?access_token=#{access_token}", body: { group_name: name }
|
133
152
|
message.body
|
134
153
|
end
|
135
154
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
class Wechat::ShakeAround::Icon
|
2
2
|
|
3
|
-
extend
|
4
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
5
|
+
extend Wechat::ShakeAround::Material
|
5
6
|
|
6
7
|
# 上传图片素材
|
7
8
|
# http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
|
@@ -15,6 +16,10 @@ class Wechat::ShakeAround::Icon
|
|
15
16
|
#
|
16
17
|
# media 图片完整路径。
|
17
18
|
def self.create(access_token, media)
|
19
|
+
|
20
|
+
assert_present! :access_token, access_token
|
21
|
+
assert_present! :media, media
|
22
|
+
|
18
23
|
upload access_token, media, 'icon'
|
19
24
|
end
|
20
25
|
|
@@ -1,20 +1,25 @@
|
|
1
1
|
class Wechat::ShakeAround::License
|
2
2
|
|
3
|
-
extend
|
4
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
5
|
+
extend Wechat::ShakeAround::Material
|
5
6
|
|
6
7
|
# 上传图片素材
|
7
8
|
# http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
|
8
9
|
#
|
9
10
|
# Return hash format if success:
|
10
11
|
# {
|
11
|
-
# data: { pic_url: <
|
12
|
+
# data: { pic_url: <LICENSE_LINK> },
|
12
13
|
# errcode: 0,
|
13
14
|
# errmsg: 'success.'
|
14
15
|
# }
|
15
16
|
#
|
16
17
|
# media 图片完整路径。
|
17
18
|
def self.create(access_token, media)
|
19
|
+
|
20
|
+
assert_present! :access_token, access_token
|
21
|
+
assert_present! :media, media
|
22
|
+
|
18
23
|
upload access_token, media, 'license'
|
19
24
|
end
|
20
25
|
|
@@ -15,6 +15,11 @@ module Wechat::ShakeAround::Material
|
|
15
15
|
# media 图片完整路径。
|
16
16
|
# type 是icon或者license。
|
17
17
|
def upload(access_token, media, type)
|
18
|
+
|
19
|
+
assert_present! :access_token, access_token
|
20
|
+
assert_present! :media, media
|
21
|
+
assert_present! :type, type
|
22
|
+
|
18
23
|
message = nil
|
19
24
|
File.open(media) do |io|
|
20
25
|
message = ::HTTPClient.new.post "https://api.weixin.qq.com/shakearound/material/add?access_token=#{access_token}&type=#{type}", { media: io }
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::Page
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 查询页面列表
|
8
7
|
# 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
|
@@ -29,7 +28,12 @@ class Wechat::ShakeAround::Page
|
|
29
28
|
# errmsg: 'success.'
|
30
29
|
# }
|
31
30
|
def self.index(access_token, offset, limit)
|
32
|
-
|
31
|
+
|
32
|
+
assert_present! :access_token, access_token
|
33
|
+
assert_present! :offset, offset
|
34
|
+
assert_present! :limit, limit
|
35
|
+
|
36
|
+
message = post_json "https://api.weixin.qq.com/shakearound/page/search?access_token=#{access_token}", body:
|
33
37
|
{
|
34
38
|
type: 2,
|
35
39
|
begin: offset.to_i,
|
@@ -65,7 +69,11 @@ class Wechat::ShakeAround::Page
|
|
65
69
|
#
|
66
70
|
# page_id 可以是数字、整数或者它们的数组。
|
67
71
|
def self.load(access_token, page_id)
|
68
|
-
|
72
|
+
|
73
|
+
assert_present! :access_token, access_token
|
74
|
+
assert_present! :page_id, page_id
|
75
|
+
|
76
|
+
message = post_json "https://api.weixin.qq.com/shakearound/page/search?access_token=#{access_token}", body:
|
69
77
|
{
|
70
78
|
type: 1,
|
71
79
|
page_ids: normalize_page_ids(page_id)
|
@@ -83,7 +91,11 @@ class Wechat::ShakeAround::Page
|
|
83
91
|
# errmsg: 'success.'
|
84
92
|
# }
|
85
93
|
def self.destroy(access_token, page_id)
|
86
|
-
|
94
|
+
|
95
|
+
assert_present! :access_token, access_token
|
96
|
+
assert_present! :page_id, page_id
|
97
|
+
|
98
|
+
message = post_json "https://api.weixin.qq.com/shakearound/page/delete?access_token=#{access_token}", body: { page_id: page_id.to_i }
|
87
99
|
message.body
|
88
100
|
end
|
89
101
|
|
@@ -102,7 +114,16 @@ class Wechat::ShakeAround::Page
|
|
102
114
|
# comment 页面的备注信息,不超过15个汉字或30个英文字母。
|
103
115
|
# icon_link 在摇一摇页面展示的图片。图片需先上传至微信侧服务器,用“素材管理-上传图片素材”接口上传图片,返回的图片URL再配置在此处。
|
104
116
|
def self.update(access_token, page_id, title, description, comment, page_link, icon_link)
|
105
|
-
|
117
|
+
|
118
|
+
assert_present! :access_token, access_token
|
119
|
+
assert_present! :page_id, page_id
|
120
|
+
assert_present! :title, title
|
121
|
+
assert_present! :description, description
|
122
|
+
assert_present! :comment, comment
|
123
|
+
assert_present! :page_link, page_link
|
124
|
+
assert_present! :icon_link, icon_link
|
125
|
+
|
126
|
+
message = post_json "https://api.weixin.qq.com/shakearound/page/update?access_token=#{access_token}", body:
|
106
127
|
{
|
107
128
|
page_id: page_id.to_i,
|
108
129
|
title: title,
|
@@ -129,7 +150,15 @@ class Wechat::ShakeAround::Page
|
|
129
150
|
# comment 页面的备注信息,不超过15个汉字或30个英文字母。
|
130
151
|
# icon_link 在摇一摇页面展示的图片。图片需先上传至微信侧服务器,用“素材管理-上传图片素材”接口上传图片,返回的图片URL再配置在此处。
|
131
152
|
def self.create(access_token, title, description, comment, page_link, icon_link)
|
132
|
-
|
153
|
+
|
154
|
+
assert_present! :access_token, access_token
|
155
|
+
assert_present! :title, title
|
156
|
+
assert_present! :description, description
|
157
|
+
assert_present! :comment, comment
|
158
|
+
assert_present! :page_link, page_link
|
159
|
+
assert_present! :icon_link, icon_link
|
160
|
+
|
161
|
+
message = post_json "https://api.weixin.qq.com/shakearound/page/add?access_token=#{access_token}", body:
|
133
162
|
{
|
134
163
|
title: title,
|
135
164
|
description: description,
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::PageDailyReport
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 以页面为维度的数据统计接口
|
8
7
|
# 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
|
@@ -28,7 +27,11 @@ class Wechat::ShakeAround::PageDailyReport
|
|
28
27
|
# date_range is a string range like 'yyyy-mm-dd'..'yyyy-mm-dd'.
|
29
28
|
def self.index(access_token, page_id, date_range)
|
30
29
|
|
31
|
-
|
30
|
+
assert_present! :access_token, access_token
|
31
|
+
assert_present! :page_id, page_id
|
32
|
+
assert_present! :date_range, date_range
|
33
|
+
|
34
|
+
message = post_json "https://api.weixin.qq.com/shakearound/statistics/page?access_token=#{access_token}", body:
|
32
35
|
{
|
33
36
|
page_id: page_id.to_i,
|
34
37
|
begin_date: normalize_date(date_range.min),
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::PageReport
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 批量查询页面统计数据接口
|
8
7
|
# 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
|
@@ -32,8 +31,13 @@ class Wechat::ShakeAround::PageReport
|
|
32
31
|
#
|
33
32
|
# date: 指定查询日期时间戳,单位为秒。
|
34
33
|
# page_index: 指定查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页 ,从1开始。
|
35
|
-
def self.index(access_token, date, page_index
|
36
|
-
|
34
|
+
def self.index(access_token, date, page_index: 1)
|
35
|
+
|
36
|
+
assert_present! :access_token, access_token
|
37
|
+
assert_present! :date, date
|
38
|
+
assert_present! :page_index, page_index
|
39
|
+
|
40
|
+
message = post_json "https://api.weixin.qq.com/shakearound/statistics/pagelist?access_token=#{access_token}", body:
|
37
41
|
{
|
38
42
|
date: normalize_date(date),
|
39
43
|
page_index: page_index.to_i
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'jsonclient'
|
2
|
-
|
3
1
|
class Wechat::ShakeAround::Registration
|
4
2
|
|
5
|
-
extend
|
3
|
+
extend Wechat::Core::Common
|
4
|
+
extend Wechat::ShakeAround::Common
|
6
5
|
|
7
6
|
# 查询审核状态
|
8
7
|
# 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
|
@@ -24,7 +23,10 @@ class Wechat::ShakeAround::Registration
|
|
24
23
|
# audit_status: 0:审核未通过、1:审核中、2:审核已通过
|
25
24
|
# audit_time: 确定审核结果的时间戳;若状态为审核中,则该时间值为0
|
26
25
|
def self.load(access_token)
|
27
|
-
|
26
|
+
|
27
|
+
assert_present! :access_token, access_token
|
28
|
+
|
29
|
+
message = get_json "https://api.weixin.qq.com/shakearound/account/auditstatus?access_token=#{access_token}"
|
28
30
|
message.body
|
29
31
|
end
|
30
32
|
|
@@ -42,7 +44,13 @@ class Wechat::ShakeAround::Registration
|
|
42
44
|
# errmsg: 'success.'
|
43
45
|
# }
|
44
46
|
def self.create(access_token, name, phone_number, email, industry_id, qualification_links, apply_reason)
|
45
|
-
|
47
|
+
|
48
|
+
assert_present! :access_token, access_token
|
49
|
+
assert_present! :name, name
|
50
|
+
assert_present! :phone_number, phone_number
|
51
|
+
assert_present! :email, email
|
52
|
+
|
53
|
+
message = post_json "https://api.weixin.qq.com/shakearound/account/register?access_token=#{access_token}", body:
|
46
54
|
{
|
47
55
|
name: name,
|
48
56
|
phone_number: phone_number,
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
##
|
2
|
+
# 微信摇一摇周边的摇动封装类。
|
2
3
|
|
3
4
|
class Wechat::ShakeAround::Shaking
|
4
5
|
|
5
|
-
extend
|
6
|
+
extend Wechat::Core::Common
|
7
|
+
extend Wechat::ShakeAround::Common
|
6
8
|
|
7
9
|
# 获取摇周边的设备及用户信息
|
8
10
|
# http://mp.weixin.qq.com/wiki/3/34904a5db3d0ec7bb5306335b8da1faf.html
|
@@ -26,7 +28,11 @@ class Wechat::ShakeAround::Shaking
|
|
26
28
|
# errmsg: 'success.'
|
27
29
|
# }
|
28
30
|
def self.load(access_token, ticket)
|
29
|
-
|
31
|
+
|
32
|
+
assert_present! :access_token, access_token
|
33
|
+
assert_present! :ticket, ticket
|
34
|
+
|
35
|
+
message = post_json "https://api.weixin.qq.com/shakearound/user/getshakeinfo?access_token=#{access_token}", body:
|
30
36
|
{
|
31
37
|
ticket: ticket,
|
32
38
|
need_poi: 1
|
data/wechat-shake_around.gemspec
CHANGED
@@ -27,9 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = [ 'lib' ]
|
28
28
|
|
29
29
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
30
|
-
spec.add_development_dependency 'rake',
|
31
|
-
spec.add_development_dependency 'rspec',
|
30
|
+
spec.add_development_dependency 'rake', '~> 11.0'
|
31
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
32
|
|
33
|
-
spec.add_dependency 'httpclient', '
|
33
|
+
spec.add_dependency 'httpclient', '>= 2.8'
|
34
|
+
spec.add_dependency 'wechat-core', '~> 0.4'
|
34
35
|
|
35
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:
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '11.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '11.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,18 +54,32 @@ dependencies:
|
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: httpclient
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.8'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: wechat-core
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '0.4'
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '0.4'
|
69
83
|
description: Wechat Shake Around Library is a wrapper for calling the Shake Around
|
70
84
|
APIs. 微信摇周边库封装了微信摇周边API的调用。
|
71
85
|
email:
|
@@ -80,10 +94,12 @@ files:
|
|
80
94
|
- CHANGELOG.md
|
81
95
|
- CODE_OF_CONDUCT.md
|
82
96
|
- Gemfile
|
97
|
+
- Gemfile.lock
|
83
98
|
- LICENSE.txt
|
84
99
|
- README.md
|
85
100
|
- ROADMAP.md
|
86
101
|
- Rakefile
|
102
|
+
- _config.yml
|
87
103
|
- bin/console
|
88
104
|
- bin/setup
|
89
105
|
- lib/wechat/shake_around.rb
|
@@ -126,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
142
|
version: '0'
|
127
143
|
requirements: []
|
128
144
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.4
|
145
|
+
rubygems_version: 2.6.4
|
130
146
|
signing_key:
|
131
147
|
specification_version: 4
|
132
148
|
summary: Wechat Shake Around Library 微信摇周边库
|