leanback 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.rdoc +35 -0
 - data/README.md +6 -1
 - data/VERSION +1 -1
 - data/leanback.gemspec +3 -2
 - data/lib/leanback.rb +47 -12
 - data/spec/admin_party/database_spec.rb +127 -0
 - data/spec/no_admin_party/database_spec.rb +126 -0
 - data/test/main.rb +44 -1
 - data/test/start.json +8 -0
 - metadata +4 -3
 
    
        data/Changelog.rdoc
    CHANGED
    
    | 
         @@ -1,3 +1,38 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            =0.3.4
         
     | 
| 
      
 2 
     | 
    
         
            +
            June 2, 2013
         
     | 
| 
      
 3 
     | 
    
         
            +
            * added options for manipulating query results, the options available are limit, skip, descending, startkey, endkey
         
     | 
| 
      
 4 
     | 
    
         
            +
            Example
         
     | 
| 
      
 5 
     | 
    
         
            +
             options = {:skip => 10,:limit => 20}
         
     | 
| 
      
 6 
     | 
    
         
            +
             Couchdb.find_by({:database => 'contacts', :gender => 'female'},auth_session, options)
         
     | 
| 
      
 7 
     | 
    
         
            +
            This will skip the first 10 results and return the next 20 that match the key :gender => 'female'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Another example
         
     | 
| 
      
 10 
     | 
    
         
            +
             options = {:startkey => "53000", :endkey => "99000",:limit => 20}
         
     | 
| 
      
 11 
     | 
    
         
            +
             Couchdb.find_by({:database => 'employees', :salary => ''},auth_session, options)
         
     | 
| 
      
 12 
     | 
    
         
            +
            This will return all employees with salary between 53000 and 99000.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            Direct view query: 
         
     | 
| 
      
 15 
     | 
    
         
            +
               view = { :database => "employees", 
         
     | 
| 
      
 16 
     | 
    
         
            +
                      :design_doc => 'salary_finder', 
         
     | 
| 
      
 17 
     | 
    
         
            +
                        :view => 'find_by_salary'}
         
     | 
| 
      
 18 
     | 
    
         
            +
             options = {:startkey => "53000", :endkey => "99000"}
         
     | 
| 
      
 19 
     | 
    
         
            +
             Couchdb.find view, auth_session,key=nil, options
         
     | 
| 
      
 20 
     | 
    
         
            +
            This will also return all employees with salary between 53000 and 99000.
         
     | 
| 
      
 21 
     | 
    
         
            +
            See leanback documentation for details.
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
            =0.3.3
         
     | 
| 
      
 24 
     | 
    
         
            +
            May 26, 2013
         
     | 
| 
      
 25 
     | 
    
         
            +
            * Added ability to count the number of documents in a database by a specified key.
         
     | 
| 
      
 26 
     | 
    
         
            +
            Example: 
         
     | 
| 
      
 27 
     | 
    
         
            +
             Couchdb.count({:database => 'contacts', :gender => 'female'},auth_session) 
         
     | 
| 
      
 28 
     | 
    
         
            +
             # => 8
         
     | 
| 
      
 29 
     | 
    
         
            +
            This will count the number of documents with gender = 'female'
         
     | 
| 
      
 30 
     | 
    
         
            +
            See leanback documentation for details.
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            =0.3.2
         
     | 
| 
      
 33 
     | 
    
         
            +
            December 01, 2012
         
     | 
| 
      
 34 
     | 
    
         
            +
            * Fixed issues with invalid JSON on CouchDB 1.2.0
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
       1 
36 
     | 
    
         
             
            =Leanback 0.3.1
         
     | 
| 
       2 
37 
     | 
    
         
             
            December 5,2011
         
     | 
| 
       3 
38 
     | 
    
         
             
            * Added ability to change password for non-admin users.
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -13,6 +13,9 @@ This project is still under development. Not complete by any means. I made this 
     | 
|
| 
       13 
13 
     | 
    
         
             
            ##Compatibility
         
     | 
| 
       14 
14 
     | 
    
         
             
            Upgraded and tested on CouchDB 1.2.0. CouchDB 1.0.1 should still work fine. 
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
            ##Changes
         
     | 
