Module: SmartSMS::Template

Defined in:
lib/smart_sms/template.rb

Overview

module that handle Template

Class Method Summary collapse

Class Method Details

.create(tpl_content = '') ⇒ Object

创建新模板规则请参见: <www.yunpian.com/api/tpl.html>



29
30
31
# File 'lib/smart_sms/template.rb', line 29

def create(tpl_content = '')
  Request.post 'tpl/add.json', tpl_content: tpl_content
end

.destroy(tpl_id = '') ⇒ Object

删除模板, 需指定id



40
41
42
# File 'lib/smart_sms/template.rb', line 40

def destroy(tpl_id = '')
  Request.post 'tpl/del.json', tpl_id: tpl_id
end

.find(tpl_id = '') ⇒ Object

取自定义模板Options:

* tpl_id: 指定tpl_id时返回tpl_id对应的自定义模板. 未指定时返回所有自定义模板


22
23
24
# File 'lib/smart_sms/template.rb', line 22

def find(tpl_id = '')
  Request.post 'tpl/get.json', tpl_id: tpl_id
end

.find_default(tpl_id = '') ⇒ Object

取默认模板Options:

* tpl_id: 指定tpl_id时返回tpl_id对应的默认模板. 未指定时返回所有默认模板


13
14
15
# File 'lib/smart_sms/template.rb', line 13

def find_default(tpl_id = '')
  Request.post 'tpl/get_default.json', tpl_id: tpl_id
end

.update(tpl_id = '', tpl_content = '') ⇒ Object

更新模板, 需指定id和content



35
36
37
# File 'lib/smart_sms/template.rb', line 35

def update(tpl_id = '', tpl_content = '')
  Request.post 'tpl/update.json', tpl_id: tpl_id, tpl_content: tpl_content
end