class Sistrix::Domain::Age

Attributes

age[R]
credits[R]
domain[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/sistrix/domain/age.rb, line 9
def initialize(options = {})
  @options = {
    'domain' => nil,
    'api_key' => Sistrix.config.api_key,
  }.merge(options)

  if Sistrix.config.proxy
    RestClient.proxy = Sistrix.config.proxy
  end
end

Public Instance Methods

call(options = {}) click to toggle source
# File lib/sistrix/domain/age.rb, line 20
def call(options = {})
  data = fetch(options)

  @credits = data.xpath('//credits').first['used'].to_i
  age_node = data.xpath('//answer/age').first
  @age     = Time.parse(age_node['value'])
  @domain  = age_node['domain']

  self
end