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
b97d7d00
Commit
b97d7d00
authored
Mar 19, 2014
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor menu.rb
parent
d2df2d80
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
lib/weixin_authorize/api/menu.rb
+1
-0
spec/api/menu_spec.rb
+1
-3
No files found.
lib/weixin_authorize/api/menu.rb
View file @
b97d7d00
...
@@ -20,6 +20,7 @@ module WeixinAuthorize
...
@@ -20,6 +20,7 @@ module WeixinAuthorize
# 自定义菜单创建接口
# 自定义菜单创建接口
# https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN
# https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN
def
create_menu
(
menu
)
def
create_menu
(
menu
)
menu
=
MultiJson
.
load
(
menu
)
if
menu
.
is_a?
(
String
)
create_menu_url
=
"
#{
menu_base_url
}
/create"
create_menu_url
=
"
#{
menu_base_url
}
/create"
http_post
(
create_menu_url
,
menu
)
http_post
(
create_menu_url
,
menu
)
end
end
...
...
spec/api/menu_spec.rb
View file @
b97d7d00
...
@@ -5,10 +5,8 @@ describe WeixinAuthorize::Api::Menu do
...
@@ -5,10 +5,8 @@ describe WeixinAuthorize::Api::Menu do
it
"can create a menu"
do
it
"can create a menu"
do
menu
=
'{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER"},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"http://www.soso.com/"},{"type":"view","name":"视频","url":"http://v.qq.com/"},{"type":"click","name":"赞一下我们","key":"V1001_GOOD"}]}]}'
menu
=
'{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER"},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"http://www.soso.com/"},{"type":"view","name":"视频","url":"http://v.qq.com/"},{"type":"click","name":"赞一下我们","key":"V1001_GOOD"}]}]}'
response
=
$client
.
create_menu
(
menu
)
response
=
$client
.
create_menu
(
MultiJson
.
load
(
menu
))
# or Json string
puts
response
expect
(
response
[
"errcode"
]).
to
eq
(
0
)
expect
(
response
[
"errcode"
]).
to
eq
(
0
)
end
end
it
"can get a weixin Menu info"
do
it
"can get a weixin Menu info"
do
...
...
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