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.
Files changed (87) hide show
  1. data/.document +5 -0
  2. data/Gemfile +12 -0
  3. data/LICENSE.txt +20 -0
  4. data/README.rdoc +59 -0
  5. data/Rakefile +49 -0
  6. data/VERSION +1 -0
  7. data/lib/sistrix.rb +28 -0
  8. data/lib/sistrix/base.rb +23 -0
  9. data/lib/sistrix/config.rb +15 -0
  10. data/lib/sistrix/domain.rb +60 -0
  11. data/lib/sistrix/domain/age.rb +32 -0
  12. data/lib/sistrix/domain/competitors/sem.rb +50 -0
  13. data/lib/sistrix/domain/competitors/seo.rb +52 -0
  14. data/lib/sistrix/domain/competitors/us.rb +53 -0
  15. data/lib/sistrix/domain/kwcount/sem.rb +54 -0
  16. data/lib/sistrix/domain/kwcount/seo.rb +54 -0
  17. data/lib/sistrix/domain/overview.rb +71 -0
  18. data/lib/sistrix/domain/pagerank.rb +51 -0
  19. data/lib/sistrix/domain/pages.rb +51 -0
  20. data/lib/sistrix/domain/sichtbarkeitsindex.rb +49 -0
  21. data/lib/sistrix/domain/social/latest.rb +52 -0
  22. data/lib/sistrix/domain/social/overview.rb +36 -0
  23. data/lib/sistrix/domain/social/top.rb +52 -0
  24. data/lib/sistrix/domain/social/url.rb +63 -0
  25. data/lib/sistrix/keyword.rb +60 -0
  26. data/lib/sistrix/keyword/domain/sem.rb +59 -0
  27. data/lib/sistrix/keyword/domain/seo.rb +65 -0
  28. data/lib/sistrix/keyword/domain/us.rb +61 -0
  29. data/lib/sistrix/keyword/sem.rb +58 -0
  30. data/lib/sistrix/keyword/seo.rb +57 -0
  31. data/lib/sistrix/keyword/us.rb +56 -0
  32. data/lib/sistrix/links/linktargets.rb +57 -0
  33. data/lib/sistrix/links/linktexts.rb +61 -0
  34. data/lib/sistrix/links/list.rb +53 -0
  35. data/lib/sistrix/links/overview.rb +36 -0
  36. data/lib/sistrix/monitoring/folders.rb +53 -0
  37. data/lib/sistrix/monitoring/projects.rb +51 -0
  38. data/lib/sistrix/monitoring/report.rb +74 -0
  39. data/lib/sistrix/monitoring/report/download.rb +60 -0
  40. data/lib/sistrix/monitoring/reports.rb +52 -0
  41. data/lib/sistrix/record.rb +13 -0
  42. data/sistrix.gemspec +146 -0
  43. data/spec/sistrix_domain_spec.rb +685 -0
  44. data/spec/sistrix_keyword_spec.rb +216 -0
  45. data/spec/sistrix_links_spec.rb +221 -0
  46. data/spec/sistrix_monitoring_spec.rb +190 -0
  47. data/spec/spec_helper.rb +33 -0
  48. data/spec/xml/domain.age.xml +19 -0
  49. data/spec/xml/domain.competitors.sem.xml +23 -0
  50. data/spec/xml/domain.competitors.seo.xml +23 -0
  51. data/spec/xml/domain.competitors.us.xml +23 -0
  52. data/spec/xml/domain.kwcount.sem.xml +19 -0
  53. data/spec/xml/domain.kwcount.seo.xml +19 -0
  54. data/spec/xml/domain.overview.xml +24 -0
  55. data/spec/xml/domain.pagerank.xml +19 -0
  56. data/spec/xml/domain.pages.xml +19 -0
  57. data/spec/xml/domain.sichtbarkeitsindex.xml +19 -0
  58. data/spec/xml/domain.social.latest.xml +28 -0
  59. data/spec/xml/domain.social.overview.xml +21 -0
  60. data/spec/xml/domain.social.top.xml +28 -0
  61. data/spec/xml/domain.social.url.xml +19 -0
  62. data/spec/xml/domain.social.url_with_history.xml +23 -0
  63. data/spec/xml/domain.xml +29 -0
  64. data/spec/xml/keyword.domain.sem.xml +24 -0
  65. data/spec/xml/keyword.domain.seo.xml +24 -0
  66. data/spec/xml/keyword.domain.us.xml +24 -0
  67. data/spec/xml/keyword.sem.xml +22 -0
  68. data/spec/xml/keyword.sem_with_domain.xml +212 -0
  69. data/spec/xml/keyword.sem_with_domain2.xml +20 -0
  70. data/spec/xml/keyword.seo.xml +29 -0
  71. data/spec/xml/keyword.seo_with_url.xml +20 -0
  72. data/spec/xml/keyword.us.xml +28 -0
  73. data/spec/xml/keyword.us_nodate.xml +19 -0
  74. data/spec/xml/keyword.xml +21 -0
  75. data/spec/xml/links.linktargets.xml +118 -0
  76. data/spec/xml/links.linktexts.xml +28 -0
  77. data/spec/xml/links.list.xml +10018 -0
  78. data/spec/xml/links.overview.xml +23 -0
  79. data/spec/xml/monitoring.folders.xml +20 -0
  80. data/spec/xml/monitoring.projects.xml +37 -0
  81. data/spec/xml/monitoring.report.download.pdf +0 -0
  82. data/spec/xml/monitoring.report.download_error.xml +18 -0
  83. data/spec/xml/monitoring.report.xml +181 -0
  84. data/spec/xml/monitoring.reports.xml +19 -0
  85. data/test/helper.rb +18 -0
  86. data/test/test_sistrix.rb +7 -0
  87. metadata +232 -0