| 
      
 17 
     | 
    
         
            +
            (https://github.com/obi-a/leanback/blob/master/Changelog.rdoc)
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       16 
19 
     | 
    
         
             
            ##Usage
         
     | 
| 
       17 
20 
     | 
    
         | 
| 
       18 
21 
     | 
    
         | 
| 
         @@ -24,6 +27,8 @@ Upgraded and tested on CouchDB 1.2.0. CouchDB 1.0.1 should still work fine. 
     | 
|
| 
       24 
27 
     | 
    
         | 
| 
       25 
28 
     | 
    
         
             
               + [Find Documents by Key](http://www.whisperservers.com/leanback/find-documents-by-key/)
         
     | 
| 
       26 
29 
     | 
    
         | 
| 
      
 30 
     | 
    
         
            +
               + [Count Documents by Key](http://www.whisperservers.com/leanback/count-documents-by-key/)
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       27 
32 
     | 
    
         
             
               + Working with [CouchDB Views](http://www.whisperservers.com/leanback/design-documents-and-permanent-views/)
         
     | 
| 
       28 
33 
     | 
    
         | 
| 
       29 
34 
     | 
    
         
             
               + [Error Handling](http://www.whisperservers.com/leanback/error-handling/)
         
     | 
| 
         @@ -39,6 +44,6 @@ MIT License. 
     | 
|
| 
       39 
44 
     | 
    
         | 
| 
       40 
45 
     | 
    
         
             
            ##Copyright
         
     | 
| 
       41 
46 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
            Copyright (c)  
     | 
| 
      
 47 
     | 
    
         
            +
            Copyright (c) 2013 Obi Akubue. 
         
     | 
| 
       43 
48 
     | 
    
         | 
| 
       44 
49 
     | 
    
         | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.3. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.3.4
         
     | 
    
        data/leanback.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = "leanback"
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0.3. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.3.4"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Obi Akubue"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = "2013- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = "2013-06-02"
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = "lightweight Ruby interface to CouchDB"
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = "obioraakubue@yahoo.com"
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
         @@ -35,6 +35,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       35 
35 
     | 
    
         
             
                "test/main.rb",
         
     | 
| 
       36 
36 
     | 
    
         
             
                "test/my_view.json",
         
     | 
| 
       37 
37 
     | 
    
         
             
                "test/my_views.json",
         
     | 
| 
      
 38 
     | 
    
         
            +
                "test/start.json",
         
     | 
| 
       38 
39 
     | 
    
         
             
                "test/test_leanback.rb",
         
     | 
| 
       39 
40 
     | 
    
         
             
                "test/view_age.json"
         
     | 
| 
       40 
41 
     | 
    
         
             
              ]
         
     | 
    
        data/lib/leanback.rb
    CHANGED
    
    | 
         @@ -258,17 +258,53 @@ def self.view(doc,auth_session = "") 
     | 
|
| 
       258 
258 
     | 
    
         
             
             end 
         
     | 
| 
       259 
259 
     | 
    
         
             
            end
         
     | 
| 
       260 
260 
     | 
    
         | 
| 
      
 261 
     | 
    
         
            +
            def self.get_params(options)
         
     | 
| 
      
 262 
     | 
    
         
            +
             params = ""
         
     | 
| 
      
 263 
     | 
    
         
            +
             if options.has_key?(:startkey)
         
     | 
| 
      
 264 
     | 
    
         
            +
              if options[:startkey].is_a? String
         
     | 
| 
      
 265 
     | 
    
         
            +
               params = 'startkey="' + options[:startkey] + '"'
         
     | 
| 
      
 266 
     | 
    
         
            +
              else
         
     | 
| 
      
 267 
     | 
    
         
            +
               params = 'startkey=' + options[:startkey].to_s # for complex keys
         
     | 
| 
      
 268 
     | 
    
         
            +
              end
         
     | 
| 
      
 269 
     | 
    
         
            +
             end
         
     | 
| 
      
 270 
     | 
    
         
            +
             if options.has_key?(:endkey)
         
     | 
| 
      
 271 
     | 
    
         
            +
              if options[:endkey].is_a? String
         
     | 
| 
      
 272 
     | 
    
         
            +
               params = params + '&endkey="' + options[:endkey] + '"'
         
     | 
| 
      
 273 
     | 
    
         
            +
              else
         
     | 
| 
      
 274 
     | 
    
         
            +
               params = params + '&endkey=' + options[:endkey].to_s  #for complex keys
         
     | 
| 
      
 275 
     | 
    
         
            +
              end
         
     | 
| 
      
 276 
     | 
    
         
            +
             end
         
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
      
 278 
     | 
    
         
            +
             if options.has_key?(:limit)
         
     | 
| 
      
 279 
     | 
    
         
            +
              params = params + "&" + "limit=" + options[:limit].to_s
         
     | 
| 
      
 280 
     | 
    
         
            +
             end
         
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
             if options.has_key?(:skip)
         
     | 
| 
      
 283 
     | 
    
         
            +
              params = params + "&" + "skip=" + options[:skip].to_s
         
     | 
| 
      
 284 
     | 
    
         
            +
             end
         
     | 
| 
      
 285 
     | 
    
         
            +
             
     | 
| 
      
 286 
     | 
    
         
            +
              if options.has_key?(:descending)
         
     | 
| 
      
 287 
     | 
    
         
            +
              params = params + "&" + "descending=true"
         
     | 
| 
      
 288 
     | 
    
         
            +
             end
         
     | 
| 
      
 289 
     | 
    
         
            +
             
     | 
| 
      
 290 
     | 
    
         
            +
             return params
         
     | 
| 
      
 291 
     | 
    
         
            +
            end
         
     | 
| 
      
 292 
     | 
    
         
            +
             
     | 
| 
      
 293 
     | 
    
         
            +
             
     | 
| 
       261 
294 
     | 
    
         
             
            #query a permanent view
         
     | 
| 
       262 
     | 
    
         
            -
            def self.find(doc,auth_session = "",key=nil)
         
     | 
| 
      
 295 
     | 
    
         
            +
            def self.find(doc,auth_session = "", key=nil, options = {})
         
     | 
| 
       263 
296 
     | 
    
         
             
             set_address
         
     | 
| 
       264 
297 
     | 
    
         
             
             db_name = doc[:database]
         
     | 
| 
       265 
298 
     | 
    
         
             
             design_doc_name = doc[:design_doc]
         
     | 
| 
       266 
299 
     | 
    
         
             
             view_name = doc[:view]
         
     | 
| 
      
 300 
     | 
    
         
            +
             params = get_params(options)
         
     | 
| 
      
 301 
     | 
    
         
            +
               
         
     | 
| 
       267 
302 
     | 
    
         
             
               begin
         
     | 
| 
       268 
303 
     | 
    
         
             
                if key == nil
         
     | 
| 
       269 
     | 
    
         
            -
                 response = RestClient.get 'http://' + @address + ':' + @port + '/' + db_name + '/_design/' + design_doc_name + '/_view/' + view_name,{:cookies => {"AuthSession" => auth_session}}
         
     | 
| 
      
 304 
     | 
    
         
            +
                 response = RestClient.get 'http://' + @address + ':' + @port + '/' + db_name + '/_design/' + design_doc_name + '/_view/' + view_name + '?' + URI.escape(params),{:cookies => {"AuthSession" => auth_session}}
         
     | 
| 
       270 
305 
     | 
    
         
             
                else
         
     | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
      
 306 
     | 
    
         
            +
                  key = URI.escape('?key="' + key + '"')
         
     | 
| 
      
 307 
     | 
    
         
            +
                  response = RestClient.get 'http://' + @address + ':' + @port + '/' + db_name + '/_design/' + design_doc_name + '/_view/' + view_name + key + '&' + URI.escape(params) ,{:cookies => {"AuthSession" => auth_session}}
         
     | 
| 
       272 
308 
     | 
    
         
             
                end
         
     | 
| 
       273 
309 
     | 
    
         
             
                 hash = Yajl::Parser.parse(response.to_str)
         
     | 
| 
       274 
310 
     | 
    
         
             
                 rows = hash["rows"]
         
     | 
| 
         @@ -279,7 +315,6 @@ def self.find(doc,auth_session = "",key=nil) 
     | 
|
| 
       279 
315 
     | 
    
         
             
                 end
         
     | 
| 
       280 
316 
     | 
    
         
             
                 return rows
         
     | 
| 
       281 
317 
     | 
    
         
             
               rescue => e
         
     | 
| 
       282 
     | 
    
         
            -
                #puts e.inspect
         
     | 
| 
       283 
318 
     | 
    
         
             
                hash = Yajl::Parser.parse(e.response.to_s)
         
     | 
| 
       284 
319 
     | 
    
         
             
                raise CouchdbException.new(hash), "CouchDB: Error - " + hash.values[0] + ". Reason - "  + hash.values[1]
         
     | 
| 
       285 
320 
     | 
    
         
             
               end
         
     | 
| 
         @@ -311,7 +346,7 @@ def self.create_design(doc,auth_session = "") 
     | 
|
| 
       311 
346 
     | 
    
         
             
            end
         
     | 
| 
       312 
347 
     | 
    
         | 
| 
       313 
348 
     | 
    
         
             
            #Query view, create view on fly if it dosen't already exist
         
     | 
| 
       314 
     | 
    
         
            -
            def self.find_on_fly(doc,auth_session = "",key = nil)  
         
     | 
| 
      
 349 
     | 
    
         
            +
            def self.find_on_fly(doc,auth_session = "",key = nil, options = {})  
         
     | 
| 
       315 
350 
     | 
    
         
             
               db_name = doc[:database]
         
     | 
| 
       316 
351 
     | 
    
         
             
               design_doc = doc[:design_doc]
         
     | 
| 
       317 
352 
     | 
    
         
             
               view = doc[:view]
         
     | 
| 
         @@ -319,17 +354,17 @@ def self.find_on_fly(doc,auth_session = "",key = nil) 
     | 
|
| 
       319 
354 
     | 
    
         | 
| 
       320 
355 
     | 
    
         
             
               begin 
         
     | 
| 
       321 
356 
     | 
    
         
             
                  if( key == nil)
         
     | 
| 
       322 
     | 
    
         
            -
                   docs = find({:database => db_name, :design_doc => design_doc, :view => view},auth_session) 
         
     | 
| 
      
 357 
     | 
    
         
            +
                   docs = find({:database => db_name, :design_doc => design_doc, :view => view},auth_session,key=nil,options) 
         
     | 
| 
       323 
358 
     | 
    
         
             
                  else
         
     | 
| 
       324 
     | 
    
         
            -
                   docs = find({:database => db_name, :design_doc => design_doc, :view => view},auth_session,key) 
         
     | 
| 
      
 359 
     | 
    
         
            +
                   docs = find({:database => db_name, :design_doc => design_doc, :view => view},auth_session,key,options) 
         
     | 
| 
       325 
360 
     | 
    
         
             
                  end
         
     | 
| 
       326 
361 
     | 
    
         
             
                 rescue CouchdbException => e
         
     | 
| 
       327 
362 
     | 
    
         
             
                    document = { :database => db_name, :design_doc => design_doc, :json_doc => json_doc}
         
     | 
| 
       328 
363 
     | 
    
         
             
                    create_design document,auth_session
         
     | 
| 
       329 
364 
     | 
    
         
             
                    if( key == nil)
         
     | 
| 
       330 
     | 
    
         
            -
                      docs = find({:database => db_name, :design_doc => design_doc, :view => view},auth_session) 
         
     | 
| 
      
 365 
     | 
    
         
            +
                      docs = find({:database => db_name, :design_doc => design_doc, :view => view},auth_session,key=nil,options) 
         
     | 
| 
       331 
366 
     | 
    
         
             
                    else
         
     | 
| 
       332 
     | 
    
         
            -
                      docs = find({:database => db_name, :design_doc => design_doc, :view => view},auth_session,key) 
         
     | 
| 
      
 367 
     | 
    
         
            +
                      docs = find({:database => db_name, :design_doc => design_doc, :view => view},auth_session,key,options) 
         
     | 
| 
       333 
368 
     | 
    
         
             
                    end
         
     | 
| 
       334 
369 
     | 
    
         
             
                  end
         
     | 
| 
       335 
370 
     | 
    
         
             
                return docs
         
     | 
| 
         @@ -409,7 +444,7 @@ def self.count(options,auth_session = "") 
     | 
|
| 
       409 
444 
     | 
    
         
             
            end
         
     | 
| 
       410 
445 
     | 
    
         | 
| 
       411 
446 
     | 
    
         
             
            #find by key 
         
     | 
| 
       412 
     | 
    
         
            -
            def self.find_by(options,auth_session = "")
         
     | 
| 
      
 447 
     | 
    
         
            +
            def self.find_by(options,auth_session = "", params = {})
         
     | 
| 
       413 
448 
     | 
    
         
             
             set_address 
         
     | 
| 
       414 
449 
     | 
    
         
             
             db_name = options[:database]
         
     | 
| 
       415 
450 
     | 
    
         
             
             index =  options.keys[1].to_s
         
     | 
| 
         @@ -419,12 +454,12 @@ def self.find_by(options,auth_session = "") 
     | 
|
| 
       419 
454 
     | 
    
         | 
| 
       420 
455 
     | 
    
         
             
             begin 
         
     | 
| 
       421 
456 
     | 
    
         
             
              view = { :database => db_name, :design_doc => design_doc_name, :view => view_name}
         
     | 
| 
       422 
     | 
    
         
            -
              docs = find view,auth_session,search_term
         
     | 
| 
      
 457 
     | 
    
         
            +
              docs = find view,auth_session,search_term,params
         
     | 
| 
       423 
458 
     | 
    
         
             
             rescue CouchdbException => e
         
     | 
| 
       424 
459 
     | 
    
         
             
                #add a finder/index if one doesn't already exist in the database
         
     | 
| 
       425 
460 
     | 
    
         
             
                #then find_by_key
         
     | 
| 
       426 
461 
     | 
    
         
             
                add_finder({:database => db_name, :key => index},auth_session)
         
     | 
| 
       427 
     | 
    
         
            -
                docs = find view,auth_session,search_term
         
     | 
| 
      
 462 
     | 
    
         
            +
                docs = find view,auth_session,search_term,params
         
     | 
| 
       428 
463 
     | 
    
         
             
             end
         
     | 
| 
       429 
464 
     | 
    
         
             
             return docs
         
     | 
| 
       430 
465 
     | 
    
         
             
            end
         
     | 
| 
         @@ -185,6 +185,133 @@ it "should delete a document after creating it" do 
     | 
|
| 
       185 
185 
     | 
    
         
             
                end
         
     | 
| 
       186 
186 
     | 
    
         
             
            end
         
     | 
| 
       187 
187 
     | 
    
         | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
            it "should test finder options" do
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
              Couchdb.create('fishes')
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
              data = {:firstname => 'aaron', :gender =>'male', :age => '28', :salary => '50000'}
         
     | 
| 
      
 194 
     | 
    
         
            +
              doc = {:database => 'fishes', :doc_id => 'aaron', :data => data}
         
     | 
| 
      
 195 
     | 
    
         
            +
              Couchdb.create_doc doc
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
              data = {:firstname => 'john', :gender =>'male', :age => '28', :salary => '60000'}
         
     | 
| 
      
 198 
     | 
    
         
            +
              doc = {:database => 'fishes', :doc_id => 'john', :data => data}
         
     | 
| 
      
 199 
     | 
    
         
            +
              Couchdb.create_doc doc
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
              data = {:firstname => 'peter', :gender =>'male', :age => '45', :salary => '78000'}
         
     | 
| 
      
 202 
     | 
    
         
            +
              doc = {:database => 'fishes', :doc_id => 'peter', :data => data}
         
     | 
| 
      
 203 
     | 
    
         
            +
              Couchdb.create_doc doc
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
      
 205 
     | 
    
         
            +
              data = {:firstname => 'sam', :gender =>'male', :age => '28', :salary => '97000'}
         
     | 
| 
      
 206 
     | 
    
         
            +
              doc = {:database => 'fishes', :doc_id => 'sam', :data => data}
         
     | 
| 
      
 207 
     | 
    
         
            +
              Couchdb.create_doc doc
         
     | 
| 
      
 208 
     | 
    
         
            +
              
         
     | 
| 
      
 209 
     | 
    
         
            +
              #create the design doc to be queryed in the test
         
     | 
| 
      
 210 
     | 
    
         
            +
              Couchdb.find_by({:database => 'fishes', :gender => 'male'})
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
              view = { :database => "fishes", 
         
     | 
| 
      
 214 
     | 
    
         
            +
                      :design_doc => 'gender_finder', 
         
     | 
| 
      
 215 
     | 
    
         
            +
                        :view => 'find_by_gender'}
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
              hash = Couchdb.find view,"",key=nil, options = {:limit => 2, :skip => 1}
         
     | 
| 
      
 218 
     | 
    
         
            +
              h = hash[0]
         
     | 
| 
      
 219 
     | 
    
         
            +
              h["firstname"].should == "john"
         
     | 
| 
      
 220 
     | 
    
         
            +
              hash.length.should == 2
         
     | 
| 
      
 221 
     | 
    
         
            +
             
     | 
| 
      
 222 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :gender => 'male'},"",options = {:limit => 2, :skip => 1})
         
     | 
| 
      
 223 
     | 
    
         
            +
              h = hash[0]
         
     | 
| 
      
 224 
     | 
    
         
            +
              h["firstname"].should == "john"
         
     | 
| 
      
 225 
     | 
    
         
            +
              hash.length.should == 2
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
             
         
     | 
| 
      
 228 
     | 
    
         
            +
             
     | 
| 
      
 229 
     | 
    
         
            +
             hash = Couchdb.find view,"",key='male', options = {:descending => true}
         
     | 
| 
      
 230 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 231 
     | 
    
         
            +
             h["firstname"].should == "sam"
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
      
 233 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :gender => 'male'},"", options = {:descending => true})
         
     | 
