Class: CouchProxy::Rack::AllDatabases

Inherits:
Base
  • Object
show all
Defined in:
lib/couchproxy/rack/all_databases.rb

Constant Summary collapse

SUFFIX =
/_\d+$/

Constants inherited from Base

Base::APPLICATION_JSON, Base::DESIGN_ID, Base::INVALID_JSON, Base::METHODS, Base::SERVER_VERSION, Base::TEXT_PLAIN

Instance Attribute Summary

Attributes inherited from Base

#cluster, #request

Instance Method Summary collapse

Methods inherited from Base

#initialize, #method_missing, #proxy_to, #proxy_to_all_nodes, #proxy_to_all_partitions, #proxy_to_any_node, #proxy_to_any_partition, #replicate_to_all_partitions, #rewrite_location, #send_error_response, #send_response, #uuids

Constructor Details

This class inherits a constructor from CouchProxy::Rack::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CouchProxy::Rack::Base

Instance Method Details

#getObject



8
9
10
11
12
13
14
15
16
# File 'lib/couchproxy/rack/all_databases.rb', line 8

def get
  proxy_to_all_nodes do |responses|
    dbs = responses.map do |res|
      JSON.parse(res.response).map {|name| name.gsub(SUFFIX, '') }
    end.flatten.uniq.sort
    send_response(responses.first.response_header.status,
      response_headers, [dbs.to_json])
  end
end

#headObject



18
19
20
# File 'lib/couchproxy/rack/all_databases.rb', line 18

def head
  # FIXME
end