Class: Alisms::Client
- Inherits:
-
Object
- Object
- Alisms::Client
- Defined in:
- lib/alisms/client.rb
Constant Summary collapse
- HOST =
'http://sms.market.alicloudapi.com/singleSendSms'.freeze
- PARAM =
%w(ParamString RecNum SignName TemplateCode)
Class Method Summary collapse
- .by(sign_name) ⇒ Object
- .execute ⇒ Object
- .send_sms(param_string) ⇒ Object
- .to(rec_num) ⇒ Object
- .with_template(template_code) ⇒ Object
Class Method Details
.by(sign_name) ⇒ Object
22 23 24 25 |
# File 'lib/alisms/client.rb', line 22 def by sign_name @sign_name = sign_name execute end |
.execute ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/alisms/client.rb', line 27 def execute conn = Faraday.new HOST conn.headers['Authorization'] = "APPCODE #{Alisms.appcode}" conn.params = { :ParamsString => @param_string, :RecNum => @rec_num, :SignName => @sign_name, :TemplateCode => @template_code } conn.get end |
.send_sms(param_string) ⇒ Object
12 13 14 15 |
# File 'lib/alisms/client.rb', line 12 def send_sms(param_string) @param_string = param_string self end |
.to(rec_num) ⇒ Object
7 8 9 10 |
# File 'lib/alisms/client.rb', line 7 def to(rec_num) @rec_num = rec_num self end |
.with_template(template_code) ⇒ Object
17 18 19 20 |
# File 'lib/alisms/client.rb', line 17 def with_template template_code @template_code = template_code self end |