Module: Entinfo
- Extended by:
- Entinfo
- Included in:
- Entinfo
- Defined in:
- lib/entinfo.rb,
lib/entinfo/version.rb,
lib/entinfo/configuration.rb
Defined Under Namespace
Classes: Configuration
Constant Summary collapse
- URL =
send sms
"http://sdk2.entinfo.cn:8061/mdsmssend.ashx"
- VERSION =
"0.1.5"
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object
13 14 15 |
# File 'lib/entinfo.rb', line 13 def config @config ||= Configuration.new end |
Instance Method Details
#configure {|config| ... } ⇒ Object
17 18 19 |
# File 'lib/entinfo.rb', line 17 def configure yield(config) end |
#pwd ⇒ Object
24 25 26 |
# File 'lib/entinfo.rb', line 24 def pwd Digest::MD5.hexdigest(@config.sn + @config.pwd).upcase end |
#send_sms(phone, content) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/entinfo.rb', line 28 def send_sms(phone, content) result = Net::HTTP.post_form(URI.parse("#{URL}"), sn: @config.sn, pwd: self.pwd, mobile: phone, content: content) if result.body.match '^\d{18}$' {success: result.body} else {error: result.body} end end |