Giter VIP home page Giter VIP logo

ileti_merkezi's Introduction

Maintainability Codacy Badge Codacy Badge Known Vulnerabilities

IletiMerkezi

iletimerkezi.com API'lerini kullanarak toplu sms gönderme ve raporlama işlemlerini yapabilmek için hazırlanan Ruby istemcisidir.

Kurulum

Bu satırı Gemfile dosyasına ekleyin.

gem 'ileti_merkezi'

Ardından aşağıdaki komutu çalıştırın:

$ bundle

Veya kendiniz aşağıdaki komut ile sisteme kurabilirsiniz:

$ gem install ileti_merkezi

Kullanım

Yapılandırma

Rails uygulamanızda config/initializers/ileti_merkezi_configure.rb dosyası oluşturarak aşağıdaki kodları içerisine yapıştırınız.

Eğer kimlik doğrulama işlemini kullanıcı adı ve parola üzerinden yapmak istiyorsanız username ve password bilgilerini, token tabanlı yapmak istiyorsanız public_key ve secret_key bilgilerini doldurmanız gerekmektedir.

Bu dört alanda doldurulmuş ise sistem token tabanlı doğrulama yapacaktır.

public ve secret key bilgilerini https://www.iletimerkezi.com/user/preferences adresinden oluşturabilirsiniz.

IletiMerkezi.configure do |config|
  # Default: http://api.iletimerkezi.com/v1'
  config.endpoint          = 'http://api.iletimerkezi.com/v1'
  config.sender            = 'FOO'
  # opsiyonel
  config.request_overrides = {
    use_ssl: true, # default false
    verify_mode: OpenSSL::SSL::VERIFY_PEER,
    read_timeout: 30, # default 30
    open_timeout: 30 # default 30
  }
  # Kimlik Doğrulama: username ve password
  config.username = 'username'
  config.password = 'password'
  # Kimlik Doğrulama: token tabanlı
  config.public_key = 'public_key'
  config.secret_key = 'secret_key'
end

Veya

  • Ortam değişkeleri ile yapılandırabilirsiniz. bknz: .env
IM_ENDPOINT = 'http://api.iletimerkezi.com/v1' # Default: http://api.iletimerkezi.com/v1
# Kimlik Doğrulama: username ve password
IM_USERNAME = 'username'
IM_PASSWORD = 'password'
# Kimlik Doğrulama: token tabanlı
IM_PUBLIC_KEY = 'public_key'
IM_SECRET_KEY = 'secret_key'

IM_SENDER = 'SENDER'

SMS Gönderme

Tek Mesaj - Çoklu Alıcı

  args = {
    send_datetime: '15/01/2017 12:00', # Opsiyonel
    sender: 'TEST', # Opsiyonel
    phones: ['0555 555 00 01', '0555 555 00 02'],
    text: 'Test Mesajı'
  }

  # return IletiMerkezi::Response
  response = IletiMerkezi.send(args)
  # veya
  sms      = IletiMerkezi::Sms.new(args)
  response = sms.send

  response.code # return 200
  response.body # http raw body
  response.message # return status message
  response.error? # return true or false
  response.to_h
  # return hash
  {
    :status => {
      :code => "200",
      :message => "İşlem başarılı"
    },
    :order => {
      :id => "order_id"
    }
  }

Çoklu Mesaj - Çoklu Alıcı

  args = {
    send_datetime: '15/01/2017 12:00', # Opsiyonel
    sender: 'TEST', # Opsiyonel
    messages: [
      {
        text: 'Test Mesajı Bir',
        phones: ['0555 555 00 01', '0555 555 00 02'],
      },
      {
        text: 'Test Mesajı İki',
        phones: ['0555 555 00 03', '0555 555 00 04'],
      }
    ]
  }

  # return IletiMerkezi::Response
  response = IletiMerkezi.send(args)
  # veya
  sms      = IletiMerkezi::Sms.new(args)
  response = sms.send

  response.code # return 200
  response.body # http raw body
  response.message # return status message
  response.error? # return true or false
  response.to_h
  # return hash
  {
    :status => {
      :code => "200",
      :message => "İşlem başarılı"
    },
    :order => {
      :id => "order_id"
    }
  }

Zamanlamış SMS Gönderim İptali

  • Not: Yalnız gelecek ki bir zamanda gönderilecek sms siparişleri iptal edilebilir.
  # return IletiMerkezi::Response
  response = IletiMerkezi.cancel(order_id)
  # veya
  cancel   = IletiMerkezi::Cancel.new(order_id)
  response = cancel.confirm

  response.code # return 200
  response.body # http raw body
  response.message # return status message
  response.error? # return true or false
  response.to_h
  # return hash
  {
    :status => {
      :code => "200",
      :message => "İşlem başarılı"
    }
  }

Bakiye Sorgulama

  # return IletiMerkezi::Response
  response = IletiMerkezi.balance

  response.code # return 200
  response.body # http raw body
  response.message # return status message
  response.error? # return true or false
  response.to_h
  # return
  {
    :status => {
      :code => "200",
      :message => "İşlem başarılı"
    },
    :balance => {
      :amount => "1",
      :sms => "238760"
    }
  }

SMS Sipariş Raporlama

Ek Bilgi:

  • page: zorunlu değildir. Bir siparişteki alıcı sayısı row_count(1000)'den fazla ise page parametresi kullanılarak diğer rapor sayfaları için istek yapılabilir.
  • row_count: Bir sayfada göntülenecek rapor sayısı
  # return IletiMerkezi::Response
  response = IletiMerkezi.report(order_id, page: 1, row_count: 1000) # defaults: (page: 1, row_count: 1000)
  # veya
  report   = IletiMerkezi::Report.new(order_id, page: 1, row_count: 1000)
  response = report.query

  response.code # return 200
  response.body # http raw body
  response.message # return status message
  response.error? # return true or false
  response.to_h
  # return hash
  {
    :status => {
      :code => "200",
      :message =>"İşlem başarılı"
    },
    :order => {
      :id => "order_id",
      :status => "114",
      :total => "1",
      :delivered => "1",
      :undelivered => nil,
      :waiting => nil,
      :submitAt => "2018-01-16 15:08:37",
      :sendAt => "2018-01-16 15:08:00",
      :sender => "OMU UZEM",
      :price => "1",
      :status => "114",
      :message => [
        { :number=>"+9055XXXXXXXX", :status=>"111" },
        { :number=>"+9055XXXXXXXX", :status=>"111" }
      ]
    }
  }

Servis Durumu

  IletiMerkezi.status # return true or false

Hesap Bilgileri

Not: Kullanıcı adı ve paralo bilgilerinin yapılandırmada doldurulmuş olması gerekmektedir.

  IletiMerkezi.info

Hesabınıza Tanımlı Başlık Bilgileri

Not: Kullanıcı adı ve paralo bilgilerinin yapılandırmada doldurulmuş olması gerekmektedir.

  IletiMerkezi.senders

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/isubas/ileti_merkezi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the IletiMerkezi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

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.