Sha256: 4c57e634a6df1021f50def1dd5d71f72d03ead75a196ae8ab499d8c2c3af5585

Contents?: true

Size: 609 Bytes

Versions: 7

Compression:

Stored size: 609 Bytes

Contents

include BjondApi
require 'attr_encrypted'

class BjondRegistration < ActiveRecord::Base
  has_many :bjond_services, :dependent => :destroy
  
  
  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

7 entries across 7 versions & 1 rubygems

Version Path
bjond-api-0.2.5 app/models/bjond_registration.rb
bjond-api-0.2.4 app/models/bjond_registration.rb
bjond-api-0.2.3 app/models/bjond_registration.rb
bjond-api-0.2.2 app/models/bjond_registration.rb
bjond-api-0.2.1 app/models/bjond_registration.rb
bjond-api-0.2.0 app/models/bjond_registration.rb
bjond-api-0.1.5 app/models/bjond_registration.rb