lib/semrush.rb in semrush-3.0.7 vs lib/semrush.rb in semrush-3.0.8
- old
+ new
@@ -12,10 +12,14 @@
API_UNITS_URL = "http://fr.semrush.com/users/countapiunits.html?key=%API_KEY%"
mattr_accessor :api_key
@@api_key = ""
mattr_accessor :debug
@@debug = false
+ mattr_accessor :before
+ @@before = Proc.new{}
+ mattr_accessor :after
+ @@after = Proc.new{}
# Email Options (TODO: remove if unnecessary)
# config.email : recipient for the email notifications (default: nil)
# config.email_options : Hash with email config (smtp, sendmail, ...). We use the Pony gem to send mails, this hash will be send to Pony.options
@@ -31,8 +35,10 @@
def self.config
yield self
Pony.options = @@email_options
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
end