@@ -0,0 +1,54 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ class Kwcount
7
+ class Sem
8
+ include ::Sistrix::Base
9
+
10
+ attr_reader :credits, :kwcount
11
+
12
+ def initialize(options = {})
13
+ @options = {
14
+ 'history' => nil,
15
+ 'domain' => nil,
16
+ 'api_key' => Sistrix.config.api_key,
17
+ }.merge(options)
18
+
19
+ if Sistrix.config.proxy
20
+ RestClient.proxy = Sistrix.config.proxy
21
+ end
22
+ end
23
+
24
+ def call(options = {})
25
+ data = fetch(options)
26
+
27
+ @credits = data.xpath('//credits').first['used'].to_i
28
+ @kwcount = []
29
+ data.xpath('//answer/kwcount.sem').each do |r|
30
+ @kwcount << 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[:domain] = xml_node['domain'].strip
44
+ @data[:date] = Time.parse(xml_node['date'].strip)
45
+ @data[:value] = xml_node['value'].strip.to_i
46
+ end
47
+ end
48
+
49
+
50
+ end
51
+
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+ class Domain
5
+ class Kwcount
6
+ class Seo
7
+
8
+ include ::Sistrix::Base
9
+
10
+ attr_reader :credits, :kwcount
11
+
12
+ def initialize(options = {})
13
+ @options = {
14
+ 'history' => nil,
15
+ 'domain' => nil,
16
+ 'api_key' => Sistrix.config.api_key,
17
+ }.merge(options)
18
+
19
+ if Sistrix.config.proxy
20
+ RestClient.proxy = Sistrix.config.proxy
21
+ end
22
+ end
23
+
24
+ def call(options = {})
25
+ data = fetch(options)
26
+
27
+ @credits = data.xpath('//credits').first['used'].to_i
28
+ @kwcount = []
29
+ data.xpath('//answer/kwcount.seo').each do |r|
30
+ @kwcount << 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[:domain] = xml_node['domain'].strip
44
+ @data[:date] = Time.parse(xml_node['date'].strip)
45
+ @data[:value] = xml_node['value'].strip.to_i
46
+ end
47
+ end
48
+
49
+
50
+ end
51
+
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,71 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ class Overview
7
+ include ::Sistrix::Base
8
+
9
+ attr_reader :credits, :sichtbarkeitsindex, :pagerank,
10
+ :pages, :age, :kwcount_seo, :kwcount_sem
11
+
12
+ def initialize(options = {})
13
+ @options = {
14
+ 'domain' => 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('//credits').first['used'].to_i
27
+
28
+ @sichtbarkeitsindex = Record.new(data.xpath('//answer/sichtbarkeitsindex').first)
29
+ @pagerank = Record.new(data.xpath('//answer/pagerank').first)
30
+ @pages = Record.new(data.xpath('//answer/pages').first)
31
+ @age = Record.new(data.xpath('//answer/age').first)
32
+ @kwcount_seo = Record.new(data.xpath('//answer/kwcount.seo').first)
33
+ @kwcount_sem = Record.new(data.xpath('//answer/kwcount.sem').first)
34
+
35
+ self
36
+ end
37
+
38
+ class Record
39
+ require 'sistrix/record'
40
+ include ::Sistrix::Record
41
+
42
+ def initialize(xml_node)
43
+ @data = {}
44
+
45
+ @data[:domain] = xml_node['domain'].strip
46
+
47
+ begin
48
+ @data[:date] = Time.parse(xml_node['date'].strip)
49
+ rescue NoMethodError
50
+ @data[:date] = nil
51
+ end
52
+
53
+ if xml_node.name == 'age'
54
+ @data[:value] = Time.parse(xml_node['value'].strip)
55
+ else
56
+ if xml_node['value'] =~ /\./
57
+ @data[:value] = xml_node['value'].strip.to_f
58
+ else
59
+ @data[:value] = xml_node['value'].strip.to_i
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+ end # class Domain::Overview::Record
66
+
67
+ end # class Domain::Overview
68
+
69
+
70
+ end
71
+ end
@@ -0,0 +1,51 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ class Pagerank
7
+ include ::Sistrix::Base
8
+
9
+ attr_reader :credits, :pageranks
10
+
11
+ def initialize(options = {})
12
+ @options = {
13
+ 'history' => nil,
14
+ 'domain' => 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('//credits').first['used'].to_i
27
+ @pageranks = []
28
+ data.xpath('//answer/pagerank').each do |o|
29
+ @pageranks << Record.new(o)
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[:domain] = xml_node['domain'].strip
43
+ @data[:date] = Time.parse(xml_node['date'].strip)
44
+ @data[:value] = xml_node['value'].strip.to_i
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ class Pages
7
+ include ::Sistrix::Base
8
+
9
+ attr_reader :credits, :pages
10
+
11
+ def initialize(options = {})
12
+ @options = {
13
+ 'history' => nil,
14
+ 'domain' => 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('//credits').first['used'].to_i
27
+ @pages = []
28
+ data.xpath('//answer/pages').each do |o|
29
+ @pages << Record.new(o)
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[:domain] = xml_node['domain'].strip
43
+ @data[:date] = Time.parse(xml_node['date'].strip)
44
+ @data[:value] = xml_node['value'].strip.to_i
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,49 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ class Sichtbarkeitsindex
7
+ include ::Sistrix::Base
8
+ attr_reader :credits, :sichtbarkeitsindex
9
+
10
+ def initialize(options = {})
11
+ @options = {
12
+ 'history' => nil,
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
+ @sichtbarkeitsindex = []
27
+ data.xpath('//answer/sichtbarkeitsindex').each do |o|
28
+ @sichtbarkeitsindex << Record.new(o)
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[:domain] = xml_node['domain'].strip
42
+ @data[:date] = Time.parse(xml_node['date'].strip)
43
+ @data[:value] = xml_node['value'].strip.to_f
44
+ end
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,52 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ module Social
7
+ class Latest
8
+ include ::Sistrix::Base
9
+ attr_reader :credits, :urls
10
+
11
+ def initialize(options = {})
12
+ @options = {
13
+ 'domain' => nil,
14
+ 'network' => nil,
15
+ 'num' => 10,
16
+ 'api_key' => Sistrix.config.api_key,
17
+ }.merge(options)
18
+
19
+ if Sistrix.config.proxy
20
+ RestClient.proxy = Sistrix.config.proxy
21
+ end
22
+ end
23
+
24
+ def call(options = {})
25
+ data = fetch(options)
26
+
27
+ @credits = data.xpath('//credits').first['used'].to_i
28
+ @urls = []
29
+ data.xpath('//answer/url').each do |o|
30
+ @urls << Record.new(o)
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[:network] = xml_node['network'].strip
44
+ @data[:url] = xml_node['url'].strip
45
+ @data[:date] = Time.parse(xml_node['date'].strip)
46
+ end
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,36 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ module Social
7
+ class Overview
8
+ include ::Sistrix::Base
9
+
10
+ attr_reader :credits, :twitter, :facebook, :googleplus
11
+
12
+ def initialize(options = {})
13
+ @options = {
14
+ 'domain' => 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('//credits').first['used'].to_i
27
+ @twitter = data.search('/response/answer/votes[@network="twitter"]').first['value'].to_i
28
+ @facebook = data.search('/response/answer/votes[@network="facebook"]').first['value'].to_i
29
+ @googleplus = data.search('/response/answer/votes[@network="googleplus"]').first['value'].to_i
30
+
31
+ self
32
+ end
33
+ end # class Domain::Social::Overview
34
+ end # module Domain::Social
35
+ end # class Domain
36
+ end # module Sistrix
@@ -0,0 +1,52 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ module Social
7
+ class Top
8
+ include ::Sistrix::Base
9
+ attr_reader :credits, :urls
10
+
11
+ def initialize(options = {})
12
+ @options = {
13
+ 'domain' => nil,
14
+ 'network' => nil,
15
+ 'num' => 10,
16
+ 'api_key' => Sistrix.config.api_key,
17
+ }.merge(options)
18
+
19
+ if Sistrix.config.proxy
20
+ RestClient.proxy = Sistrix.config.proxy
21
+ end
22
+ end
23
+
24
+ def call(options = {})
25
+ data = fetch(options)
26
+
27
+ @credits = data.xpath('//credits').first['used'].to_i
28
+ @urls = []
29
+ data.xpath('//answer/url').each do |o|
30
+ @urls << Record.new(o)
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[:network] = xml_node['network'].strip
44
+ @data[:url] = xml_node['url'].strip
45
+ @data[:votes] = xml_node['votes'].strip.to_i
46
+ end
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end