| 
      
 234 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 235 
     | 
    
         
            +
             h["firstname"].should == "sam" 
         
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
      
 237 
     | 
    
         
            +
             
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
             hash = Couchdb.find view,"",key='male', options = {:limit => 3}
         
     | 
| 
      
 240 
     | 
    
         
            +
             hash.length.should == 3
         
     | 
| 
      
 241 
     | 
    
         
            +
             
     | 
| 
      
 242 
     | 
    
         
            +
             hash = Couchdb.find view,"",key=nil, options = {:skip => 2}
         
     | 
| 
      
 243 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 244 
     | 
    
         
            +
             h["firstname"].should == "peter"
         
     | 
| 
      
 245 
     | 
    
         
            +
             hash.length.should == 2
         
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
      
 247 
     | 
    
         
            +
             hash = Couchdb.find view,"",key='male', options = {:descending => true,:limit => 1}
         
     | 
| 
      
 248 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 249 
     | 
    
         
            +
             h["firstname"].should == "sam"
         
     | 
| 
      
 250 
     | 
    
         
            +
             hash.length.should == 1
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :gender => 'male'},"", options = {:descending => true,:limit => 1})
         
     | 
| 
      
 253 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 254 
     | 
    
         
            +
             h["firstname"].should == "sam"
         
     | 
| 
      
 255 
     | 
    
         
            +
             hash.length.should == 1
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :salary => '5000'})
         
     | 
| 
      
 258 
     | 
    
         
            +
             
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
              view = { :database => "fishes", 
         
     | 
| 
      
 261 
     | 
    
         
            +
                      :design_doc => 'salary_finder', 
         
     | 
| 
      
 262 
     | 
    
         
            +
                        :view => 'find_by_salary'}
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
             hash = Couchdb.find view, "",key=nil, options = {:startkey => "3000", :endkey => "65000"}
         
     | 
| 
      
 265 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 266 
     | 
    
         
            +
             h["firstname"].should == "aaron"
         
     | 
| 
      
 267 
     | 
    
         
            +
             hash.length.should == 2
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
             hash = Couchdb.find view, "",key=nil, options = {:startkey => "53000", :endkey => "99000",:limit => 2}
         
     | 
| 
      
 270 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 271 
     | 
    
         
            +
             h["firstname"].should == "john"
         
     | 
| 
      
 272 
     | 
    
         
            +
             hash.length.should == 2
         
     | 
| 
      
 273 
     | 
    
         
            +
             
         
     | 
| 
      
 274 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :salary => '5000'},"", options = {:startkey => "53000", :endkey => "99000",:limit => 2})
         
     | 
| 
      
 275 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 276 
     | 
    
         
            +
             h["firstname"].should == "john"
         
     | 
| 
      
 277 
     | 
    
         
            +
             hash.length.should == 2
         
     | 
| 
      
 278 
     | 
    
         
            +
             
     | 
| 
      
 279 
     | 
    
         
            +
                view = {:database => 'fishes',
         
     | 
| 
      
 280 
     | 
    
         
            +
                     :design_doc => 'my_views',
         
     | 
| 
      
 281 
     | 
    
         
            +
                      :view => 'age_gender',
         
     | 
| 
      
 282 
     | 
    
         
            +
                       :json_doc => '/home/obi/bin/leanback/test/start.json'}
         
     | 
| 
      
 283 
     | 
    
         
            +
             
     | 
| 
      
 284 
     | 
    
         
            +
             options = {:startkey => ["28","male"], :endkey => ["28","male"], :limit => 2}
         
     | 
| 
      
 285 
     | 
    
         
            +
                 
         
     | 
| 
      
 286 
     | 
    
         
            +
             hash = Couchdb.find_on_fly(view,"",key=nil, options)
         
     | 
| 
      
 287 
     | 
    
         
            +
               h0 = hash[0]
         
     | 
| 
      
 288 
     | 
    
         
            +
               h1 = hash[1]
         
     | 
| 
      
 289 
     | 
    
         
            +
               h0["firstname"].should == "aaron"
         
     | 
| 
      
 290 
     | 
    
         
            +
               h1["firstname"].should == "john"
         
     | 
| 
      
 291 
     | 
    
         
            +
               hash.length.should == 2
         
     | 
| 
      
 292 
     | 
    
         
            +
             
     | 
| 
      
 293 
     | 
    
         
            +
             options = {:startkey => ["28","male"], :endkey => ["28","male"], :skip => 1}
         
     | 
| 
      
 294 
     | 
    
         
            +
             
     | 
| 
      
 295 
     | 
    
         
            +
              hash = Couchdb.find_on_fly(view,"",key=nil, options)
         
     | 
| 
      
 296 
     | 
    
         
            +
               h0 = hash[0]
         
     | 
| 
      
 297 
     | 
    
         
            +
               h1 = hash[1]
         
     | 
| 
      
 298 
     | 
    
         
            +
               h0["firstname"].should == "john"
         
     | 
| 
      
 299 
     | 
    
         
            +
               h1["firstname"].should == "sam"
         
     | 
| 
      
 300 
     | 
    
         
            +
               hash.length.should == 2
         
     | 
| 
      
 301 
     | 
    
         
            +
             
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
             options = {:startkey => ["28","male"], :endkey => ["28","male"]}
         
     | 
| 
      
 304 
     | 
    
         
            +
             
     | 
| 
      
 305 
     | 
    
         
            +
              hash = Couchdb.find_on_fly(view,"",key=nil, options)
         
     | 
| 
      
 306 
     | 
    
         
            +
               h0 = hash[0]
         
     | 
| 
      
 307 
     | 
    
         
            +
               h1 = hash[1]
         
     | 
| 
      
 308 
     | 
    
         
            +
               h0["firstname"].should == "aaron"
         
     | 
| 
      
 309 
     | 
    
         
            +
               h1["firstname"].should == "john"
         
     | 
| 
      
 310 
     | 
    
         
            +
               hash.length.should == 3
         
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
      
 312 
     | 
    
         
            +
             Couchdb.delete 'fishes'
         
     | 
| 
      
 313 
     | 
    
         
            +
            end
         
     | 
| 
      
 314 
     | 
    
         
            +
             
     | 
| 
       188 
315 
     | 
    
         
             
            #database: administration tasks
         
     | 
| 
       189 
316 
     | 
    
         | 
| 
       190 
317 
     | 
    
         
             
            it "should set a config section, retrieve it and delete it" do
         
     | 
| 
         @@ -194,6 +194,132 @@ it "should delete a document after creating it" do 
     | 
|
| 
       194 
194 
     | 
    
         
             
                end
         
     | 
| 
       195 
195 
     | 
    
         
             
            end
         
     | 
| 
       196 
196 
     | 
    
         | 
| 
      
 197 
     | 
    
         
            +
            it "should test finder options" do
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
              Couchdb.create('fishes',@@auth_session)
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
              data = {:firstname => 'aaron', :gender =>'male', :age => '28', :salary => '50000'}
         
     | 
| 
      
 202 
     | 
    
         
            +
              doc = {:database => 'fishes', :doc_id => 'aaron', :data => data}
         
     | 
| 
      
 203 
     | 
    
         
            +
              Couchdb.create_doc doc,@@auth_session
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
      
 205 
     | 
    
         
            +
              data = {:firstname => 'john', :gender =>'male', :age => '28', :salary => '60000'}
         
     | 
| 
      
 206 
     | 
    
         
            +
              doc = {:database => 'fishes', :doc_id => 'john', :data => data}
         
     | 
| 
      
 207 
     | 
    
         
            +
              Couchdb.create_doc doc,@@auth_session
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
              data = {:firstname => 'peter', :gender =>'male', :age => '45', :salary => '78000'}
         
     | 
| 
      
 210 
     | 
    
         
            +
              doc = {:database => 'fishes', :doc_id => 'peter', :data => data}
         
     | 
| 
      
 211 
     | 
    
         
            +
              Couchdb.create_doc doc,@@auth_session
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
              data = {:firstname => 'sam', :gender =>'male', :age => '28', :salary => '97000'}
         
     | 
| 
      
 214 
     | 
    
         
            +
              doc = {:database => 'fishes', :doc_id => 'sam', :data => data}
         
     | 
| 
      
 215 
     | 
    
         
            +
              Couchdb.create_doc doc,@@auth_session
         
     | 
| 
      
 216 
     | 
    
         
            +
              
         
     | 
| 
      
 217 
     | 
    
         
            +
              #create the design doc to be queryed in the test
         
     | 
| 
      
 218 
     | 
    
         
            +
              Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session)
         
     | 
| 
      
 219 
     | 
    
         
            +
             
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
              view = { :database => "fishes", 
         
     | 
| 
      
 222 
     | 
    
         
            +
                      :design_doc => 'gender_finder', 
         
     | 
| 
      
 223 
     | 
    
         
            +
                        :view => 'find_by_gender'}
         
     | 
| 
      
 224 
     | 
    
         
            +
             
     | 
| 
      
 225 
     | 
    
         
            +
              hash = Couchdb.find view,@@auth_session,key=nil, options = {:limit => 2, :skip => 1}
         
     | 
| 
      
 226 
     | 
    
         
            +
              h = hash[0]
         
     | 
| 
      
 227 
     | 
    
         
            +
              h["firstname"].should == "john"
         
     | 
| 
      
 228 
     | 
    
         
            +
              hash.length.should == 2
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session,options = {:limit => 2, :skip => 1})
         
     | 
| 
      
 231 
     | 
    
         
            +
              h = hash[0]
         
     | 
| 
      
 232 
     | 
    
         
            +
              h["firstname"].should == "john"
         
     | 
| 
      
 233 
     | 
    
         
            +
              hash.length.should == 2
         
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
      
 235 
     | 
    
         
            +
             
         
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
      
 237 
     | 
    
         
            +
             hash = Couchdb.find view,@@auth_session,key='male', options = {:descending => true}
         
     | 
| 
      
 238 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 239 
     | 
    
         
            +
             h["firstname"].should == "sam"
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session, options = {:descending => true})
         
     | 
| 
      
 242 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 243 
     | 
    
         
            +
             h["firstname"].should == "sam" 
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
             
     | 
| 
      
 246 
     | 
    
         
            +
             
     | 
| 
      
 247 
     | 
    
         
            +
             hash = Couchdb.find view,@@auth_session,key='male', options = {:limit => 3}
         
     | 
| 
      
 248 
     | 
    
         
            +
             hash.length.should == 3
         
     | 
| 
      
 249 
     | 
    
         
            +
             
     | 
| 
      
 250 
     | 
    
         
            +
             hash = Couchdb.find view,@@auth_session,key=nil, options = {:skip => 2}
         
     | 
| 
      
 251 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 252 
     | 
    
         
            +
             h["firstname"].should == "peter"
         
     | 
