dataduck 0.6.6 → 0.6.7
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.
- checksums.yaml +4 -4
- data/lib/dataduck/table.rb +1 -1
- data/lib/dataduck/version.rb +1 -1
- data/lib/integrations/semrush/organic_results.rb +14 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5944e3a23d61e1bcdbfa5c82e1a8d0ee3fe8b4cf
|
4
|
+
data.tar.gz: 70c2e2b7af5377e13f473a9f7f56df438e5b6491
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af935179e9a4a52d56423cb2a785db6d51421caaaba6d5fa33b6283708b6199252770892446b394c826fab07d75e57553c43d8ccf15754156fe063fc48732e54
|
7
|
+
data.tar.gz: 51ef2d29c8092aaf30e65326701ed3936c3e77a745ad171dbfd6d993c608e2312344258b31f0c525dd607739ae4376471ef3017858fbb50e6772bf4481b4b263
|
data/lib/dataduck/table.rb
CHANGED
data/lib/dataduck/version.rb
CHANGED
@@ -4,6 +4,8 @@ require 'uri'
|
|
4
4
|
|
5
5
|
module DataDuck
|
6
6
|
module SEMRush
|
7
|
+
class OrganicResultsAPIError < Exception; end
|
8
|
+
|
7
9
|
class OrganicResults < DataDuck::IntegrationTable
|
8
10
|
def display_limit
|
9
11
|
20
|
@@ -29,7 +31,11 @@ module DataDuck
|
|
29
31
|
self.data = []
|
30
32
|
|
31
33
|
self.phrases.each do |phrase|
|
32
|
-
|
34
|
+
begin
|
35
|
+
self.extract_results_for_keyword_and_date!(phrase)
|
36
|
+
rescue OrganicResultsAPIError => err
|
37
|
+
DataDuck::Logs.error(err)
|
38
|
+
end
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
@@ -39,9 +45,15 @@ module DataDuck
|
|
39
45
|
escaped_phrase = URI.escape(phrase)
|
40
46
|
semrush_api_url = "http://api.semrush.com/?type=phrase_organic&key=#{ self.key }&display_limit=#{ self.display_limit }&export_columns=Dn,Ur&phrase=#{ escaped_phrase }&database=#{ self.search_database }"
|
41
47
|
|
48
|
+
puts semrush_api_url
|
49
|
+
|
42
50
|
response = Typhoeus.get(semrush_api_url)
|
43
51
|
if response.response_code != 200
|
44
|
-
raise
|
52
|
+
raise OrganicResultsAPIError.new("SEMrush API for phrase #{ phrase } returned error #{ response.response_code } #{ response.body }")
|
53
|
+
end
|
54
|
+
|
55
|
+
if response.body.start_with?("ERROR ")
|
56
|
+
raise OrganicResultsAPIError.new("SEMrush API for phrase #{ phrase } returned 200 but with a body stating #{ response.body }")
|
45
57
|
end
|
46
58
|
|
47
59
|
rank = -1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dataduck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Pickhardt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|