semrush 3.0.19 → 3.0.20
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/README.rdoc +6 -1
- data/lib/semrush.rb +1 -1
- data/lib/semrush/report.rb +13 -2
- data/lib/semrush/version.rb +1 -1
- 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: f1ffcc2620afe86a94e56018f4f270cf74fce325
|
4
|
+
data.tar.gz: 22b3960b8546b4eb7c9ac635ad5aeb2e0b21918d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f51855e45b1521a8a66bad0dc79eb8e3686eb9d6272378ec65830cba6a10a0ad30c2a94bb41b52ee472e73058c095c76c40ec8081e3cc32ccd1f301a5a6de0e
|
7
|
+
data.tar.gz: d8ee04ef916a755cc9369eb2f91eb165c00952a19eb09b22a6b707397c088f41011ce08ddf63c140e951a47d0aa93c691674faaf15ca3c7082dc1b3402a219a1
|
data/README.rdoc
CHANGED
@@ -4,7 +4,7 @@ Semrush is a ruby wrapper for the SEMRush API.
|
|
4
4
|
|
5
5
|
== Requirements
|
6
6
|
|
7
|
-
- Ruby 1.9
|
7
|
+
- Ruby 1.9 or 2.x
|
8
8
|
- ActiveSupport (tested with ActiveSupport 3.1 & 3.2)
|
9
9
|
|
10
10
|
== Installation
|
@@ -58,6 +58,7 @@ You may use the following parameters:
|
|
58
58
|
:export_columns # (String) select the columns you want to fetch, for instance: :export_columns => "Dn,Rk"
|
59
59
|
:display_sort # (String) select the column and the order you want to sort with, for instance: :display_sort => 'tr_asc'
|
60
60
|
:display_filter # (String) list of filters for the report, separated by '|' (maximum number - 25). A filter consists of <sign>|<field>|<operation>|<value> (read http://www.semrush.com/api), for instance: :display_filter => '+|Po|Lt|5'
|
61
|
+
:display_date # (String) select the date for the report data, in the format: YYYYMM15
|
61
62
|
|
62
63
|
Some examples:
|
63
64
|
|
@@ -100,6 +101,10 @@ For more information about the report types, please read http://www.semrush.com/
|
|
100
101
|
|
101
102
|
== ChangeLog
|
102
103
|
|
104
|
+
=== 3.0.19, 2016-01-16
|
105
|
+
|
106
|
+
* Fixes map bug with filtered organic report that has no results
|
107
|
+
|
103
108
|
=== 3.0.18, 2014-10-03
|
104
109
|
|
105
110
|
* Add new databases (countries)
|
data/lib/semrush.rb
CHANGED
@@ -8,7 +8,7 @@ require 'semrush/exception'
|
|
8
8
|
require 'semrush/report'
|
9
9
|
|
10
10
|
module Semrush
|
11
|
-
API_REPORT_URL = "http://api.semrush.com/?type=%REPORT_TYPE%&%REQUEST_TYPE%=%REQUEST%&key=%API_KEY%&display_limit=%LIMIT%&display_offset=%OFFSET%&export=api&database=%DB%&export_columns=%EXPORT_COLUMNS%&display_sort=%DISPLAY_SORT%&display_filter=%DISPLAY_FILTER%"
|
11
|
+
API_REPORT_URL = "http://api.semrush.com/?type=%REPORT_TYPE%&%REQUEST_TYPE%=%REQUEST%&key=%API_KEY%&display_limit=%LIMIT%&display_offset=%OFFSET%&export=api&database=%DB%&export_columns=%EXPORT_COLUMNS%&display_sort=%DISPLAY_SORT%&display_filter=%DISPLAY_FILTER%&display_date=%DISPLAY_DATE%"
|
12
12
|
API_UNITS_URL = "http://www.semrush.com/users/countapiunits.html?key=%API_KEY%"
|
13
13
|
mattr_accessor :api_key
|
14
14
|
@@api_key = ""
|
data/lib/semrush/report.rb
CHANGED
@@ -9,7 +9,7 @@ module Semrush
|
|
9
9
|
class Report
|
10
10
|
DBS = [:us, :uk, :ca, :ru, :de, :fr, :es, :it, :br, :au, :ar, :be, :ch, :dk, :fi, :hk, :ie, :il, :mx, :nl, :no, :pl, :se, :sg, :tr] #"us" - for Google.com, "uk" - for Google.co.uk, "ru" - for Google.ru, "de" for Google.de, "fr" for Google.fr, "es" for Google.es, "it" for Google.it Beta, "br" for Google.com.br Beta, "au" for Google.com.au Beta, etc
|
11
11
|
REPORT_TYPES = [:domain_rank, :domain_organic, :domain_adwords, :domain_organic_organic, :domain_adwords_adwords, :domain_organic_adwords, :domain_adwords_organic, :domain_adwords_historical,
|
12
|
-
:phrase_this, :phrase_organic, :phrase_related, :phrase_adwords_historical, :phrase_fullsearch,
|
12
|
+
:phrase_this, :phrase_organic, :phrase_related, :phrase_adwords_historical, :phrase_fullsearch, :phrase_kdi,
|
13
13
|
:url_organic, :url_adwords]
|
14
14
|
REQUEST_TYPES = [:domain, :phrase, :url]
|
15
15
|
|
@@ -261,6 +261,16 @@ module Semrush
|
|
261
261
|
def fullsearch params = {}
|
262
262
|
request(params.merge(:report_type => :phrase_fullsearch))
|
263
263
|
end
|
264
|
+
|
265
|
+
# Keyword Difficulty report
|
266
|
+
# Usage:
|
267
|
+
# > report = Semrush::Report.phrase(phrases.join(';'), database: 'us', limit: 100).kdi
|
268
|
+
# Report constants an array of hashes:
|
269
|
+
# * keyword - phrase for KDI
|
270
|
+
# * keyword_difficulty_index - KDI for phrase
|
271
|
+
def kdi params = {}
|
272
|
+
request(params.merge(:report_type => :phrase_kdi))
|
273
|
+
end
|
264
274
|
|
265
275
|
private
|
266
276
|
|
@@ -306,7 +316,7 @@ module Semrush
|
|
306
316
|
params.delete(:db) unless DBS.include?(params[:db].try(:to_sym))
|
307
317
|
params.delete(:report_type) unless REPORT_TYPES.include?(params[:report_type].try(:to_sym))
|
308
318
|
params.delete(:request_type) unless REQUEST_TYPES.include?(params[:request_type].try(:to_sym))
|
309
|
-
@parameters = {:db => "us", :api_key => Semrush.api_key, :limit => "", :offset => "", :export_columns => "", :display_sort => "", :display_filter => ""}.merge(@parameters).merge(params)
|
319
|
+
@parameters = {:db => "us", :api_key => Semrush.api_key, :limit => "", :offset => "", :export_columns => "", :display_sort => "", :display_filter => "", :display_date => ""}.merge(@parameters).merge(params)
|
310
320
|
raise Semrush::Exception::Nolimit.new(self, "The limit parameter is missing: a limit is required.") unless @parameters[:limit].present? && @parameters[:limit].to_i>0
|
311
321
|
raise Semrush::Exception::BadArgument.new(self, "Request parameter is missing: Domain name, URL, or keywords are required.") unless @parameters[:request].present?
|
312
322
|
raise Semrush::Exception::BadArgument.new(self, "Bad db: #{@parameters[:db]}") unless DBS.include?(@parameters[:db].try(:to_sym))
|
@@ -333,6 +343,7 @@ module Semrush
|
|
333
343
|
end
|
334
344
|
|
335
345
|
def parse(text = "")
|
346
|
+
return [] if text.empty?
|
336
347
|
csv = CSV.parse(text.to_s, :col_sep => ";")
|
337
348
|
data = {}
|
338
349
|
format_key = lambda do |k|
|
data/lib/semrush/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semrush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arambert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|