Module: TextBelt
- Includes:
- Configurations
- 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
41 42 43 44 45 46 47 48 |
# File 'lib/textbelt.rb', line 41 def text(phone_number, , country = 'US') PhoneValidator.validate(phone_number, country) uri = TextUtils.uri_for(country) res = Net::HTTP.post_form(uri, number: phone_number, message: ) body = JSON.parse(res.body) ResponseValidator.validate(phone_number, body) body['success'.freeze] end |