Class: Sistrix::Domain::Overview

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/sistrix/domain/overview.rb

Defined Under Namespace

Classes: Record

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Base

#base_uri, #fetch, #method_name

Constructor Details

#initialize(options = {}) ⇒ Overview

Returns a new instance of Overview.



12
13
14
15
16
17
18
19
20
21
# File 'lib/sistrix/domain/overview.rb', line 12

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

Instance Attribute Details

#ageObject (readonly)

Returns the value of attribute age.



9
10
11
# File 'lib/sistrix/domain/overview.rb', line 9

def age
  @age
end

#creditsObject (readonly)

Returns the value of attribute credits.



9
10
11
# File 'lib/sistrix/domain/overview.rb', line 9

def credits
  @credits
end

#kwcount_semObject (readonly)

Returns the value of attribute kwcount_sem.



9
10
11
# File 'lib/sistrix/domain/overview.rb', line 9

def kwcount_sem
  @kwcount_sem
end

#kwcount_seoObject (readonly)

Returns the value of attribute kwcount_seo.



9
10
11
# File 'lib/sistrix/domain/overview.rb', line 9

def kwcount_seo
  @kwcount_seo
end

#pagerankObject (readonly)

Returns the value of attribute pagerank.



9
10
11
# File 'lib/sistrix/domain/overview.rb', line 9

def pagerank
  @pagerank
end

#pagesObject (readonly)

Returns the value of attribute pages.



9
10
11
# File 'lib/sistrix/domain/overview.rb', line 9

def pages
  @pages
end

#sichtbarkeitsindexObject (readonly)

Returns the value of attribute sichtbarkeitsindex.



9
10
11
# File 'lib/sistrix/domain/overview.rb', line 9

def sichtbarkeitsindex
  @sichtbarkeitsindex
end

Instance Method Details

#call(options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sistrix/domain/overview.rb', line 23

def call(options = {})
  data = fetch(options)

  @credits = data.xpath('//credits').first['used'].to_i

  @sichtbarkeitsindex = Record.new(data.xpath('//answer/sichtbarkeitsindex').first)
  @pagerank           = Record.new(data.xpath('//answer/pagerank').first)
  @pages              = Record.new(data.xpath('//answer/pages').first)
  @age                = Record.new(data.xpath('//answer/age').first)
  @kwcount_seo        = Record.new(data.xpath('//answer/kwcount.seo').first)
  @kwcount_sem        = Record.new(data.xpath('//answer/kwcount.sem').first)

  self
end