Sha256: 433cd0c5dbe49c6a7b00d1882fc3348aec3d97f123558cf18a5d750f7cded443

Contents?: true

Size: 400 Bytes

Versions: 3

Compression:

Stored size: 400 Bytes

Contents

module Oria
  class Client < EventMachine::Connection
    attr_reader :response

    def connection_completed
      @connected = true
    end

    def receive_data(data)
      @response = JSON.parse(data)
      close_connection
    end

    def unbind
      raise Oria::ConnectionError.new("Could not connect to the Oria server") unless @connected
      EventMachine.stop_event_loop
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oria-0.0.3 lib/oria/client.rb
oria-0.0.2 lib/oria/client.rb
oria-0.0.1 lib/oria/client.rb