Sha256: fa3262e57b46a6de74977d9d45d0aa205e9daf3571c333a0f5e9a24274dda473

Contents?: true

Size: 584 Bytes

Versions: 5

Compression:

Stored size: 584 Bytes

Contents

include BjondApi
require 'attr_encrypted'

class BjondRegistration < ActiveRecord::Base
  has_many :BjondServices
  
  
  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

5 entries across 5 versions & 1 rubygems

Version Path
bjond-api-0.1.3 app/models/bjond_registration.rb
bjond-api-0.1.2 app/models/bjond_registration.rb
bjond-api-0.1.1 app/models/bjond_registration.rb
bjond-api-0.1.0 app/models/bjond_registration.rb
bjond-api-0.0.4 app/models/bjond_registration.rb