Module: Wechat::Concern::Draft
- Included in:
- Api
- Defined in:
- lib/wechat/concern/draft.rb
Instance Method Summary collapse
- #draft_add(mpnews_articles) ⇒ Object
- #draft_batchget(offset, count, no_content: false) ⇒ Object
- #draft_count ⇒ Object
- #draft_delete(media_id) ⇒ Object
- #draft_get(media_id) ⇒ Object
- #draft_switch(checkonly: true) ⇒ Object
- #draft_update(media_id, mpnews_articles, index: 0) ⇒ Object
Instance Method Details
#draft_add(mpnews_articles) ⇒ Object
6 7 8 9 |
# File 'lib/wechat/concern/draft.rb', line 6 def draft_add(mpnews_articles) draft_add_params_hash = { articles: mpnews_articles } post 'draft/add', JSON.generate(draft_add_params_hash) end |
#draft_batchget(offset, count, no_content: false) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/wechat/concern/draft.rb', line 30 def draft_batchget(offset, count, no_content: false) draft_batchget_params_hash = { offset: offset, count: count, no_content: (no_content ? 1 : 0) } post 'draft/batchget', JSON.generate(draft_batchget_params_hash) end |
#draft_count ⇒ Object
26 27 28 |
# File 'lib/wechat/concern/draft.rb', line 26 def draft_count get 'draft/count' end |
#draft_delete(media_id) ⇒ Object
15 16 17 |
# File 'lib/wechat/concern/draft.rb', line 15 def draft_delete(media_id) post 'draft/delete', JSON.generate(media_id: media_id) end |
#draft_get(media_id) ⇒ Object
11 12 13 |
# File 'lib/wechat/concern/draft.rb', line 11 def draft_get(media_id) post 'draft/get', JSON.generate(media_id: media_id) end |
#draft_switch(checkonly: true) ⇒ Object
37 38 39 |
# File 'lib/wechat/concern/draft.rb', line 37 def draft_switch(checkonly: true) post 'draft/switch', nil, params: { checkonly: (checkonly ? 1 : 0) } end |
#draft_update(media_id, mpnews_articles, index: 0) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/wechat/concern/draft.rb', line 19 def draft_update(media_id, mpnews_articles, index: 0) draft_update_params_hash = { media_id: media_id, index: index, articles: mpnews_articles } post 'draft/update', JSON.generate(draft_update_params_hash) end |