Class: DirectSms::Message
- Inherits:
-
Object
- Object
- DirectSms::Message
- Includes:
- HTTParty
- Defined in:
- lib/direct_sms/message.rb
Instance Attribute Summary collapse
-
#max_segments ⇒ Object
Returns the value of attribute max_segments.
-
#message ⇒ Object
Returns the value of attribute message.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#to ⇒ Object
Returns the value of attribute to.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #credit_balance ⇒ Object
-
#initialize(attrs = {}) ⇒ Message
constructor
A new instance of Message.
- #send_message ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Message
Returns a new instance of Message.
12 13 14 |
# File 'lib/direct_sms/message.rb', line 12 def initialize(attrs = {}) attrs.each { |k, v| self.send("#{k}=", v) } end |
Instance Attribute Details
#max_segments ⇒ Object
Returns the value of attribute max_segments.
10 11 12 |
# File 'lib/direct_sms/message.rb', line 10 def max_segments @max_segments end |
#message ⇒ Object
Returns the value of attribute message.
10 11 12 |
# File 'lib/direct_sms/message.rb', line 10 def @message end |
#message_id ⇒ Object
Returns the value of attribute message_id.
10 11 12 |
# File 'lib/direct_sms/message.rb', line 10 def @message_id end |
#to ⇒ Object
Returns the value of attribute to.
10 11 12 |
# File 'lib/direct_sms/message.rb', line 10 def to @to end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/direct_sms/message.rb', line 10 def type @type end |
Instance Method Details
#credit_balance ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/direct_sms/message.rb', line 16 def credit_balance = { query: fetch_credentials } response = self.class.get("/s3/http/get_balance", ) # returns credit: 50.0 response = response.split(" ").last response end |
#send_message ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/direct_sms/message.rb', line 24 def = { query: fetch_credentials.merge(message: , to: to, max_segments: max_segments, type: type, messageid: ) } self.class.get("/s3/http/send_message", ) end |