semrush 3.0.19 → 3.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7908057cffa77b3bcdf9301152d88bd081ef6722
4
- data.tar.gz: f81b79c34d2073941be4d2e4aab22d8565f8e128
3
+ metadata.gz: f1ffcc2620afe86a94e56018f4f270cf74fce325
4
+ data.tar.gz: 22b3960b8546b4eb7c9ac635ad5aeb2e0b21918d
5
5
  SHA512:
6
- metadata.gz: f8a03d42f79ac83e2b51892b367abd6809eb43ede1ab0b2ea5369994fc6796b201c5705a4ba5a9beb71a13405bf90846414827b56685714c27518622eda56390
7
- data.tar.gz: 2ed8f0f977ff34ef6d9b0f9eaf4cb0ebf05dff93b08f189e984ba1a85c2103553495253c946dfbf4335bc73411e16da8cfa21dbb0ac55c38ba64499eb442b70e
6
+ metadata.gz: 1f51855e45b1521a8a66bad0dc79eb8e3686eb9d6272378ec65830cba6a10a0ad30c2a94bb41b52ee472e73058c095c76c40ec8081e3cc32ccd1f301a5a6de0e
7
+ data.tar.gz: d8ee04ef916a755cc9369eb2f91eb165c00952a19eb09b22a6b707397c088f41011ce08ddf63c140e951a47d0aa93c691674faaf15ca3c7082dc1b3402a219a1
@@ -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)
@@ -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 = ""
@@ -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|
@@ -1,3 +1,3 @@
1
1
  module Semrush
2
- VERSION = "3.0.19" # we want to follow the API version: for API 3.0, the gem will be version 3.0.x
2
+ VERSION = "3.0.20" # we want to follow the API version: for API 3.0, the gem will be version 3.0.x
3
3
  end
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.19
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-01-16 00:00:00.000000000 Z
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport