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
44882ef5
Commit
44882ef5
authored
Mar 16, 2014
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added file_endpoint for upload
parent
5bd539ea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
lib/weixin_authorize/client.rb
+9
-5
No files found.
lib/weixin_authorize/client.rb
View file @
44882ef5
...
...
@@ -39,16 +39,20 @@ module WeixinAuthorize
{
grant_type:
"client_credential"
,
appid:
app_id
,
secret:
app_secret
}
end
def
endpoint
def
plain_
endpoint
"https://api.weixin.qq.com/cgi-bin"
end
def
file_endpoint
"http://file.api.weixin.qq.com/cgi-bin"
end
def
access_token_param
{
access_token:
get_access_token
}
end
def
http_get_without_token
(
url
,
options
=
{})
get_api_url
=
endpoint
+
url
def
http_get_without_token
(
url
,
options
=
{}
,
endpoint
=
"plain"
)
get_api_url
=
send
(
"
#{
endpoint
}
_endpoint"
)
+
url
JSON
.
parse
(
RestClient
.
get
(
get_api_url
,
:params
=>
options
))
end
...
...
@@ -58,8 +62,8 @@ module WeixinAuthorize
end
# Refactor
def
http_post
(
url
,
options
=
{})
post_api_url
=
endpoint
+
url
+
"?access_token=
#{
get_access_token
}
"
def
http_post
(
url
,
options
=
{}
,
endpoint
=
"plain"
)
post_api_url
=
send
(
"
#{
endpoint
}
_endpoint"
)
+
url
+
"?access_token=
#{
get_access_token
}
"
JSON
.
parse
(
RestClient
.
post
(
post_api_url
,
options
))
end
...
...
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