Module: ProxyToServer

Defined in:
lib/adhd/adhd_rest_server.rb

Instance Method Summary collapse

Instance Method Details

#initialize(our_client_conn, init_request) ⇒ Object

This implements the connection that proxies an incoming file to to the respective CouchDB instance, as an attachment.



10
11
12
13
14
# File 'lib/adhd/adhd_rest_server.rb', line 10

def initialize our_client_conn, init_request
  @our_client_conn = our_client_conn    
  @init_request = init_request
  our_client_conn.proxy_conn = self
end

#post_initObject



16
17
18
19
20
21
# File 'lib/adhd/adhd_rest_server.rb', line 16

def post_init
   # We have opened a connection to the DB server, so now it is time
   # to send the initial Couch request, using HTTP 1.0.  
   puts "Send request: #{@init_request}"
   send_data @init_request
end

#receive_data(data) ⇒ Object



23
24
25
# File 'lib/adhd/adhd_rest_server.rb', line 23

def receive_data data
  @our_client_conn.proxy_receive_data data
end

#unbindObject



27
28
29
# File 'lib/adhd/adhd_rest_server.rb', line 27

def unbind
  @our_client_conn.proxy_unbind
end