Skip to content
Snippets Groups Projects

Smsinfo config

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Tomáš Kuča
    bedna.rb 1.59 KiB
    # frozen_string_literal: true
    
    Smsinfo::Model.new(:bedna, 'bedna-2020') do
      parser :bedna
      locale 'cs-bedna'
      validate_datetime true
    
      receive_with QrCode
      receive_with Web
      # receive_with Console
    
      process_messages do |p|
        p.wait      30
        p.channels  [Sender::CHANNEL_VOID, Sender::CHANNEL_FIREBASE]
      end
    
      send_hints do |p|
        p.wait      30
        p.channels  [Sender::CHANNEL_VOID, Sender::CHANNEL_FIREBASE]
      end
    
      notify do |notify|
        notify.events     [:reached, :finished]
        notify.condition  ->(msg) { msg.team.rank! == 1 }
        notify.contacts   ->(msg) { msg.team.game.organizers.map(&:identification).compact.map(&:firebase_notification_key).compact }
        notify.channels   Sender::CHANNEL_FIREBASE
      end
    
      send_with Smtp do |smtp|
        smtp.from          'smsinfo@seslost.cz'
        smtp.wait          30
        smtp.channels      Sender::CHANNEL_EMAIL
      end
    
      send_with SmsManager do |sms|
        sms.url               ENV['SMSINFO_ENV'] == 'production' ? 'https://xml-api.smsmanager.cz/Send' : 'https://localhost'
        sms.login             Smsinfo.secrets[:tomas][:sms_manager][:login]
        sms.password_hash     Smsinfo.secrets[:tomas][:sms_manager][:password_hash]
        sms.wait              10
        sms.request_type      'high'
        sms.truncate          160
        sms.strip_diacritics  true
        sms.channels Sender::CHANNEL_SMS
      end
      if ENV['SMSINFO_ENV'] == 'production'
        send_with Firebase do |sms|
          sms.api_key Smsinfo.secrets[:firebase][:api_key]
          sms.project_name Smsinfo.secrets[:firebase][:project_id]
          sms.channels Sender::CHANNEL_FIREBASE
          sms.wait 10
        end
      end
    end
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment