Module: Exceptional::Remote
- Included in:
- Exceptional
- Defined in:
- lib/exceptional/remote.rb
Defined Under Namespace
Classes: RemoteException
Instance Method Summary collapse
-
#authenticate ⇒ Object
authenticate with getexceptional.com returns true if the configured api_key is registered and can send data otherwise false.
- #authenticated? ⇒ Boolean
- #post_exception(data) ⇒ Object
Instance Method Details
#authenticate ⇒ Object
authenticate with getexceptional.com returns true if the configured api_key is registered and can send data otherwise false
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/exceptional/remote.rb', line 15 def authenticate return @authenticated if @authenticated if Exceptional.api_key.nil? raise Exceptional::Config::ConfigurationException.new("API Key must be configured") end begin # TODO No data required to authenticate, send a nil string? hacky # TODO should retry if a http connection failed authenticated = call_remote(:authenticate, "") @authenticated = authenticated =~ /true/ ? true : false rescue @authenticated = false ensure return @authenticated end end |
#authenticated? ⇒ Boolean
36 37 38 |
# File 'lib/exceptional/remote.rb', line 36 def authenticated? @authenticated || false end |
#post_exception(data) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/exceptional/remote.rb', line 40 def post_exception(data) if !authenticated? authenticate end call_remote(:errors, data) end |