Module: TextBelt
- Defined in:
- lib/textbelt.rb,
lib/textbelt/errors.rb,
lib/textbelt/version.rb,
lib/textbelt/textutils.rb,
lib/textbelt/validators/phone_validator.rb,
lib/textbelt/validators/response_validator.rb
Overview
Defined Under Namespace
Modules: Errors Classes: PhoneValidator, ResponseValidator, TextUtils
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.text(phone_number, message, country = 'US') ⇒ Boolean
Get a list of categories from the service.
Class Method Details
.text(phone_number, message, country = 'US') ⇒ Boolean
Get a list of categories from the service
30 31 32 33 34 35 36 37 |
# File 'lib/textbelt.rb', line 30 def text(phone_number, , country = 'US') PhoneValidator.validate(phone_number, country) url = TextUtils.url_for(country) res = Net::HTTP.post_form(url, number: phone_number, message: ) body = JSON.parse(res.body) ResponseValidator.validate(phone_number, body) body['success'.freeze] end |