Sha256: 5655fbdabcefab0e347af08e1e9c09dd2e5984c53bfaa52f6c477bfde154c779

Contents?: true

Size: 717 Bytes

Versions: 7

Compression:

Stored size: 717 Bytes

Contents

module JanioAPI
  class Connection < ActiveResource::Connection
    def request(method, path, *arguments)
      result = ActiveSupport::Notifications.instrument("request.active_resource") { |payload|
        payload[:method] = method
        payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}"

        payload[:result] = if method == :get
          RedirectFetcher.get("#{site}#{path}")
        else
          http.send(method, path, *arguments)
        end
      }
      handle_response(result)
    rescue Timeout::Error => e
      raise ActiveResource::TimeoutError.new(e.message)
    rescue OpenSSL::SSL::SSLError => e
      raise ActiveResource::SSLError.new(e.message)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
janio_api-0.3.15 lib/janio_api/connection.rb
janio_api-0.3.14 lib/janio_api/connection.rb
janio_api-0.3.13 lib/janio_api/connection.rb
janio_api-0.3.12 lib/janio_api/connection.rb
janio_api-0.3.11 lib/janio_api/connection.rb
janio_api-0.3.10 lib/janio_api/connection.rb
janio_api-0.3.9 lib/janio_api/connection.rb