Class: Urkel::Connection
- Inherits:
-
Object
- Object
- Urkel::Connection
- Defined in:
- lib/urkel/connection.rb
Constant Summary collapse
- API_ENDPOINT =
"/api/v1/failures"
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Connection
constructor
A new instance of Connection.
- #publish(error) ⇒ Object
- #publish!(error) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Connection
Returns a new instance of Connection.
5 6 7 |
# File 'lib/urkel/connection.rb', line 5 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#publish(error) ⇒ Object
9 10 11 12 |
# File 'lib/urkel/connection.rb', line 9 def publish(error) response = @configuration.request(request_for(error)) response.is_a?(Net::HTTPOK) end |
#publish!(error) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/urkel/connection.rb', line 14 def publish!(error) response = @configuration.request(request_for(error)) if response.is_a? Net::HTTPOK true elsif response.is_a? Net::HTTPUnauthorized raise InvalidAPITokenError.new else false end end |