Class: Wechat::ApiBase
- Inherits:
-
Object
- Object
- Wechat::ApiBase
- Defined in:
- lib/wechat/api_base.rb
Constant Summary collapse
- API_BASE =
'https://api.weixin.qq.com/cgi-bin/'
- MP_BASE =
'https://mp.weixin.qq.com/cgi-bin/'
- WXA_BASE =
'https://api.weixin.qq.com/wxa/'
- OAUTH2_BASE =
'https://api.weixin.qq.com/sns/'
- DATACUBE_BASE =
'https://api.weixin.qq.com/datacube/'
- TCB_BASE =
'https://api.weixin.qq.com/tcb/'
- QYAPI_BASE =
'https://qyapi.weixin.qq.com/cgi-bin/'
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#jsapi_ticket ⇒ Object
readonly
Returns the value of attribute jsapi_ticket.
-
#qcloud ⇒ Object
readonly
Returns the value of attribute qcloud.
Instance Method Summary collapse
- #callbackip ⇒ Object
- #clear_quota ⇒ Object
- #media(media_id) ⇒ Object
- #media_create(type, file) ⇒ Object
- #media_hq(media_id) ⇒ Object
- #media_uploadimg(file) ⇒ Object
- #media_uploadnews(mpnews_message) ⇒ Object
- #qrcode(ticket) ⇒ Object
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/wechat/api_base.rb', line 5 def access_token @access_token end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/wechat/api_base.rb', line 5 def client @client end |
#jsapi_ticket ⇒ Object (readonly)
Returns the value of attribute jsapi_ticket.
5 6 7 |
# File 'lib/wechat/api_base.rb', line 5 def jsapi_ticket @jsapi_ticket end |
#qcloud ⇒ Object (readonly)
Returns the value of attribute qcloud.
5 6 7 |
# File 'lib/wechat/api_base.rb', line 5 def qcloud @qcloud end |
Instance Method Details
#callbackip ⇒ Object
15 16 17 |
# File 'lib/wechat/api_base.rb', line 15 def callbackip get 'getcallbackip' end |
#clear_quota ⇒ Object
43 44 45 |
# File 'lib/wechat/api_base.rb', line 43 def clear_quota post 'clear_quota', JSON.generate(appid: Wechat.config[:appid]) end |
#media(media_id) ⇒ Object
23 24 25 |
# File 'lib/wechat/api_base.rb', line 23 def media(media_id) get 'media/get', params: { media_id: media_id }, as: :file end |
#media_create(type, file) ⇒ Object
31 32 33 |
# File 'lib/wechat/api_base.rb', line 31 def media_create(type, file) post_file 'media/upload', file, params: { type: type } end |
#media_hq(media_id) ⇒ Object
27 28 29 |
# File 'lib/wechat/api_base.rb', line 27 def media_hq(media_id) get 'media/get/jssdk', params: { media_id: media_id }, as: :file end |
#media_uploadimg(file) ⇒ Object
35 36 37 |
# File 'lib/wechat/api_base.rb', line 35 def media_uploadimg(file) post_file 'media/uploadimg', file end |
#media_uploadnews(mpnews_message) ⇒ Object
39 40 41 |
# File 'lib/wechat/api_base.rb', line 39 def media_uploadnews() post 'media/uploadnews', .to_json end |
#qrcode(ticket) ⇒ Object
19 20 21 |
# File 'lib/wechat/api_base.rb', line 19 def qrcode(ticket) client.get 'showqrcode', params: { ticket: ticket }, base: MP_BASE, as: :file end |