Socket
Book a DemoInstallSign in
Socket

codec_fast_sms

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codec_fast_sms

0.1.6
bundlerRubygems
Version published
Maintainers
1
Created
Source

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:

FieldDescription
api_hostRoot url of the API.
usernameYour API username.
passwordYour API password.
senderSms 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.

FAQs

Package last updated on 03 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.