Class: Wechat::SNS::AuthorizeLink
- Inherits:
-
Object
- Object
- Wechat::SNS::AuthorizeLink
- Extended by:
- Core::Common
- Defined in:
- lib/wechat/sns/authorize_link.rb
Overview
Authorize Link 是授权链接类。用于生成授权链接。如:Wechat::SNS::AuthorizeLink.create wechat_app_id, redirect_link
Constant Summary collapse
- RESPONSE_TYPE_CODE =
'code'.freeze
- SCOPE_BASE =
'snsapi_base'.freeze
- SCOPE_FULL =
'snsapi_userinfo'.freeze
Class Method Summary collapse
Class Method Details
.create(wechat_app_id, redirect_link, response_type: Wechat::SNS::AuthorizeLink::RESPONSE_TYPE_CODE, scope: Wechat::SNS::AuthorizeLink::SCOPE_FULL, state: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/wechat/sns/authorize_link.rb', line 16 def self.create(wechat_app_id, redirect_link, response_type: Wechat::SNS::AuthorizeLink::RESPONSE_TYPE_CODE, scope: Wechat::SNS::AuthorizeLink::SCOPE_FULL, state: nil) assert_present! :wechat_app_id, wechat_app_id assert_present! :redirect_link, redirect_link assert_present! :response_type, response_type assert_present! :scope, scope "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{wechat_app_id}&redirect_uri=#{CGI::escape redirect_link}&response_type=#{response_type}&scope=#{scope}&state=#{state}#wechat_redirect" end |