Module: Semrush
- Defined in:
- lib/semrush.rb,
lib/semrush/report.rb,
lib/semrush/version.rb,
lib/semrush/exception.rb,
lib/semrush/exception/bad_query.rb,
lib/semrush/exception/bad_api_key.rb,
lib/semrush/exception/bad_argument.rb,
lib/semrush/exception/nothing_found.rb,
lib/semrush/exception/unknown_error.rb,
lib/semrush/exception/api_access_disabled.rb,
lib/semrush/exception/api_report_type_disabled.rb,
lib/semrush/exception/api_units_balance_is_zero.rb
Defined Under Namespace
Modules: Exception Classes: Report
Constant Summary collapse
- API_REPORT_URL =
"https://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%"
- API_UNITS_URL =
"https://www.semrush.com/users/countapiunits.html?key=%API_KEY%"
- VERSION =
we want to follow the API version: for API 3.0, the gem will be version 3.0.x
"3.0.22"
- @@api_key =
""
- @@debug =
false
- @@before =
Proc.new{}
- @@after =
Proc.new{}
Class Method Summary collapse
Class Method Details
.config {|_self| ... } ⇒ Object
22 23 24 25 26 27 |
# File 'lib/semrush.rb', line 22 def self.config yield self raise Exception::BadApiKey.new if @@api_key.nil? || @@api_key.empty? raise Exception::BadArgument.new(self, "before is not a proc: proc type is required.") unless @@before.is_a?(Proc) raise Exception::BadArgument.new(self, "after is not a proc: proc type is required.") unless @@after.is_a?(Proc) end |