Project

nexmos

0.0
No commit activity in last 3 years
No release in over 3 years
Nexmo API client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.0

Runtime

<= 5.0, >= 3.0
>= 2.1.0
 Project Readme

Nexmos Build StatusCode Climate

Nexmo API wrapper

Installation

Add this line to your application's Gemfile:

gem 'nexmos'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nexmos

Usage

Send text message

# Nexmos specific client
client = ::Nexmos::Message.new('api-key', 'api-secret')
# get result from Nexmo
res = client.send_text(from: 'your number', to: '+1234567890', text: 'Hello world!')
# check if send is success
if res.success?
  puts "ok"
else
  puts "fail"
end

Get balance

client = ::Nexmos::Account.new('api-key', 'api-secret')
res = client.get_balance
my_balance = res.value

Rails integration

You can create config/initializer/nexmos.rb file with next content:

Nexmos.setup do |n|
  n.api_key    = 'api_key'
  n.api_secret = 'api_secret'
end

And then you can call all clients without providing key and secret.

More details about api calls

More details about api calls you can found in the lib/api.yml file.

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