blsm-mp-wx 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/README.md +102 -5
- data/lib/blsm-mp-wx/version.rb +1 -1
- data/lib/blsm-mp-wx.rb +2 -2
- metadata +24 -25
- data/blsm-mp-wx-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MmQxMzIwNWM5OWI2MGRiNjc4NmJiNzdjNDUyODM4ZDkzZGI4ZjdjOQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9198ed4ec27c2e45162e9e5af6437ca8a6ed79c1
|
4
|
+
data.tar.gz: 7ab7ad90f4163fb7cfa87cf516085c0d56ea0a0b
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MWI0M2E3NGRkYzRlMTQyYjQ1MzI2NzU1NDdlMmQyZGJkYWYyZDMxODk2OTk3
|
11
|
-
NmEyZWRlMzY5NDM3YzEwNDk3OWJiNTQwZTc2YWM1YzFiMmQ5NmU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ODFjMWVlMTRhNzk5MDczZDczNGUzMDA1MjQ1MWFjZGE1NTA3MzdkZDFiNTIx
|
14
|
-
MzNhYWE4M2UzMmZhNTY3NTEzMzkzZDhkZGEwNmE5MDJiY2UzNjM3NTUwNWJj
|
15
|
-
MmQ0NmJhMzIyMDk1OGExYjIzNWNkM2IwZTRlNzkwMThiYmZlZGQ=
|
6
|
+
metadata.gz: 75b14ab8d8b12bf9f87e567af2735d869025f2de050518a1b7b1a383fa4eca4a20eaa0ccce25470cdb42c65788adef1ff56990f2ceb652a4213d1f77dcb1b745
|
7
|
+
data.tar.gz: 38e6ad201a3b3eff7eba8c6e785765a86efaf25748b7e4648a282620abb8d1e172f12fb5c781f5ad15861acd04e0ddceb994cb8560c3d7df92601654bddc92f2
|
data/README.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
-
#
|
1
|
+
# BlsmMpWx
|
2
2
|
|
3
|
-
|
3
|
+
首趣微店微信公众号相关,包含了获取access_token、jsapi_ticket、用户详情、二维码、长短连接转换、发送消息等。依赖于正式环境数据库。
|
4
|
+
|
5
|
+
### 包含的model
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
VdMpMsg #消息通知
|
9
|
+
VdMpWx #微信公众号基本信息
|
10
|
+
```
|
4
11
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
12
|
|
7
13
|
## Installation
|
8
14
|
|
@@ -20,9 +26,100 @@ Or install it yourself as:
|
|
20
26
|
|
21
27
|
$ gem install blsm-mp-wx
|
22
28
|
|
23
|
-
##
|
29
|
+
## 用法
|
30
|
+
|
31
|
+
### 初始化gem
|
32
|
+
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
#config/initializers/blsm_mp_wx.rb
|
36
|
+
BlsmMpWx.APP_ID='you_app_id' #默认的app_id
|
37
|
+
BlsmMpWx.APP_ID_2='another_app_id' #
|
38
|
+
```
|
39
|
+
|
40
|
+
### 获取 access_token
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
r = BlsmMpWx.access_token
|
44
|
+
puts "#{r}\n"
|
45
|
+
#=> awalk19233w123e09112ewq321as232
|
46
|
+
```
|
47
|
+
|
48
|
+
|
49
|
+
### 获取js_api_ticket
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
r = BlsmMpWx.js_api_ticket
|
53
|
+
puts "#{r}\n"
|
54
|
+
#=> awalk19233w123e09112ewq321as232
|
55
|
+
```
|
56
|
+
|
57
|
+
### 发送消息
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
r = BlsmMpWx.send_msg(nil, 'oOx9us4iLrID8v1MRg6KEvPXMZuY',
|
61
|
+
{
|
62
|
+
touser: "oOx9us4iLrID8v1MRg6KEvPXMZuY",
|
63
|
+
msgtype: "text",
|
64
|
+
text:
|
65
|
+
{
|
66
|
+
content: "Hello World"
|
67
|
+
}
|
68
|
+
}
|
69
|
+
)
|
70
|
+
puts "#{r}\n"
|
71
|
+
#=> true
|
72
|
+
```
|
73
|
+
|
74
|
+
### 获取js_api 签名
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
r = BlsmMpWx.js_api_sign_package(nil, 'http://test.wunion.4007060700.com')
|
78
|
+
puts "#{r}\n"
|
79
|
+
#=> awalk19233w123e09112ewq321as232
|
80
|
+
```
|
81
|
+
|
82
|
+
|
83
|
+
### 获取用户详情
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
r = BlsmMpWx.gen_wx_user_info(nil, 'oOx9us4iLrID8v1MRg6KEvPXMZuY')
|
87
|
+
puts "#{r}\n"
|
88
|
+
expect(r[:headimgurl]).to match /^http:\/\//
|
89
|
+
```
|
90
|
+
|
91
|
+
|
92
|
+
### 获取永久二维码
|
24
93
|
|
25
|
-
|
94
|
+
```ruby
|
95
|
+
r = BlsmMpWx.gen_forever_qr_ticket(nil, '181')
|
96
|
+
puts "#{r}\n"
|
97
|
+
expect(r).to match /\w{30,100}/
|
98
|
+
```
|
99
|
+
|
100
|
+
|
101
|
+
### 长连接转短连接
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
r = BlsmMpWx.gen_short_url(nil, 'http://test.wunion.4007060700.com')
|
105
|
+
puts "#{r}\n"
|
106
|
+
expect(r).to match /^http:\/\//
|
107
|
+
```
|
108
|
+
|
109
|
+
### 将消息添加到队列
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
msg_content = {touser: 'ogcP4jvEx22o_BsFu03g95jHcQqw',
|
113
|
+
order_id: 'cd94ac361215014072b83064a356812c',
|
114
|
+
msg_to: 'buyer'}
|
115
|
+
# r = BlsmMpWx.create_msg(nil, 'oOx9us4iLrID8v1MRg6KEvPXMZuY', msg_content, 'score_change')
|
116
|
+
r = BlsmMpWx.create_msg('wx75766c8f4f06701f', msg_content[:touser], msg_content, 'new_order')
|
117
|
+
msg_content[:msg_to]='seller'
|
118
|
+
msg_content[:touser]='oOx9us4iLrID8v1MRg6KEvPXMZuY'
|
119
|
+
r = BlsmMpWx.create_msg(nil, msg_content[:touser], msg_content, 'new_order')
|
120
|
+
puts "#{r.inspect}\n"
|
121
|
+
expect(r.id>0).to eq(true)
|
122
|
+
```
|
26
123
|
|
27
124
|
## Development
|
28
125
|
|
data/lib/blsm-mp-wx/version.rb
CHANGED
data/lib/blsm-mp-wx.rb
CHANGED
@@ -220,13 +220,13 @@ module BlsmMpWx
|
|
220
220
|
app_id ||= self.APP_ID
|
221
221
|
return nil unless openid
|
222
222
|
return nil unless content[:touser]==openid
|
223
|
-
return nil unless %w(new_order balance score_change custom).include?(msg_name)
|
223
|
+
return nil unless %w(new_order balance score_change distribute custom).include?(msg_name)
|
224
224
|
VdMpMsg.create({
|
225
225
|
app_id: app_id,
|
226
226
|
openid: openid,
|
227
227
|
content: content.to_json,
|
228
228
|
msg_name: msg_name,
|
229
|
-
template_msg: %w(new_order balance score_change).include?(msg_name),
|
229
|
+
template_msg: %w(new_order balance score_change distribute).include?(msg_name),
|
230
230
|
status: 'none'
|
231
231
|
})
|
232
232
|
end
|
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blsm-mp-wx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.9'
|
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
40
|
version: '1.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.2'
|
62
62
|
type: :development
|
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: '3.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mysql2
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.3.16
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.3.16
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: activemodel
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.2'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: activerecord
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '3.2'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '3.2'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: activesupport
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '3.2'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.2'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: faraday
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0.9'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.9'
|
139
139
|
description: 包括access_token、js_api_ticket的获取,发送消息,模板消息,生成二维码,获取用户信息等。
|
@@ -143,15 +143,14 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
-
- .gitignore
|
147
|
-
- .travis.yml
|
146
|
+
- ".gitignore"
|
147
|
+
- ".travis.yml"
|
148
148
|
- Gemfile
|
149
149
|
- Gemfile.lock
|
150
150
|
- README.md
|
151
151
|
- Rakefile
|
152
152
|
- bin/console
|
153
153
|
- bin/setup
|
154
|
-
- blsm-mp-wx-0.1.0.gem
|
155
154
|
- blsm-mp-wx.gemspec
|
156
155
|
- lib/blsm-mp-wx.rb
|
157
156
|
- lib/blsm-mp-wx/model/active_record.rb
|
@@ -169,12 +168,12 @@ require_paths:
|
|
169
168
|
- lib
|
170
169
|
required_ruby_version: !ruby/object:Gem::Requirement
|
171
170
|
requirements:
|
172
|
-
- -
|
171
|
+
- - ">="
|
173
172
|
- !ruby/object:Gem::Version
|
174
173
|
version: '0'
|
175
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
175
|
requirements:
|
177
|
-
- -
|
176
|
+
- - ">="
|
178
177
|
- !ruby/object:Gem::Version
|
179
178
|
version: '0'
|
180
179
|
requirements: []
|
data/blsm-mp-wx-0.1.0.gem
DELETED
Binary file
|