Class: SMS::Client::Moonshado
- Inherits:
-
Object
- Object
- SMS::Client::Moonshado
- Defined in:
- lib/sms-client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#body ⇒ Object
Returns the value of attribute body.
-
#device_address ⇒ Object
Returns the value of attribute device_address.
-
#keyword ⇒ Object
Returns the value of attribute keyword.
-
#message ⇒ Object
Returns the value of attribute message.
-
#originating_address ⇒ Object
Returns the value of attribute originating_address.
-
#reporting_key ⇒ Object
Returns the value of attribute reporting_key.
-
#response ⇒ Object
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/sms-client.rb', line 8 def api_key @api_key end |
#body ⇒ Object
Returns the value of attribute body.
8 9 10 |
# File 'lib/sms-client.rb', line 8 def body @body end |
#device_address ⇒ Object
Returns the value of attribute device_address.
8 9 10 |
# File 'lib/sms-client.rb', line 8 def device_address @device_address end |
#keyword ⇒ Object
Returns the value of attribute keyword.
8 9 10 |
# File 'lib/sms-client.rb', line 8 def keyword @keyword end |
#message ⇒ Object
Returns the value of attribute message.
8 9 10 |
# File 'lib/sms-client.rb', line 8 def @message end |
#originating_address ⇒ Object
Returns the value of attribute originating_address.
8 9 10 |
# File 'lib/sms-client.rb', line 8 def originating_address @originating_address end |
#reporting_key ⇒ Object
Returns the value of attribute reporting_key.
8 9 10 |
# File 'lib/sms-client.rb', line 8 def reporting_key @reporting_key end |
#response ⇒ Object
Returns the value of attribute response.
8 9 10 |
# File 'lib/sms-client.rb', line 8 def response @response end |
Class Method Details
Instance Method Details
#send_sms ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sms-client.rb', line 17 def send_sms begin d = { :api_key => self.api_key, :message => { :reporting_key => self.reporting_key, :originating_address => self.originating_address, :device_address => self.device_address, :keyword => self.keyword, :body => self.body } } r = RestClient.post 'http://api.moonshado.com/gateway/sms', d #TODO We should do something about these statuses! code = Crack::XML.parse(r)["status"]["code"] rescue nil info = Crack::XML.parse(r)["status"]["info"] rescue nil puts "code:#{code} info:#{info}" rescue Exception => e raise e.response end end |