Class: Liblab::Https
- Inherits:
-
Object
- Object
- Liblab::Https
- Defined in:
- lib/liblab/https.rb
Class Method Summary collapse
Class Method Details
.call(_method, *args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/liblab/https.rb', line 7 def self.call(_method, *args) RestClient.send(_method, *args) rescue RestClient::ExceptionWithResponse => e ::Liblab::Logger.log "ERROR: #{e}" e.response rescue RestClient:: => e ::Liblab::Logger.log "ERROR: #{e.response}" respond_with(400, e.response.body) rescue RestClient::ServiceUnavailable => e ::Liblab::Logger.log "ERROR: #{e.response}" respond_with(400, e.response.body) end |
.respond_with(code, body) ⇒ Object
20 21 22 23 |
# File 'lib/liblab/https.rb', line 20 def self.respond_with(code, body) error_struct = Struct.new(:code, :body) error_struct.new(code, body) end |