0.0
No commit activity in last 3 years
No release in over 3 years
It is a simple ruby client for Codec FastSMS API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.0
~> 12.0
~> 0.79.0
~> 0.17.1
~> 3.8

Runtime

~> 0.11.0
 Project Readme

CodecFastSms Build Status

This client allows you to send sms using Codec Fast SMS API.

Installation

Add this line to your application's Gemfile:

gem 'codec_fast_sms'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install codec_fast_sms

Configuration

Client must be configured before use. Configuration fields are as:

Field Description
api_host Root url of the API.
username Your API username.
password Your API password.
sender Sms sender title.

Configuration on Rails Application:

Create a file in the config/initializers directory and configure client in this file as below: # config/initializers/codec_fast_sms.rb

CodecFastSms.configure do |config|
  config.api_host = 'https://fastsms.api.example.com'
  config.username = 'mysuperapiuser'
  config.password = 'mYsupeRsecreTqassworld'
  config.sender = 'MYSUPERCOMPANY'
end

Multiple Configuration

You can define multiple configurations separated by profile. To do this, you must pass the profile parameter to the configure definition. If the profile name is not pass in the configuration, it defaults to use :default.

Example:

In this example, to send sms , profile name specified as settings. # config/initializers/codec_otp_settings.rb

CodecFastSms.configure(:otp_user) do |config|
  config.api_host = 'https://fastsms.api.example.com'
  config.username = 'mysuperapiotpuser'
  config.password = 'mYsupeRsecreTqassworldforOtP'
  config.sender = 'MYSUPERCOMPANY'
end

Usage

Initialize a client object before starting process.

client = CodecFastSms::Client.new

To send sms, call the method deliver.

phone = '905991112233'
message = 'Dear Hayri Gülümser, your membership has been activated.'
client.deliver(phone, message)
puts client.response

Use attributes to set permission parameters:

attributes = { optionalParameters: '{ DisablePermissionFilter: true }' }
client = CodecFastSms::Client.new(attributes: attributes)

Use attributes to set IYS parameters:

iys_message_type: must take the value TICARI or BILGILENDIRME. In case the value is not given, it takes BILGILENDIRME value by default.

iys_brand_code: If iys_message_type is set as TICARI, it must be filled.

iys_recipient_type: If iys_message_type is set as TICARI, it must be filled.

attributes = {
  optionalParameters: '{ DisablePermissionFilter: true }',
  iys_message_type: 'TICARI'
  iys_brand_code: 'BC1'
  iys_recipient_type: 'RT1'
}
client = CodecFastSms::Client.new(attributes: attributes)

We can pass the profile argument on client initialization to use different configuration.

client = CodecFastSms::Client.new(profile: :dynamic_settings)
client.deliver(phone, message)

Contributing

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