class Pipl::Person

Attributes

id[R]
inferred[R]
match[R]
search_pointer[R]

Public Class Methods

from_hash(h) click to toggle source
# File lib/pipl/containers.rb, line 259
def self.from_hash(h)
  params = {
      id: h[:@id],
      match: h[:@match],
      search_pointer: h[:@search_pointer],
      inferred: h[:@inferred],
  }
  params[:fields] = fields_from_hash(h)
  self.new(params)
end
new(params={}) click to toggle source
Calls superclass method Pipl::FieldsContainer::new
# File lib/pipl/containers.rb, line 251
def initialize(params={})
  super params
  @id = params[:id]
  @match = params[:match]
  @search_pointer = params[:search_pointer]
  @inferred = params[:inferred] || false
end

Public Instance Methods

is_searchable?() click to toggle source
# File lib/pipl/containers.rb, line 277
def is_searchable?
  not @search_pointer.nil? or
      @names.any? { |f| f.is_searchable? } or
      @emails.any? { |f| f.is_searchable? } or
      @phones.any? { |f| f.is_searchable? } or
      @usernames.any? { |f| f.is_searchable? } or
      @user_ids.any? { |f| f.is_searchable? } or
      @urls.any? { |f| f.is_searchable? } or
      @addresses.any? { |f| f.is_sole_searchable? }
end
to_hash() click to toggle source
# File lib/pipl/containers.rb, line 270
def to_hash
  h = {}
  h[:search_pointer] = @search_pointer if @search_pointer and not @search_pointer.empty?
  h.update(fields_to_hash)
  h
end
unsearchable_fields() click to toggle source
# File lib/pipl/containers.rb, line 288
def unsearchable_fields
  all_fields.reject { |f| f.is_searchable? }
end