Project

tww

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Send SMS from TWW provider
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.2
~> 13.0
~> 0.8
~> 6.1
~> 3.10
~> 3.13

Runtime

~> 3.2
 Project Readme

TWW

Build Status Code Climate Coverage Status

Send SMS through TWW plataform. Avoid to handle with HTTP libraries or to parse XML response.

Installation

Add this line to your application's Gemfile:

gem 'tww'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tww

Usage

To send SMS:

TWW.config do |config|
  config[:username] = 'you username goes here'
  config[:password]= 'you password goes here'
  config[:from] = 'Your identification (OPTIONAL)'
  config[:layout] = 'Layout ID (JUST FOR VOICE MESSAGES)'
  config[:endpoint] = :secondary # :primary is default
end

client = TWW.client

client.deliver('11987654321', 'Hello World using old fashioned SMS')

You can inspect TWW response:

# Previous setup
resp = client.deliver('11987654321', 'Hello World using old fashioned SMS')

case
when resp.ok?
  puts 'Everything is nice!'
when resp.nok?
  puts 'Something goes wrong'
when resp.na?
  puts 'Service not available!'
when resp.error?
  puts 'Unknow error'
end

To fake SMS:

require 'rspec'
require 'tww'

TWW.enable_testing!

RSpec.describe 'TWW Testing' do
  before
    client = TWW.client
    resp = client.deliver('11987654321', 'Hello World from TWW Gem')
  end

  it 'is not empty' do
    expect(client.sent).to_not be_empty
  end

  it 'is empty after clear'
    client.clear
    expect(client.sent).to be_empty
  end
end

Support

It supports Ruby version 2.6 and later

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/dlibanori/tww.

License

The gem is available as open source under the terms of the MIT License.