Sha256: 23b5864d58cd22dae42dbbbdf6d160c148c264315388cd95739765e4c0c3db2d

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

include BjondApi
require 'attr_encrypted'

class BjondRegistration < ActiveRecord::Base
  has_many :bjond_services
  
  
  attr_encrypted :encryption_key, key: ENV[BjondApi::BjondAppConfig.instance.encryption_key_name]

  def self.find_registration_by_remote_ip(ip)
    ip = Resolv.getaddress(ip)
    result = BjondRegistration.find_by_ip(ip)
    if (!result.nil?)
      return result
    end
    host = Resolv.getname(ip)
    host_result = BjondRegistration.find_by_host(host)
    if (!host_result.nil?)
      return host_result
    end

    return BjondRegistration.first
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bjond-api-0.1.4 app/models/bjond_registration.rb