Class: Wechat::ApiBase
- Inherits:
-
Object
- Object
- Wechat::ApiBase
- Defined in:
- lib/wechat/api_base.rb
Constant Summary collapse
- MP_BASE =
'https://mp.weixin.qq.com/cgi-bin/'.freeze
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.
Instance Method Summary collapse
- #callbackip ⇒ Object
- #media(media_id) ⇒ Object
- #media_create(type, file) ⇒ Object
- #media_uploadimg(file) ⇒ Object
- #qrcode(ticket) ⇒ Object
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
3 4 5 |
# File 'lib/wechat/api_base.rb', line 3 def access_token @access_token end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/wechat/api_base.rb', line 3 def client @client end |
#jsapi_ticket ⇒ Object (readonly)
Returns the value of attribute jsapi_ticket.
3 4 5 |
# File 'lib/wechat/api_base.rb', line 3 def jsapi_ticket @jsapi_ticket end |
Instance Method Details
#callbackip ⇒ Object
7 8 9 |
# File 'lib/wechat/api_base.rb', line 7 def callbackip get 'getcallbackip' end |
#media(media_id) ⇒ Object
15 16 17 |
# File 'lib/wechat/api_base.rb', line 15 def media(media_id) get 'media/get', params: { media_id: media_id }, as: :file end |
#media_create(type, file) ⇒ Object
19 20 21 |
# File 'lib/wechat/api_base.rb', line 19 def media_create(type, file) post_file 'media/upload', file, params: { type: type } end |
#media_uploadimg(file) ⇒ Object
23 24 25 |
# File 'lib/wechat/api_base.rb', line 23 def media_uploadimg(file) post_file 'media/uploadimg', file end |
#qrcode(ticket) ⇒ Object
11 12 13 |
# File 'lib/wechat/api_base.rb', line 11 def qrcode(ticket) client.get 'showqrcode', params: { ticket: ticket }, base: MP_BASE, as: :file end |