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,63 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Domain
6
+ module Social
7
+ class Url
8
+ include ::Sistrix::Base
9
+ attr_reader :credits, :url, :total, :facebook,
10
+ :twitter, :googleplus, :history
11
+
12
+ def initialize(options = {})
13
+ @options = {
14
+ 'domain' => nil,
15
+ 'history' => 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
+ @votes = []
29
+
30
+ current_node = data.xpath('/response/answer/current').first
31
+ @url = current_node['url']
32
+ @total = current_node['total'].to_i
33
+ @facebook = current_node['facebook'].to_i
34
+ @twitter = current_node['twitter'].to_i
35
+ @googleplus = current_node['googleplus'].to_i
36
+
37
+ @history = []
38
+ data.xpath('/response/answer/timeline/history').each do |o|
39
+ @history << Record.new(o)
40
+ end
41
+
42
+ self
43
+ end
44
+
45
+ class Record
46
+ require 'sistrix/record'
47
+ include ::Sistrix::Record
48
+
49
+ def initialize(xml_node)
50
+ @data = {}
51
+
52
+ @data[:date] = Time.parse(xml_node['date'].strip)
53
+ @data[:total] = xml_node['total'].strip.to_i
54
+ @data[:facebook] = xml_node['facebook'].strip.to_i
55
+ @data[:twitter] = xml_node['twitter'].strip.to_i
56
+ @data[:googleplus] = xml_node['googleplus'].strip.to_i
57
+ end
58
+ end
59
+
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,60 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+
5
+ class Keyword
6
+ include ::Sistrix::Base
7
+
8
+ attr_reader :credits, :options
9
+
10
+ def initialize(options = {})
11
+ @options = {
12
+ 'kw' => nil,
13
+ 'api_key' => Sistrix.config.api_key,
14
+ }.merge(options)
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('//credits').first['used'].to_i
25
+ @options = []
26
+ data.xpath('//answer/option').each do |o|
27
+ @options << Record.new(o)
28
+ end
29
+
30
+ self
31
+ end
32
+
33
+ class Record
34
+ require 'sistrix/record'
35
+ include ::Sistrix::Record
36
+
37
+ def method
38
+ @data[:method]
39
+ end
40
+
41
+ def url
42
+ @data[:url]
43
+ end
44
+
45
+ def name
46
+ @data[:name]
47
+ end
48
+
49
+ def initialize(xml_node)
50
+ @data = {}
51
+
52
+ @data[:method] = xml_node['method'].to_s.strip
53
+ @data[:url] = xml_node['url'].to_s.strip
54
+ @data[:name] = xml_node['name'].to_s.strip
55
+ end
56
+ end
57
+
58
+ end
59
+
60
+ end
@@ -0,0 +1,59 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+ class Keyword
5
+ module Domain
6
+ class Sem
7
+
8
+ include ::Sistrix::Base
9
+
10
+ attr_reader :credits, :results, :date
11
+
12
+ def initialize(options = {})
13
+ @options = {
14
+ 'domain' => nil,
15
+ 'num' => 5,
16
+ 'date' => 'today',
17
+ 'search' => nil,
18
+ 'api_key' => Sistrix.config.api_key,
19
+ }.merge(options)
20
+
21
+ if Sistrix.config.proxy
22
+ RestClient.proxy = Sistrix.config.proxy
23
+ end
24
+ end
25
+
26
+ def call(options = {})
27
+ data = fetch(options)
28
+
29
+ @credits = data.xpath('/response/credits').first['used'].to_i
30
+ @date = Time.parse(data.xpath('/response/date').first.to_s)
31
+
32
+ @results = []
33
+ data.xpath('/response/answer/result').each do |r|
34
+ @results << Record.new(r)
35
+ end
36
+
37
+ self
38
+ end
39
+
40
+ class Record
41
+ require 'sistrix/record'
42
+ include ::Sistrix::Record
43
+
44
+ def initialize(xml_node)
45
+ @data = {}
46
+
47
+ @data[:position] = xml_node['position'].to_s.strip.to_i
48
+ @data[:kw] = xml_node['kw'].to_s.strip
49
+ @data[:competition] = xml_node['competition'].to_s.strip.to_i
50
+ @data[:traffic] = xml_node['traffic'].to_s.strip.to_i
51
+ end
52
+ end
53
+
54
+
55
+ end
56
+
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,65 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+ class Keyword
5
+ module Domain
6
+ class Seo
7
+
8
+ include ::Sistrix::Base
9
+
10
+ attr_reader :credits, :results, :date
11
+
12
+ def initialize(options = {})
13
+ @options = {
14
+ 'domain' => nil,
15
+ 'num' => 5,
16
+ 'date' => 'today',
17
+ 'search' => nil,
18
+ 'host' => nil,
19
+ 'url' => nil,
20
+ 'path' => nil,
21
+ 'from_pos' => nil,
22
+ 'to_pos' => nil,
23
+ 'api_key' => Sistrix.config.api_key,
24
+ }.merge(options)
25
+
26
+ if Sistrix.config.proxy
27
+ RestClient.proxy = Sistrix.config.proxy
28
+ end
29
+ end
30
+
31
+ def call(options = {})
32
+ data = fetch(options)
33
+
34
+ @credits = data.xpath('/response/credits').first['used'].to_i
35
+ @date = Time.parse(data.xpath('/response/date').first.to_s)
36
+
37
+ @results = []
38
+ data.xpath('/response/answer/result').each do |r|
39
+ @results << Record.new(r)
40
+ end
41
+
42
+ self
43
+ end
44
+
45
+ class Record
46
+ require 'sistrix/record'
47
+ include ::Sistrix::Record
48
+
49
+ def initialize(xml_node)
50
+ @data = {}
51
+
52
+ @data[:position] = xml_node['position'].to_s.strip.to_i
53
+ @data[:kw] = xml_node['kw'].to_s.strip
54
+ @data[:competition] = xml_node['competition'].to_s.strip.to_i
55
+ @data[:traffic] = xml_node['traffic'].to_s.strip.to_i
56
+ @data[:url] = xml_node['url'].to_s.strip
57
+ end
58
+ end
59
+
60
+
61
+ end
62
+
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,61 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+ class Keyword
5
+ module Domain
6
+ class Us
7
+
8
+ include ::Sistrix::Base
9
+
10
+ attr_reader :credits, :results, :date
11
+
12
+ def initialize(options = {})
13
+ @options = {
14
+ 'domain' => nil,
15
+ 'num' => 5,
16
+ 'date' => 'today',
17
+ 'search' => nil,
18
+ 'api_key' => Sistrix.config.api_key,
19
+ }.merge(options)
20
+
21
+ if Sistrix.config.proxy
22
+ RestClient.proxy = Sistrix.config.proxy
23
+ end
24
+ end
25
+
26
+ def call(options = {})
27
+ data = fetch(options)
28
+
29
+ @credits = data.xpath('/response/credits').first['used'].to_i
30
+ @date = Time.parse(data.xpath('/response/date').first.to_s)
31
+
32
+ @results = []
33
+ data.xpath('/response/answer/result').each do |r|
34
+ @results << Record.new(r)
35
+ end
36
+
37
+ self
38
+ end
39
+
40
+ class Record
41
+ require 'sistrix/record'
42
+ include ::Sistrix::Record
43
+
44
+ def initialize(xml_node)
45
+ @data = {}
46
+
47
+ @data[:position] = xml_node['position'].to_s.strip
48
+ @data[:position_intern] = xml_node['position.intern'].to_s.strip
49
+ @data[:type] = xml_node['type'].to_s.strip
50
+ @data[:kw] = xml_node['kw'].to_s.strip
51
+ @data[:competition] = xml_node['competition'].to_s.strip
52
+ @data[:traffic] = xml_node['traffic'].to_s.strip
53
+ end
54
+ end
55
+
56
+
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,58 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+ class Keyword
5
+ class Sem
6
+
7
+ include ::Sistrix::Base
8
+
9
+ attr_reader :credits, :results, :date
10
+
11
+ def initialize(options = {})
12
+ @options = {
13
+ 'kw' => nil,
14
+ 'num' => 5,
15
+ 'date' => 'today',
16
+ 'domain' => nil,
17
+ 'api_key' => Sistrix.config.api_key,
18
+ }.merge(options)
19
+
20
+ if Sistrix.config.proxy
21
+ RestClient.proxy = Sistrix.config.proxy
22
+ end
23
+ end
24
+
25
+ def call(options = {})
26
+ data = fetch(options)
27
+
28
+ @credits = data.xpath('/response/credits').first['used'].to_i
29
+ @date = Time.parse(data.xpath('/response/date').first.to_s)
30
+
31
+ @results = []
32
+ data.xpath('/response/answer/result').each do |r|
33
+ @results << Record.new(r)
34
+ end
35
+
36
+ self
37
+ end
38
+
39
+ class Record
40
+ require 'sistrix/record'
41
+ include ::Sistrix::Record
42
+
43
+ def initialize(xml_node)
44
+ @data = {}
45
+
46
+ @data[:position] = xml_node['position'].strip.to_i
47
+ @data[:title] = xml_node['title'].to_s.strip
48
+ @data[:text] = xml_node['text'].to_s.strip
49
+ @data[:displayurl] = xml_node['displayurl'].to_s.strip
50
+ end
51
+ end
52
+
53
+
54
+ end
55
+
56
+ end
57
+ end
58
+
@@ -0,0 +1,57 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+ class Keyword
5
+ class Seo
6
+
7
+ include ::Sistrix::Base
8
+
9
+ attr_reader :credits, :results, :date
10
+
11
+ def initialize(options = {})
12
+ @options = {
13
+ 'kw' => nil,
14
+ 'num' => 5,
15
+ 'date' => 'today',
16
+ 'url' => nil,
17
+ 'api_key' => Sistrix.config.api_key,
18
+ }.merge(options)
19
+
20
+ if Sistrix.config.proxy
21
+ RestClient.proxy = Sistrix.config.proxy
22
+ end
23
+ end
24
+
25
+ def call(options = {})
26
+ data = fetch(options)
27
+
28
+ @credits = data.xpath('/response/credits').first['used'].to_i
29
+ @date = Time.parse(data.xpath('/response/date').first.to_s)
30
+
31
+ @results = []
32
+ data.xpath('/response/answer/result').each do |r|
33
+ @results << Record.new(r)
34
+ end
35
+
36
+ self
37
+ end
38
+
39
+ class Record
40
+ require 'sistrix/record'
41
+ include ::Sistrix::Record
42
+
43
+ def initialize(xml_node)
44
+ @data = {}
45
+
46
+ @data[:position] = xml_node['position'].strip.to_i
47
+ @data[:domain] = xml_node['domain'].to_s.strip
48
+ @data[:url] = xml_node['url'].to_s.strip
49
+ end
50
+ end
51
+
52
+
53
+ end
54
+
55
+ end
56
+ end
57
+
@@ -0,0 +1,56 @@
1
+ module Sistrix
2
+
3
+ require 'sistrix/base'
4
+ class Keyword
5
+ class Us
6
+
7
+ include ::Sistrix::Base
8
+
9
+ attr_reader :credits, :results, :date
10
+
11
+ def initialize(options = {})
12
+ @options = {
13
+ 'kw' => nil,
14
+ 'date' => 'today',
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
+ @date = Time.parse(data.xpath('/response/date').first.to_s)
28
+
29
+ @results = []
30
+ data.xpath('/response/answer/result').each do |r|
31
+ @results << Record.new(r)
32
+ end
33
+
34
+ self
35
+ end
36
+
37
+ class Record
38
+ require 'sistrix/record'
39
+ include ::Sistrix::Record
40
+
41
+ def initialize(xml_node)
42
+ @data = {}
43
+
44
+ @data[:position] = xml_node['position'].strip.to_i
45
+ @data[:position_intern] = xml_node['position.intern'].strip.to_s
46
+ @data[:url] = xml_node['url'].to_s.strip
47
+ @data[:type] = xml_node['type'].to_s.strip
48
+ end
49
+ end
50
+
51
+
52
+ end
53
+
54
+ end
55
+ end
56
+