wechat-shake_around 0.1 → 0.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 +10 -0
- data/README.md +14 -2
- data/ROADMAP.md +16 -16
- data/lib/wechat/shake_around/icon.rb +21 -0
- data/lib/wechat/shake_around/license.rb +21 -0
- data/lib/wechat/shake_around/material.rb +26 -0
- data/lib/wechat/shake_around/version.rb +1 -1
- data/lib/wechat/shake_around.rb +4 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e102315cc13dfe3d238a019e7a85f7cd6853fe8
|
4
|
+
data.tar.gz: 5944ee82cdf04422f193ecebb15ee85e516c0810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45ca0df390ead9e92a6488fc51a694c9573fe22d4d1491b43d4a1d86c02f6610b628330b7e1c0a8d09ba3fd0f0847b12bfdf112a9bf46dfe05a813b533456dc
|
7
|
+
data.tar.gz: 06c1162d9761a1d54e51ccf4f370499990cba4e91b5a0284e5e95ffb4190ff0d01bffa48a603e6ef53e51a20d5498e50614aead812fe0a313993679f946e9119
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/wechat-shake_around.svg)](https://badge.fury.io/rb/wechat-shake_around)
|
5
5
|
|
6
6
|
The Wechat Shake Around Library is a code base to call the Wechat Shake Around APIs.
|
7
|
-
|
7
|
+
微信摇周边库用于调用[微信摇周边API](http://mp.weixin.qq.com/wiki/19/9fe9fdbb50fee9f9660438c551142ccf.html)。
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -24,7 +24,19 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
|
27
|
+
```ruby
|
28
|
+
response = ::Wechat::ShakeAround::Shaking.load access_token, params[:ticket]
|
29
|
+
if response.present? && 0==response['errcode']
|
30
|
+
page_id = response['page_id']
|
31
|
+
open_id = response['openid']
|
32
|
+
poi_id = response['poi_id']
|
33
|
+
beacon = response['beacon_info']
|
34
|
+
beacon_distance = beacon['distance']
|
35
|
+
beacon_uuid = beacon['uuid']
|
36
|
+
beacon_major = beacon['major']
|
37
|
+
beacon_minor = beacon['minor']
|
38
|
+
end
|
39
|
+
```
|
28
40
|
|
29
41
|
## Development
|
30
42
|
|
data/ROADMAP.md
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
# Wechat Shake Around Road Map 微信摇周边库路线图
|
2
2
|
|
3
3
|
## v0.1
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
1. Common module
|
5
|
+
2. Beacon wrapper class
|
6
|
+
3. Shaking wrapper class
|
7
7
|
|
8
8
|
## v0.2
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
1. Material module
|
10
|
+
2. Icon wrapper class
|
11
|
+
3. License wrapper class
|
12
12
|
|
13
13
|
## v0.3
|
14
|
-
|
15
|
-
|
14
|
+
1. Page wrapper class
|
15
|
+
2. Beacon Page Relation wrapper class
|
16
16
|
|
17
17
|
## v0.4
|
18
|
-
|
19
|
-
|
18
|
+
1. Page Report wrapper class
|
19
|
+
2. Page Daily Report wrapper class
|
20
20
|
|
21
21
|
## v0.5
|
22
|
-
|
23
|
-
|
22
|
+
1. Group wrapper class
|
23
|
+
2. Device Group Relation wrapper class
|
24
24
|
|
25
25
|
## v0.6
|
26
|
-
|
27
|
-
|
26
|
+
1. Device Report wrapper class
|
27
|
+
2. Device Daily Report wrapper class
|
28
28
|
|
29
29
|
## v0.7
|
30
|
-
|
30
|
+
1. Apply wrapper class
|
31
31
|
|
32
32
|
## v0.8
|
33
|
-
|
33
|
+
2. Beacon PoI Relation wrapper class
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Wechat::ShakeAround::Icon
|
2
|
+
|
3
|
+
extend ::Wechat::ShakeAround::Common
|
4
|
+
extend ::Wechat::ShakeAround::Material
|
5
|
+
|
6
|
+
# 上传图片素材
|
7
|
+
# http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
|
8
|
+
#
|
9
|
+
# Return hash format if success:
|
10
|
+
# {
|
11
|
+
# data: { pic_url: <ICON_LINK> },
|
12
|
+
# errcode: 0,
|
13
|
+
# errmsg: 'success.'
|
14
|
+
# }
|
15
|
+
#
|
16
|
+
# media 图片完整路径。
|
17
|
+
def self.create(access_token, media)
|
18
|
+
upload access_token, media, 'icon'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Wechat::ShakeAround::License
|
2
|
+
|
3
|
+
extend ::Wechat::ShakeAround::Common
|
4
|
+
extend ::Wechat::ShakeAround::Material
|
5
|
+
|
6
|
+
# 上传图片素材
|
7
|
+
# http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
|
8
|
+
#
|
9
|
+
# Return hash format if success:
|
10
|
+
# {
|
11
|
+
# data: { pic_url: <ICON_LINK> },
|
12
|
+
# errcode: 0,
|
13
|
+
# errmsg: 'success.'
|
14
|
+
# }
|
15
|
+
#
|
16
|
+
# media 图片完整路径。
|
17
|
+
def self.create(access_token, media)
|
18
|
+
upload access_token, media, 'license'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'httpclient'
|
2
|
+
|
3
|
+
module Wechat::ShakeAround::Material
|
4
|
+
|
5
|
+
# 上传图片素材
|
6
|
+
# http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
|
7
|
+
#
|
8
|
+
# Return hash format if success:
|
9
|
+
# {
|
10
|
+
# data: { pic_url: <ICON_LINK> },
|
11
|
+
# errcode: 0,
|
12
|
+
# errmsg: 'success.'
|
13
|
+
# }
|
14
|
+
#
|
15
|
+
# media 图片完整路径。
|
16
|
+
# type 是icon或者license。
|
17
|
+
def upload(access_token, media, type)
|
18
|
+
message = nil
|
19
|
+
File.open(media) do |io|
|
20
|
+
message = ::HTTPClient.new.post "https://api.weixin.qq.com/shakearound/material/add?access_token=#{access_token}&type=#{type}", { media: io }
|
21
|
+
end
|
22
|
+
body = message.try :body
|
23
|
+
body.present? ? JSON.parse(body) : nil
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/wechat/shake_around.rb
CHANGED
@@ -4,6 +4,10 @@ require 'wechat/shake_around/common'
|
|
4
4
|
require 'wechat/shake_around/shaking'
|
5
5
|
require 'wechat/shake_around/beacon'
|
6
6
|
|
7
|
+
require 'wechat/shake_around/material'
|
8
|
+
require 'wechat/shake_around/icon'
|
9
|
+
require 'wechat/shake_around/license'
|
10
|
+
|
7
11
|
module Wechat
|
8
12
|
module ShakeAround
|
9
13
|
# Your code goes here...
|
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.
|
4
|
+
version: '0.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: 2016-02-
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,9 @@ files:
|
|
89
89
|
- lib/wechat/shake_around.rb
|
90
90
|
- lib/wechat/shake_around/beacon.rb
|
91
91
|
- lib/wechat/shake_around/common.rb
|
92
|
+
- lib/wechat/shake_around/icon.rb
|
93
|
+
- lib/wechat/shake_around/license.rb
|
94
|
+
- lib/wechat/shake_around/material.rb
|
92
95
|
- lib/wechat/shake_around/shaking.rb
|
93
96
|
- lib/wechat/shake_around/version.rb
|
94
97
|
- wechat-shake_around.gemspec
|