Module: AirbrakeCleanup
- Extended by:
- AirbrakeCleanup
- Included in:
- AirbrakeCleanup
- Defined in:
- lib/airbrake_cleanup.rb,
lib/airbrake_cleanup/railtie.rb
Defined Under Namespace
Classes: Railtie
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#auth_token ⇒ Object
Returns the value of attribute auth_token.
-
#secure ⇒ Object
Returns the value of attribute secure.
Instance Method Summary collapse
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
7 8 9 |
# File 'lib/airbrake_cleanup.rb', line 7 def account @account end |
#auth_token ⇒ Object
Returns the value of attribute auth_token.
7 8 9 |
# File 'lib/airbrake_cleanup.rb', line 7 def auth_token @auth_token end |
#secure ⇒ Object
Returns the value of attribute secure.
7 8 9 |
# File 'lib/airbrake_cleanup.rb', line 7 def secure @secure end |
Instance Method Details
#account_path ⇒ Object
9 10 11 |
# File 'lib/airbrake_cleanup.rb', line 9 def account_path "#{protocol}://#{@account}.airbrake.io" end |
#process ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/airbrake_cleanup.rb', line 17 def process nb = 0 RestClient.log = 'stdout' if Rails.env.development? while true res = RestClient.get "#{account_path}/errors.xml?auth_token=#{self.auth_token}" list = (res.body.scan(/<id[^>]*>([0-9]+?)<\/id>/im) || []).flatten break if list.size == 0 for item in list do begin RestClient.put "#{account_path}/errors/#{item}.xml?auth_token=#{self.auth_token}", :group => { :resolved => true} puts "Flagged error #{item} as resolved" nb += 1 rescue RestClient::ResourceNotFound puts "Error #{item} not found" end end end puts "#{nb} errors resolved" end |
#protocol ⇒ Object
13 14 15 |
# File 'lib/airbrake_cleanup.rb', line 13 def protocol secure ? "https" : "http" end |