| 
      
 253 
     | 
    
         
            +
             hash.length.should == 2
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
             hash = Couchdb.find view,@@auth_session,key='male', options = {:descending => true,:limit => 1}
         
     | 
| 
      
 256 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 257 
     | 
    
         
            +
             h["firstname"].should == "sam"
         
     | 
| 
      
 258 
     | 
    
         
            +
             hash.length.should == 1
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session, options = {:descending => true,:limit => 1})
         
     | 
| 
      
 261 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 262 
     | 
    
         
            +
             h["firstname"].should == "sam"
         
     | 
| 
      
 263 
     | 
    
         
            +
             hash.length.should == 1
         
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
      
 265 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :salary => '5000'},@@auth_session)
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
             
     | 
| 
      
 268 
     | 
    
         
            +
              view = { :database => "fishes", 
         
     | 
| 
      
 269 
     | 
    
         
            +
                      :design_doc => 'salary_finder', 
         
     | 
| 
      
 270 
     | 
    
         
            +
                        :view => 'find_by_salary'}
         
     | 
| 
      
 271 
     | 
    
         
            +
             
     | 
| 
      
 272 
     | 
    
         
            +
             hash = Couchdb.find view, @@auth_session,key=nil, options = {:startkey => "3000", :endkey => "65000"}
         
     | 
| 
      
 273 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 274 
     | 
    
         
            +
             h["firstname"].should == "aaron"
         
     | 
| 
      
 275 
     | 
    
         
            +
             hash.length.should == 2
         
     | 
| 
      
 276 
     | 
    
         
            +
             
     | 
| 
      
 277 
     | 
    
         
            +
             hash = Couchdb.find view, @@auth_session,key=nil, options = {:startkey => "53000", :endkey => "99000",:limit => 2}
         
     | 
| 
      
 278 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 279 
     | 
    
         
            +
             h["firstname"].should == "john"
         
     | 
| 
      
 280 
     | 
    
         
            +
             hash.length.should == 2
         
     | 
| 
      
 281 
     | 
    
         
            +
             
         
     | 
| 
      
 282 
     | 
    
         
            +
             Couchdb.find_by({:database => 'fishes', :salary => ''},@@auth_session, options = {:startkey => "53000", :endkey => "99000",:limit => 2})
         
     | 
| 
      
 283 
     | 
    
         
            +
             h = hash[0]
         
     | 
| 
      
 284 
     | 
    
         
            +
             h["firstname"].should == "john"
         
     | 
| 
      
 285 
     | 
    
         
            +
             hash.length.should == 2
         
     | 
| 
      
 286 
     | 
    
         
            +
             
     | 
| 
      
 287 
     | 
    
         
            +
                view = {:database => 'fishes',
         
     | 
| 
      
 288 
     | 
    
         
            +
                     :design_doc => 'my_views',
         
     | 
| 
      
 289 
     | 
    
         
            +
                      :view => 'age_gender',
         
     | 
| 
      
 290 
     | 
    
         
            +
                       :json_doc => '/home/obi/bin/leanback/test/start.json'}
         
     | 
| 
      
 291 
     | 
    
         
            +
             
     | 
| 
      
 292 
     | 
    
         
            +
             options = {:startkey => ["28","male"], :endkey => ["28","male"], :limit => 2}
         
     | 
| 
      
 293 
     | 
    
         
            +
                 
         
     | 
| 
      
 294 
     | 
    
         
            +
             hash = Couchdb.find_on_fly(view,@@auth_session,key=nil, options)
         
     | 
| 
      
 295 
     | 
    
         
            +
               h0 = hash[0]
         
     | 
| 
      
 296 
     | 
    
         
            +
               h1 = hash[1]
         
     | 
| 
      
 297 
     | 
    
         
            +
               h0["firstname"].should == "aaron"
         
     | 
| 
      
 298 
     | 
    
         
            +
               h1["firstname"].should == "john"
         
     | 
| 
      
 299 
     | 
    
         
            +
               hash.length.should == 2
         
     | 
| 
      
 300 
     | 
    
         
            +
             
     | 
| 
      
 301 
     | 
    
         
            +
             options = {:startkey => ["28","male"], :endkey => ["28","male"], :skip => 1}
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
              hash = Couchdb.find_on_fly(view,@@auth_session,key=nil, options)
         
     | 
| 
      
 304 
     | 
    
         
            +
               h0 = hash[0]
         
     | 
| 
      
 305 
     | 
    
         
            +
               h1 = hash[1]
         
     | 
| 
      
 306 
     | 
    
         
            +
               h0["firstname"].should == "john"
         
     | 
| 
      
 307 
     | 
    
         
            +
               h1["firstname"].should == "sam"
         
     | 
| 
      
 308 
     | 
    
         
            +
               hash.length.should == 2
         
     | 
| 
      
 309 
     | 
    
         
            +
             
     | 
| 
      
 310 
     | 
    
         
            +
             
     | 
| 
      
 311 
     | 
    
         
            +
             options = {:startkey => ["28","male"], :endkey => ["28","male"]}
         
     | 
| 
      
 312 
     | 
    
         
            +
             
     | 
| 
      
 313 
     | 
    
         
            +
              hash = Couchdb.find_on_fly(view,@@auth_session,key=nil, options)
         
     | 
| 
      
 314 
     | 
    
         
            +
               h0 = hash[0]
         
     | 
| 
      
 315 
     | 
    
         
            +
               h1 = hash[1]
         
     | 
| 
      
 316 
     | 
    
         
            +
               h0["firstname"].should == "aaron"
         
     | 
