Class: SMSApi::SMS::Message
- Inherits:
-
Object
- Object
- SMSApi::SMS::Message
- Defined in:
- lib/client_smsapi/sms/message.rb,
lib/client_smsapi/sms/message/eco.rb,
lib/client_smsapi/sms/message/pro.rb,
lib/client_smsapi/sms/message/2way.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(to:, from:, body:) ⇒ Message
constructor
A new instance of Message.
- #to_params ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(to:, from:, body:) ⇒ Message
Returns a new instance of Message.
10 11 12 13 14 |
# File 'lib/client_smsapi/sms/message.rb', line 10 def initialize(to:, from:, body:) @to = to @from = from @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/client_smsapi/sms/message.rb', line 8 def body @body end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
8 9 10 |
# File 'lib/client_smsapi/sms/message.rb', line 8 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
8 9 10 |
# File 'lib/client_smsapi/sms/message.rb', line 8 def to @to end |
Instance Method Details
#to_params ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/client_smsapi/sms/message.rb', line 23 def to_params @params ||= { from: from.to_s, to: to.to_s, message: body } end |
#valid? ⇒ Boolean
16 17 18 19 20 21 |
# File 'lib/client_smsapi/sms/message.rb', line 16 def valid? @valid ||= begin Validators::MessageBodyValidator.valid_body?(body) Validators::PhoneNumberValidator.valid_number?(to) end end |