Class: Pipl::Url

Inherits:
Field show all
Defined in:
lib/pipl/fields.rb

Instance Attribute Summary collapse

Attributes inherited from Field

#current, #inferred, #last_seen, #valid_since

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Field

base_params_from_hash, from_hash

Methods included from Utils

alnum_chars, alpha_chars, date_to_str, extract_rate_limits, is_valid_url?, str_to_date, titleize, to_utf8

Constructor Details

#initialize(params = {}) ⇒ Url

Returns a new instance of Url.



548
549
550
551
552
553
554
555
556
# File 'lib/pipl/fields.rb', line 548

def initialize(params={})
  super params
  @url = params[:url]
  @category = params[:category]
  @domain = params[:domain]
  @name = params[:name]
  @sponsored = params[:sponsored]
  @source_id = params[:source_id]
end

Instance Attribute Details

#categoryString

Possible values are:

background_reports
contact_details
email_address
media
personal_profiles
professional_and_business
public_records
publications
school_and_classmates
web_pages

Returns:

  • (String)

    Category of the domain



546
# File 'lib/pipl/fields.rb', line 546

attr_accessor :url, :category, :domain, :name, :sponsored, :source_id

#domainString

Returns Canonical domain of the url.

Returns:

  • (String)

    Canonical domain of the url



546
# File 'lib/pipl/fields.rb', line 546

attr_accessor :url, :category, :domain, :name, :sponsored, :source_id

#nameString

Returns Name of the website hosting the url.

Returns:

  • (String)

    Name of the website hosting the url



546
# File 'lib/pipl/fields.rb', line 546

attr_accessor :url, :category, :domain, :name, :sponsored, :source_id

#source_idObject

Returns the value of attribute source_id.



546
547
548
# File 'lib/pipl/fields.rb', line 546

def source_id
  @source_id
end

Returns Unique identifier of this url.

Returns:

  • (String)

    Unique identifier of this url



546
# File 'lib/pipl/fields.rb', line 546

attr_accessor :url, :category, :domain, :name, :sponsored, :source_id

#urlString

Returns Actual Url.

Returns:

  • (String)

    Actual Url



546
547
548
# File 'lib/pipl/fields.rb', line 546

def url
  @url
end

Class Method Details

.extra_metadataObject



558
559
560
# File 'lib/pipl/fields.rb', line 558

def self.
  [:category, :domain, :name, :sponsored, :source_id]
end

Instance Method Details

#is_searchable?Boolean

Returns:

  • (Boolean)


562
563
564
# File 'lib/pipl/fields.rb', line 562

def is_searchable?
  ! @url.to_s.empty?
end

#to_hashObject



566
567
568
# File 'lib/pipl/fields.rb', line 566

def to_hash
  {url: @url} if @url
end