Sha256: acee7fd4c6d93174f8c84c875dee0e094c9abba73591fa3793ea771210592cae

Contents?: true

Size: 1.39 KB

Versions: 4

Compression:

Stored size: 1.39 KB

Contents

require 'date'
require 'translit'

class InternalFunc_1

  def datetimenow_1()
    d_curr = DateTime.now
    time_zone = 'Europe/Minsk'
    #   DateTime.new
    #       .in_time_zone(time_zone)
    #       .change(year: d_curr.year, month: d_curr.month, day: d_curr.day, hour: d_curr.hour, min: d_curr.min, sec: d_curr.sec)
    d_curr.to_s
  end

  def printer_texter_wifi_1(text, log_level)
    begin
      if log_level == "debug" && Freewifi_1::LOGLEVEL_1 == "debug"
        mess = {:datetime => datetimenow_1, :sdk => "freewifi", :sdk_version => Freewifi_1::VERSION, :message => text}
        p mess
      end

    rescue
      p "Failed print message"
    end
  end

  def hub_tunnelname_generator_1(tunnel_id, company_name)
    comp_name = company_name
    "#{tunnel_id.to_s}_eoip_hub_auto_#{comp_name}"
  end

  def company_check_wifi_1(compname)
    compname2=""
    if compname.include?(" ")
      compname2 = compname.gsub(" ", "")
    else
      compname2 = compname
    end
    compname2
  end

  def prep_comp_name_for_config_1(company_name)
    res = company_name.gsub(" ", "")
    res1 = Translit.convert(res, :english)
    res1.slice(0..14)
  end

  def prep_ssid_for_config_1(ssid)
    res = ssid.gsub(" ", "_")
    res1 = Translit.convert(res, :english)
    res1.slice(0..14)
  end

  def ap_hostname_generator(company, tunnel_id)
    "#{self.prep_comp_name_for_config_1(company)}_#{tunnel_id.to_s}"
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
freewifi-0.1.8 lib/freewifi/additional/additional_functions.rb
freewifi-0.1.7 lib/freewifi/additional/additional_functions.rb
freewifi-0.1.6 lib/freewifi/additional/additional_functions.rb
freewifi-0.1.5 lib/freewifi/additional/additional_functions.rb