Class: LoomException
- Inherits:
-
Object
- Object
- LoomException
- Defined in:
- lib/loom_exception.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#remote_ip ⇒ Object
Returns the value of attribute remote_ip.
-
#request_parameters ⇒ Object
Returns the value of attribute request_parameters.
-
#session ⇒ Object
Returns the value of attribute session.
-
#url ⇒ Object
Returns the value of attribute url.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url, api_key) ⇒ LoomException
constructor
A new instance of LoomException.
- #send_to_loom ⇒ Object
Constructor Details
#initialize(url, api_key) ⇒ LoomException
Returns a new instance of LoomException.
10 11 12 |
# File 'lib/loom_exception.rb', line 10 def initialize(url, api_key) @loom_login = { :url => url, :api_key => api_key } end |
Instance Attribute Details
#cookies ⇒ Object
Returns the value of attribute cookies.
5 6 7 |
# File 'lib/loom_exception.rb', line 5 def end |
#exception ⇒ Object
Returns the value of attribute exception.
5 6 7 |
# File 'lib/loom_exception.rb', line 5 def exception @exception end |
#remote_ip ⇒ Object
Returns the value of attribute remote_ip.
5 6 7 |
# File 'lib/loom_exception.rb', line 5 def remote_ip @remote_ip end |
#request_parameters ⇒ Object
Returns the value of attribute request_parameters.
5 6 7 |
# File 'lib/loom_exception.rb', line 5 def request_parameters @request_parameters end |
#session ⇒ Object
Returns the value of attribute session.
5 6 7 |
# File 'lib/loom_exception.rb', line 5 def session @session end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/loom_exception.rb', line 5 def url @url end |
#user_id ⇒ Object
Returns the value of attribute user_id.
5 6 7 |
# File 'lib/loom_exception.rb', line 5 def user_id @user_id end |
Class Method Details
.log(url, api_key, &block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/loom_exception.rb', line 25 def self.log(url, api_key, &block) loom = new url, api_key yield loom loom.send_to_loom rescue LoomDown # TODO # Timed out or Loom down. Log the error and optionally email the administrator. rescue LoomError # TODO # We sent an invalid request. Log the error and optionally email the administrator. rescue Exception # TODO # Something else happened, log it. The user will be shown an error page so they # can acknowledge the issue and continue using the application. end |
Instance Method Details
#send_to_loom ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/loom_exception.rb', line 14 def send_to_loom response = post if response.code.match /^2/ true else puts response. puts response.body end end |