Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weixin_authorize
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
weixin_authorize
Commits
5f289652
Commit
5f289652
authored
Mar 20, 2014
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed new client from configure
parent
77ebcb22
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
25 deletions
+20
-25
README.md
+19
-8
lib/weixin_authorize.rb
+1
-12
spec/spec_helper.rb
+0
-5
No files found.
README.md
View file @
5f289652
...
@@ -24,18 +24,29 @@ Or install it yourself as:
...
@@ -24,18 +24,29 @@ Or install it yourself as:
```
ruby
```
ruby
$client
||=
WeixinAuthorize
.
configure
do
|
config
|
config
.
app_id
=
ENV
[
"APPID"
]
config
.
app_secret
=
ENV
[
"APPSECRET"
]
config
.
expired_at
=
Time
.
now
.
to_i
end
# Or
$client
||=
WeixinAuthorize
::
Client
.
new
(
ENV
[
"APPID"
],
ENV
[
"APPSECRET"
])
$client
||=
WeixinAuthorize
::
Client
.
new
(
ENV
[
"APPID"
],
ENV
[
"APPSECRET"
])
```
```
## Configure
*
Create file in: config/initializers/weixin_authorize.rb
```ruby
require "redis"
require "redis-namespace"
require "weixin_authorize"
# don't forget change namespace
redis = Redis.new(:host => "127.0.0.1",:port => "6379")
# We suggest you use a special db in Redis, when you need to clear all data, you can use flushdb command to clear them.
redis.select(3)
# Give a special namespace as prefix for Redis key, when your have more than one project used weixin_authorize, this config will make them work fine.
redis = Redis::Namespace.new("your_app_name:weixin_authorize", :redis => redis)
WeixinAuthorize.configure do |config|
config.redis = redis
end
```
### 获取用户管理信息
### 获取用户管理信息
*
[
获取用户基本信息
](
http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息
)
*
[
获取用户基本信息
](
http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息
)
...
...
lib/weixin_authorize.rb
View file @
5f289652
require
"rest-client"
require
"rest-client"
require
"multi_json"
require
"multi_json"
require
"weixin_authorize/
version
"
require
"weixin_authorize/
config
"
require
"weixin_authorize/api/user"
require
"weixin_authorize/api/user"
require
"weixin_authorize/api/menu"
require
"weixin_authorize/api/menu"
require
"weixin_authorize/api/custom"
require
"weixin_authorize/api/custom"
...
@@ -9,15 +9,4 @@ require "weixin_authorize/client"
...
@@ -9,15 +9,4 @@ require "weixin_authorize/client"
module
WeixinAuthorize
module
WeixinAuthorize
# @client ||= WeixinAuthorize.configure do |config|
# config.app_id = "app_id-xxxxxxx"
# config.app_secret = "app_secret-xxxxxxx"
# end
#
class
<<
self
def
configure
(
&
block
)
Client
.
new
(
&
block
)
end
end
end
end
spec/spec_helper.rb
View file @
5f289652
...
@@ -17,11 +17,6 @@ require "rspec"
...
@@ -17,11 +17,6 @@ require "rspec"
require
"weixin_authorize"
require
"weixin_authorize"
require
"multi_json"
require
"multi_json"
# $client ||= WeixinAuthorize.configure do |config|
# config.app_id = ENV["APPID"]
# config.app_secret = ENV["APPSECRET"]
# config.expired_at = Time.now.to_i
# end
$client
=
WeixinAuthorize
::
Client
.
new
(
ENV
[
"APPID"
],
ENV
[
"APPSECRET"
])
$client
=
WeixinAuthorize
::
Client
.
new
(
ENV
[
"APPID"
],
ENV
[
"APPSECRET"
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment