sistrix 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +59 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/lib/sistrix.rb +28 -0
- data/lib/sistrix/base.rb +23 -0
- data/lib/sistrix/config.rb +15 -0
- data/lib/sistrix/domain.rb +60 -0
- data/lib/sistrix/domain/age.rb +32 -0
- data/lib/sistrix/domain/competitors/sem.rb +50 -0
- data/lib/sistrix/domain/competitors/seo.rb +52 -0
- data/lib/sistrix/domain/competitors/us.rb +53 -0
- data/lib/sistrix/domain/kwcount/sem.rb +54 -0
- data/lib/sistrix/domain/kwcount/seo.rb +54 -0
- data/lib/sistrix/domain/overview.rb +71 -0
- data/lib/sistrix/domain/pagerank.rb +51 -0
- data/lib/sistrix/domain/pages.rb +51 -0
- data/lib/sistrix/domain/sichtbarkeitsindex.rb +49 -0
- data/lib/sistrix/domain/social/latest.rb +52 -0
- data/lib/sistrix/domain/social/overview.rb +36 -0
- data/lib/sistrix/domain/social/top.rb +52 -0
- data/lib/sistrix/domain/social/url.rb +63 -0
- data/lib/sistrix/keyword.rb +60 -0
- data/lib/sistrix/keyword/domain/sem.rb +59 -0
- data/lib/sistrix/keyword/domain/seo.rb +65 -0
- data/lib/sistrix/keyword/domain/us.rb +61 -0
- data/lib/sistrix/keyword/sem.rb +58 -0
- data/lib/sistrix/keyword/seo.rb +57 -0
- data/lib/sistrix/keyword/us.rb +56 -0
- data/lib/sistrix/links/linktargets.rb +57 -0
- data/lib/sistrix/links/linktexts.rb +61 -0
- data/lib/sistrix/links/list.rb +53 -0
- data/lib/sistrix/links/overview.rb +36 -0
- data/lib/sistrix/monitoring/folders.rb +53 -0
- data/lib/sistrix/monitoring/projects.rb +51 -0
- data/lib/sistrix/monitoring/report.rb +74 -0
- data/lib/sistrix/monitoring/report/download.rb +60 -0
- data/lib/sistrix/monitoring/reports.rb +52 -0
- data/lib/sistrix/record.rb +13 -0
- data/sistrix.gemspec +146 -0
- data/spec/sistrix_domain_spec.rb +685 -0
- data/spec/sistrix_keyword_spec.rb +216 -0
- data/spec/sistrix_links_spec.rb +221 -0
- data/spec/sistrix_monitoring_spec.rb +190 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/xml/domain.age.xml +19 -0
- data/spec/xml/domain.competitors.sem.xml +23 -0
- data/spec/xml/domain.competitors.seo.xml +23 -0
- data/spec/xml/domain.competitors.us.xml +23 -0
- data/spec/xml/domain.kwcount.sem.xml +19 -0
- data/spec/xml/domain.kwcount.seo.xml +19 -0
- data/spec/xml/domain.overview.xml +24 -0
- data/spec/xml/domain.pagerank.xml +19 -0
- data/spec/xml/domain.pages.xml +19 -0
- data/spec/xml/domain.sichtbarkeitsindex.xml +19 -0
- data/spec/xml/domain.social.latest.xml +28 -0
- data/spec/xml/domain.social.overview.xml +21 -0
- data/spec/xml/domain.social.top.xml +28 -0
- data/spec/xml/domain.social.url.xml +19 -0
- data/spec/xml/domain.social.url_with_history.xml +23 -0
- data/spec/xml/domain.xml +29 -0
- data/spec/xml/keyword.domain.sem.xml +24 -0
- data/spec/xml/keyword.domain.seo.xml +24 -0
- data/spec/xml/keyword.domain.us.xml +24 -0
- data/spec/xml/keyword.sem.xml +22 -0
- data/spec/xml/keyword.sem_with_domain.xml +212 -0
- data/spec/xml/keyword.sem_with_domain2.xml +20 -0
- data/spec/xml/keyword.seo.xml +29 -0
- data/spec/xml/keyword.seo_with_url.xml +20 -0
- data/spec/xml/keyword.us.xml +28 -0
- data/spec/xml/keyword.us_nodate.xml +19 -0
- data/spec/xml/keyword.xml +21 -0
- data/spec/xml/links.linktargets.xml +118 -0
- data/spec/xml/links.linktexts.xml +28 -0
- data/spec/xml/links.list.xml +10018 -0
- data/spec/xml/links.overview.xml +23 -0
- data/spec/xml/monitoring.folders.xml +20 -0
- data/spec/xml/monitoring.projects.xml +37 -0
- data/spec/xml/monitoring.report.download.pdf +0 -0
- data/spec/xml/monitoring.report.download_error.xml +18 -0
- data/spec/xml/monitoring.report.xml +181 -0
- data/spec/xml/monitoring.reports.xml +19 -0
- data/test/helper.rb +18 -0
- data/test/test_sistrix.rb +7 -0
- metadata +232 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module Sistrix
|
|
2
|
+
|
|
3
|
+
require 'sistrix/base'
|
|
4
|
+
class Links
|
|
5
|
+
class Linktargets
|
|
6
|
+
|
|
7
|
+
include ::Sistrix::Base
|
|
8
|
+
|
|
9
|
+
attr_reader :credits, :targets
|
|
10
|
+
|
|
11
|
+
def initialize(options = {})
|
|
12
|
+
@options = {
|
|
13
|
+
'domain' => nil,
|
|
14
|
+
'num' => nil,
|
|
15
|
+
'api_key' => Sistrix.config.api_key,
|
|
16
|
+
}.merge(options)
|
|
17
|
+
|
|
18
|
+
if Sistrix.config.proxy
|
|
19
|
+
RestClient.proxy = Sistrix.config.proxy
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def call(options = {})
|
|
24
|
+
data = fetch(options)
|
|
25
|
+
|
|
26
|
+
@credits = data.xpath('/response/credits').first['used'].to_i
|
|
27
|
+
|
|
28
|
+
@targets = []
|
|
29
|
+
data.xpath('/response/answer/target').each do |r|
|
|
30
|
+
@targets << Record.new(r)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Record
|
|
37
|
+
require 'sistrix/record'
|
|
38
|
+
include ::Sistrix::Record
|
|
39
|
+
|
|
40
|
+
def initialize(xml_node)
|
|
41
|
+
@data = {}
|
|
42
|
+
|
|
43
|
+
@data[:url] = xml_node['url'].to_s.strip
|
|
44
|
+
@data[:links] = xml_node['links'].to_s.strip.to_i
|
|
45
|
+
@data[:hosts] = xml_node['hosts'].to_s.strip.to_i
|
|
46
|
+
@data[:domains] = xml_node['domains'].to_s.strip.to_i
|
|
47
|
+
@data[:nets] = xml_node['nets'].to_s.strip.to_i
|
|
48
|
+
@data[:ips] = xml_node['ips'].to_s.strip.to_i
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Sistrix
|
|
2
|
+
|
|
3
|
+
require 'sistrix/base'
|
|
4
|
+
class Links
|
|
5
|
+
class Linktexts
|
|
6
|
+
|
|
7
|
+
include ::Sistrix::Base
|
|
8
|
+
|
|
9
|
+
attr_reader :credits, :linktexts
|
|
10
|
+
|
|
11
|
+
def initialize(options = {})
|
|
12
|
+
@options = {
|
|
13
|
+
'domain' => nil,
|
|
14
|
+
'num' => nil,
|
|
15
|
+
'api_key' => Sistrix.config.api_key,
|
|
16
|
+
}.merge(options)
|
|
17
|
+
|
|
18
|
+
if Sistrix.config.proxy
|
|
19
|
+
RestClient.proxy = Sistrix.config.proxy
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def call(options = {})
|
|
24
|
+
data = fetch(options)
|
|
25
|
+
|
|
26
|
+
@credits = data.xpath('/response/credits').first['used'].to_i
|
|
27
|
+
|
|
28
|
+
@linktexts = []
|
|
29
|
+
data.xpath('/response/answer/linktext').each do |r|
|
|
30
|
+
@linktexts << Record.new(r)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Record
|
|
37
|
+
require 'sistrix/record'
|
|
38
|
+
include ::Sistrix::Record
|
|
39
|
+
|
|
40
|
+
def text
|
|
41
|
+
@data[:text]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def initialize(xml_node)
|
|
45
|
+
@data = {}
|
|
46
|
+
|
|
47
|
+
@data[:url] = xml_node['url'].to_s.strip
|
|
48
|
+
@data[:links] = xml_node['links'].to_s.strip.to_i
|
|
49
|
+
@data[:hosts] = xml_node['hosts'].to_s.strip.to_i
|
|
50
|
+
@data[:domains] = xml_node['domains'].to_s.strip.to_i
|
|
51
|
+
@data[:nets] = xml_node['nets'].to_s.strip.to_i
|
|
52
|
+
@data[:ips] = xml_node['ips'].to_s.strip.to_i
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Sistrix
|
|
2
|
+
|
|
3
|
+
require 'sistrix/base'
|
|
4
|
+
class Links
|
|
5
|
+
class List
|
|
6
|
+
|
|
7
|
+
include ::Sistrix::Base
|
|
8
|
+
|
|
9
|
+
attr_reader :credits, :links
|
|
10
|
+
|
|
11
|
+
def initialize(options = {})
|
|
12
|
+
@options = {
|
|
13
|
+
'domain' => nil,
|
|
14
|
+
'api_key' => Sistrix.config.api_key,
|
|
15
|
+
}.merge(options)
|
|
16
|
+
|
|
17
|
+
if Sistrix.config.proxy
|
|
18
|
+
RestClient.proxy = Sistrix.config.proxy
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def call(options = {})
|
|
23
|
+
data = fetch(options)
|
|
24
|
+
|
|
25
|
+
@credits = data.xpath('/response/credits').first['used'].to_i
|
|
26
|
+
|
|
27
|
+
@links = []
|
|
28
|
+
data.xpath('/response/answer/link').each do |r|
|
|
29
|
+
@links << Record.new(r)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class Record
|
|
36
|
+
require 'sistrix/record'
|
|
37
|
+
include ::Sistrix::Record
|
|
38
|
+
|
|
39
|
+
def initialize(xml_node)
|
|
40
|
+
@data = {}
|
|
41
|
+
|
|
42
|
+
@data[:url_from] = xml_node['url.from'].to_s.strip
|
|
43
|
+
@data[:url_to] = xml_node['url.to'].to_s.strip
|
|
44
|
+
@data[:text] = xml_node['text'].to_s.strip
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Sistrix
|
|
2
|
+
|
|
3
|
+
require 'sistrix/base'
|
|
4
|
+
|
|
5
|
+
class Links
|
|
6
|
+
class Overview
|
|
7
|
+
include ::Sistrix::Base
|
|
8
|
+
|
|
9
|
+
attr_reader :credits, :total, :hosts, :domains, :networks, :class_c
|
|
10
|
+
|
|
11
|
+
def initialize(options = {})
|
|
12
|
+
@options = {
|
|
13
|
+
'domain' => nil,
|
|
14
|
+
'api_key' => Sistrix.config.api_key,
|
|
15
|
+
}.merge(options)
|
|
16
|
+
|
|
17
|
+
if Sistrix.config.proxy
|
|
18
|
+
RestClient.proxy = Sistrix.config.proxy
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def call(options = {})
|
|
23
|
+
data = fetch(options)
|
|
24
|
+
|
|
25
|
+
@credits = data.xpath('//credits').first['used'].to_i
|
|
26
|
+
@total = data.xpath('/response/answer/total').first['num'].to_s.strip.to_i
|
|
27
|
+
@hosts = data.xpath('/response/answer/hosts').first['num'].to_s.strip.to_i
|
|
28
|
+
@domains = data.xpath('/response/answer/domains').first['num'].to_s.strip.to_i
|
|
29
|
+
@networks = data.xpath('/response/answer/networks').first['num'].to_s.strip.to_i
|
|
30
|
+
@class_c = data.xpath('/response/answer/class_c').first['num'].to_s.strip.to_i
|
|
31
|
+
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
end # class Links::Overview
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Sistrix
|
|
2
|
+
|
|
3
|
+
require 'sistrix/base'
|
|
4
|
+
class Monitoring
|
|
5
|
+
class Folders
|
|
6
|
+
|
|
7
|
+
include ::Sistrix::Base
|
|
8
|
+
|
|
9
|
+
attr_reader :credits, :folders
|
|
10
|
+
|
|
11
|
+
def initialize(options = {})
|
|
12
|
+
@options = {
|
|
13
|
+
'project' => nil,
|
|
14
|
+
'api_key' => Sistrix.config.api_key,
|
|
15
|
+
}.merge(options)
|
|
16
|
+
|
|
17
|
+
if Sistrix.config.proxy
|
|
18
|
+
RestClient.proxy = Sistrix.config.proxy
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def call(options = {})
|
|
23
|
+
data = fetch(options)
|
|
24
|
+
|
|
25
|
+
@credits = data.xpath('/response/credits').first['used'].to_i
|
|
26
|
+
|
|
27
|
+
@folders = []
|
|
28
|
+
data.xpath('/response/answer/folder').each do |r|
|
|
29
|
+
@folders << Record.new(r)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
self
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class Record
|
|
36
|
+
require 'sistrix/record'
|
|
37
|
+
include ::Sistrix::Record
|
|
38
|
+
|
|
39
|
+
def initialize(xml_node)
|
|
40
|
+
@data = {}
|
|
41
|
+
|
|
42
|
+
@data[:name] = xml_node['name'].to_s.strip
|
|
43
|
+
@data[:id] = xml_node['id'].to_s.strip
|
|
44
|
+
@data[:parent] = xml_node['parent'].to_s.strip
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Sistrix
|
|
2
|
+
|
|
3
|
+
require 'sistrix/base'
|
|
4
|
+
class Monitoring
|
|
5
|
+
class Projects
|
|
6
|
+
|
|
7
|
+
include ::Sistrix::Base
|
|
8
|
+
|
|
9
|
+
attr_reader :credits, :projects
|
|
10
|
+
|
|
11
|
+
def initialize(options = {})
|
|
12
|
+
@options = {
|
|
13
|
+
'api_key' => Sistrix.config.api_key,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if Sistrix.config.proxy
|
|
17
|
+
RestClient.proxy = Sistrix.config.proxy
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def call(options = {})
|
|
22
|
+
data = fetch(options)
|
|
23
|
+
|
|
24
|
+
@credits = data.xpath('/response/credits').first['used'].to_i
|
|
25
|
+
|
|
26
|
+
@projects = []
|
|
27
|
+
data.xpath('/response/answer/project').each do |r|
|
|
28
|
+
@projects << Record.new(r)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
self
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
class Record
|
|
35
|
+
require 'sistrix/record'
|
|
36
|
+
include ::Sistrix::Record
|
|
37
|
+
|
|
38
|
+
def initialize(xml_node)
|
|
39
|
+
@data = {}
|
|
40
|
+
|
|
41
|
+
@data[:name] = xml_node['name'].to_s.strip
|
|
42
|
+
@data[:id] = xml_node['id'].to_s.strip
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
module Sistrix
|
|
2
|
+
|
|
3
|
+
require 'sistrix/base'
|
|
4
|
+
class Monitoring
|
|
5
|
+
class Report
|
|
6
|
+
|
|
7
|
+
include ::Sistrix::Base
|
|
8
|
+
|
|
9
|
+
attr_reader :credits, :name, :id, :frequency, :format, :recipients, :reports
|
|
10
|
+
|
|
11
|
+
def initialize(options = {})
|
|
12
|
+
@options = {
|
|
13
|
+
'project' => nil,
|
|
14
|
+
'report' => nil,
|
|
15
|
+
'api_key' => Sistrix.config.api_key,
|
|
16
|
+
}.merge(options)
|
|
17
|
+
|
|
18
|
+
if Sistrix.config.proxy
|
|
19
|
+
RestClient.proxy = Sistrix.config.proxy
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def call(options = {})
|
|
24
|
+
data = fetch(options)
|
|
25
|
+
|
|
26
|
+
@credits = data.xpath('/response/credits').first['used'].to_i
|
|
27
|
+
@name = data.xpath('/response/answer/name').first['value'].to_s.strip
|
|
28
|
+
@id = data.xpath('/response/answer/id').first['value'].to_s.strip
|
|
29
|
+
@frequency = data.xpath('/response/answer/frequency').first['value'].to_s.strip
|
|
30
|
+
@format = data.xpath('/response/answer/format').first['value'].to_s.strip
|
|
31
|
+
|
|
32
|
+
@recipients = []
|
|
33
|
+
data.xpath('/response/answer/recipients/recipient').each do |r|
|
|
34
|
+
@recipients << Recipient.new(r)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
@reports = []
|
|
38
|
+
data.xpath('/response/answer/archive/report').each do |r|
|
|
39
|
+
@reports << Record.new(r)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
self
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class Recipient
|
|
46
|
+
require 'sistrix/record'
|
|
47
|
+
include ::Sistrix::Record
|
|
48
|
+
|
|
49
|
+
def initialize(xml_node)
|
|
50
|
+
@data = {}
|
|
51
|
+
|
|
52
|
+
@data[:value] = xml_node['value'].to_s.strip
|
|
53
|
+
@data[:type] = xml_node['type'].to_s.strip
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class Record
|
|
58
|
+
require 'sistrix/record'
|
|
59
|
+
include ::Sistrix::Record
|
|
60
|
+
|
|
61
|
+
def initialize(xml_node)
|
|
62
|
+
@data = {}
|
|
63
|
+
|
|
64
|
+
@data[:date] = Time.parse(xml_node['date'].to_s.strip)
|
|
65
|
+
@data[:format] = xml_node['format'].to_s.strip
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module Sistrix
|
|
2
|
+
|
|
3
|
+
require 'sistrix/base'
|
|
4
|
+
class Monitoring
|
|
5
|
+
class Report
|
|
6
|
+
class Download
|
|
7
|
+
|
|
8
|
+
attr_reader :data
|
|
9
|
+
attr_reader :error
|
|
10
|
+
|
|
11
|
+
include ::Sistrix::Base
|
|
12
|
+
|
|
13
|
+
def initialize(options = {})
|
|
14
|
+
@data, @error = nil, nil
|
|
15
|
+
|
|
16
|
+
@options = {
|
|
17
|
+
'project' => nil,
|
|
18
|
+
'report' => nil,
|
|
19
|
+
'date' => nil,
|
|
20
|
+
'api_key' => Sistrix.config.api_key,
|
|
21
|
+
}.merge(options)
|
|
22
|
+
|
|
23
|
+
if Sistrix.config.proxy
|
|
24
|
+
RestClient.proxy = Sistrix.config.proxy
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def call(options = {})
|
|
30
|
+
@options.merge!(options)
|
|
31
|
+
|
|
32
|
+
response = RestClient.get(base_uri, { :params => @options })
|
|
33
|
+
|
|
34
|
+
begin
|
|
35
|
+
xml = Nokogiri::XML(response.to_s)
|
|
36
|
+
@error = Error.new(xml.xpath('/response/error').first)
|
|
37
|
+
rescue Exception => ex
|
|
38
|
+
@data = response.to_s
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
self
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def error?
|
|
45
|
+
! @error.nil?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
class Error
|
|
49
|
+
attr_reader :code, :message
|
|
50
|
+
|
|
51
|
+
def initialize(xml_node)
|
|
52
|
+
@code = xml_node['error_code'].to_s.strip
|
|
53
|
+
@message = xml_node['error_message'].to_s.strip
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|