| 
      
 317 
     | 
    
         
            +
               h1["firstname"].should == "john"
         
     | 
| 
      
 318 
     | 
    
         
            +
               hash.length.should == 3
         
     | 
| 
      
 319 
     | 
    
         
            +
             
     | 
| 
      
 320 
     | 
    
         
            +
             Couchdb.delete 'fishes',@@auth_session
         
     | 
| 
      
 321 
     | 
    
         
            +
            end
         
     | 
| 
      
 322 
     | 
    
         
            +
             
     | 
| 
       197 
323 
     | 
    
         
             
            #database: administration tasks
         
     | 
| 
       198 
324 
     | 
    
         | 
| 
       199 
325 
     | 
    
         
             
            it "should set a config section, retrieve it and delete it" do
         
     | 
    
        data/test/main.rb
    CHANGED
    
    | 
         @@ -16,10 +16,53 @@ data = {:section => "admins", 
     | 
|
| 
       16 
16 
     | 
    
         
             
            hash = Couchdb.login(username = 'obi',password ='trusted') 
         
     | 
| 
       17 
17 
     | 
    
         
             
            auth_session =  hash["AuthSession"]
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            view = { :database => "monitors", 
         
     | 
| 
      
 21 
     | 
    
         
            +
                      :design_doc => 'tag_finder', 
         
     | 
| 
      
 22 
     | 
    
         
            +
                        :view => 'find_by_tag'}
         
     | 
| 
      
 23 
     | 
    
         
            +
             
         
     | 
| 
      
 24 
     | 
    
         
            +
            #hash = Couchdb.find view,auth_session,key='ralph', options = {:limit => 5, :skip => 1}
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            #hash = Couchdb.find view,auth_session,key='ralph', options = {:limit => 5}
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            #Couchdb.find_by({:database => 'zralph1369728249zeb1292e18b998352', :timestamp => 'Smith'},auth_session)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            #Couchdb.find_by({:database => 'monitors', :test => 'Smith'},auth_session)
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            view = { :database => "zralph1369728249zeb1292e18b998352", 
         
     | 
| 
      
 34 
     | 
    
         
            +
                      :design_doc => 'timestamp_finder', 
         
     | 
| 
      
 35 
     | 
    
         
            +
                        :view => 'find_by_timestamp'}
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            #hash = Couchdb.find view,auth_session,key=nil, options = {:startkey => "100", :endkey => "1369728370"}
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            #hash = Couchdb.find view,auth_session,key="1369728370"
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            #start 2013-05-29 20:22:07 -0400 1369873327 
         
     | 
| 
      
 42 
     | 
    
         
            +
            #end 2013-05-29 20:19:07 -0400 1369873147 
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            view = { :database => "monitors", 
         
     | 
| 
      
 45 
     | 
    
         
            +
                      :design_doc => 'test_finder', 
         
     | 
| 
      
 46 
     | 
    
         
            +
                        :view => 'find_by_test'}
         
     | 
| 
      
 47 
     | 
    
         
            +
            hash = Couchdb.find view,auth_session,key=nil, options = {:startkey => ["1000","UP"], :endkey => ["6000","UP"]}
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            #hash = Couchdb.find view,auth_session,key=nil, options = {:startkey => ["3300","UP"],:descending => true}
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            #hash = Couchdb.find view,auth_session,key=nil, options = {:descending => true}
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            #hash = Couchdb.find view,auth_session,key= {:keys => ['3300','UP']}
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            #hash = Couchdb.find view,auth_session,key= '?keys=%5B%228800%22,%22UP%22%5D'
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            puts hash.inspect
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            ###END OF KEYS TESTING########
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
       19 
62 
     | 
    
         
             
            #user = { :username => "david", :password => "trusted", :roles => []}
         
     | 
| 
       20 
63 
     | 
    
         
             
            #Couchdb.add_user(user, auth_session )
         
     | 
| 
       21 
64 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
            hash = Couchdb.delete 'staff',auth_session
         
     | 
| 
      
 65 
     | 
    
         
            +
            #hash = Couchdb.delete 'staff',auth_session
         
     | 
| 
       23 
66 
     | 
    
         | 
| 
       24 
67 
     | 
    
         
             
            #puts auth_session
         
     | 
| 
       25 
68 
     | 
    
         | 
    
        data/test/start.json
    ADDED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: leanback
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.4
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-06-02 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rest-client
         
     | 
| 
         @@ -149,6 +149,7 @@ files: 
     | 
|
| 
       149 
149 
     | 
    
         
             
            - test/main.rb
         
     | 
| 
       150 
150 
     | 
    
         
             
            - test/my_view.json
         
     | 
| 
       151 
151 
     | 
    
         
             
            - test/my_views.json
         
     | 
| 
      
 152 
     | 
    
         
            +
            - test/start.json
         
     | 
| 
       152 
153 
     | 
    
         
             
            - test/test_leanback.rb
         
     | 
| 
       153 
154 
     | 
    
         
             
            - test/view_age.json
         
     | 
| 
       154 
155 
     | 
    
         
             
            homepage: http://github.com/obi-a/leanback
         
     | 
| 
         @@ -166,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       166 
167 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       167 
168 
     | 
    
         
             
                  segments:
         
     | 
| 
       168 
169 
     | 
    
         
             
                  - 0
         
     | 
| 
       169 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 170 
     | 
    
         
            +
                  hash: 887863200366044810
         
     | 
| 
       170 
171 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       171 
172 
     | 
    
         
             
              none: false
         
     | 
| 
       172 
173 
     | 
    
         
             
              requirements:
         
     |