0.0
No commit activity in last 3 years
No release in over 3 years
This gem extend core gem `hey-you` for send Nexmo SMS.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.15
~> 13.0
~> 3.0
~> 3.4

Runtime

>= 1.2
~> 7.4
 Project Readme

Hey, You, Nexmo!

Build Status Gem Version

Send Nexmo (Vonage) sms via hey-you gem.

After 1.0.0 version gem depended on vonage-ruby-sdk. Early versions of gem depended on nexmo-ruby.

Installation

Add this line to your application's Gemfile:

gem 'hey-you-nexmo'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hey-you-nexmo

Usage

After load gem you can send Nexmo SMS via hey-you.

For example:

# config/notifications.yml
events:
  verified_code:
    # ...
    nexmo:
      text: 'Your verification code: %{code}'
      from: 'bestNumber'
      is_unicode: false # has priority above this setting in config
# config/initalizers/hey-you.rb
HeyYou::Config.configure do 
  # [String] required - your sender number 
  config.nexmo.from = 'myNumber'

  # [Vonage::Client] required - Instance of Nexmo client (check https://github.com/Nexmo/nexmo-ruby for more info)
  config.nexmo.client = Vonage::Client.new(...)
  
  # [Boolean] optional - If you will send unicode texts
  config.nexmo.is_unicode = true
  
  # [Block] optional - Response handle (block which accept Vonage::Response object)
  config.nexmo.response_hander = proc { |response| CheckActualBalanceJob.perform_async(response.http_response.body) }
  
  # Check https://developer.nexmo.com/api/sms#delivery-receipt for more info about settings below
  config.nexmo.ttl = 90000
  config.nexmo.status_report_req = true
  config.nexmo.callback = 'http://my_callback.url/'
end
# // somewhere in your app 
builder = Builder.new('events.verified_code', code: verified_code) 
HeyYou::Channels::Nexmo.send!(builder, to: receiver_phone_number) #=> { success: true }

If you want send sms with Google hash for sending verification SMS just use google_autofill_code_hash in your builder:

builder = Builder.new('events.verified_code', code: verified_code, google_autofill_code_hash: 'MySigningHash')
builder.text => "Your verification code: %{code}\n\nMySigningHash"

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec 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.