Module: Chuanglan
- Defined in:
- lib/chuanglan.rb,
lib/chuanglan/request.rb,
lib/chuanglan/version.rb,
lib/chuanglan/international.rb,
lib/chuanglan/request_exception.rb
Defined Under Namespace
Classes: International, Request, RequestException
Constant Summary collapse
- GATEWAY =
'https://sms.253.com'
- VERSION =
"1.1.1"
Class Attribute Summary collapse
-
.password ⇒ Object
Returns the value of attribute password.
-
.signature ⇒ Object
Returns the value of attribute signature.
-
.timeout ⇒ Object
Returns the value of attribute timeout.
-
.username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Class Attribute Details
.password ⇒ Object
Returns the value of attribute password.
11 12 13 |
# File 'lib/chuanglan.rb', line 11 def password @password end |
.signature ⇒ Object
Returns the value of attribute signature.
11 12 13 |
# File 'lib/chuanglan.rb', line 11 def signature @signature end |
.timeout ⇒ Object
Returns the value of attribute timeout.
11 12 13 |
# File 'lib/chuanglan.rb', line 11 def timeout @timeout end |
.username ⇒ Object
Returns the value of attribute username.
11 12 13 |
# File 'lib/chuanglan.rb', line 11 def username @username end |
Class Method Details
.balance ⇒ Object
21 22 23 24 |
# File 'lib/chuanglan.rb', line 21 def balance rsp = Request.new("#{GATEWAY}/msg/balance", un: username, pw: password).perform success_or_raise_exception(rsp).to_i end |
.send_to!(recipients, message, params = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/chuanglan.rb', line 13 def send_to!(recipients, , params = {}) params = base_params.merge(params) params[:phone] = Array(recipients).join(',') params[:msg] = "#{params.delete(:signature) || signature}#{}" rsp = Request.new("#{GATEWAY}/msg/send", params).perform success_or_raise_exception(rsp) end |