<commit_before># encoding: UTF-8
require 'net/http'
require 'openssl'
require 'uri'
require 'russian'

module Mfms
  class SMS

    attr_accessor :phone, :subject, :message, :account, :login, :password, :server, :cert, :port, :ssl_port, :ssl
    attr_reader :id, :status, :errors

    def initialize(data)
      @phone = data.fetch(:phone, nil)
      @subject = data.fetch(:subject, nil)
      @message = data.fetch(:message, nil)
      @status = 'not-sent'
      account = "@@#{data[:account]}".to_sym
      account_variable = if account.present? && self.class.class_variables.include?(account)
                           account
                         else
                           self.class.default_account
                         end
      account_settings = self.class.class_variable_get(account_variable)
      @login = account_settings[:login]
      @connector = account_settings[:connector]
      @password = account_settings[:password]
      @ssl = account_settings[:ssl]
      @ssl_port = account_settings[:ssl_port]
      @port = account_settings[:port]
      @cert = account_settings[:cert]
      @server = account_settings[:server]
      @translit = data.fetch(:translit, account_settings[:translit])<commit_msg>raise error on wrong account name<commit_after># encoding: UTF-8
require 'net/http'
require 'openssl'
require 'uri'
require 'russian'

module Mfms
  class SMS

    attr_accessor :phone, :subject, :message, :account, :login, :password, :server, :cert, :port, :ssl_port, :ssl
    attr_reader :id, :status, :errors

    def initialize(data)
      @phone = data.fetch(:phone, nil)
      @subject = data.fetch(:subject, nil)
      @message = data.fetch(:message, nil)
      @status = 'not-sent'
      account_name = data[:account]
      account_variable = if account_name.present?
                           var_name = "@@#{account_name}".to_sym
                           if self.class.class_variables.include?(var_name)
                             var_name
                           else
                             raise ArgumentError, "Account with name '#{account_name}' is not defined"
                           end
                         else
                           self.class.default_account
                         end
      account_settings = self.class.class_variable_get(account_variable)
      @login = account_settings[:login]
      @connector = account_settings[:connector]
      @password = account_settings[:password]
      @ssl = account_settings[:ssl]
      @ssl_port = account_settings[:ssl_port]
      @port = account_settings[:port]
      @cert = account_settings[:cert]
      @server = account_settings[:server]
      @translit = data.fetch(:translit, account_settings[:translit])
{'fraction_non_alphanumeric': 0.11131386861313869, 'fraction_numerical': 0.00072992700729927, 'mean_word_length': 2.396530359355638, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3462489', 'n_tokens_mistral': 765, 'n_tokens_neox': 756, 'n_words': 168}