Coder Social home page Coder Social logo

locasms's Introduction

locasms

Gem Version Build Status Code Climate CC Coverage Inline docs

โš ๏ธ After February, 10, 2018 the base IP of the service will change as noticed on this issue. If you don't upgrade to version 0.3.1 your app will stop delivering SMS.

Client to consume API's from LocaSMS and its Short Code SMS version SMS Plataforma.

Installation

Add this line to your application's Gemfile:

gem 'locasms'

And then execute:

$ bundle

Or install it yourself as:

$ gem install locasms

Usage

Simple example:

require 'locasms'

# Default:
cli = LocaSMS::Client.new 'LOGIN', 'PASSWORD'

# Short Code:
cli = LocaSMS::Client.new 'LOGIN', 'PASSWORD', type: :shortcode

# With default url callback (optional):
cli = LocaSMS::Client.new 'LOGIN', 'PASSWORD', url_callback: 'http://url.to/callback'

# delivering message to one mobile
cli.deliver 'my message', '1155559999'

# delivering the same message to multiple mobliles at once
cli.deliver 'my message', '1199998888,5500002222'
cli.deliver 'my message', '1199998888', '5500002222'
cli.deliver 'my message', ['1199998888', '5500002222']
cli.deliver 'my message', %w(1199998888 5500002222)

# delivering message with url callback
cli.deliver 'my message', '1155559999', url_callback: 'http://url.to/callback'

# scheduling the deliver of a message to one mobile
cli.deliver_at 'my message', '2013-10-12 20:33:00', '1155559999'

# scheduling the deliver of a message to multiple mobiles at once
cli.deliver_at 'my message', '2013-10-12 20:33:00', '1199998888,5500002222'
cli.deliver_at 'my message', '2013-10-12 20:33:00', '1199998888', '5500002222'
cli.deliver_at 'my message', '2013-10-12 20:33:00', ['1199998888', '5500002222']
cli.deliver_at 'my message', '2013-10-12 20:33:00', %w(1199998888 5500002222)

# scheduling the deliver of a message with url callback
cli.deliver_at 'my message', '2013-10-12 20:33:00', '1155559999', url_callback: 'http://url.to/callback'

# geting the remaining balance
cli.balance

# geting the status of a campaign
cli.campaign_status '0000'

# holding a campaign
cli.campaign_hold '0000'

# resuming a campaign
cli.campaign_release '0000'

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.