armchair 0.0.1 → 0.0.2

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/Rakefile CHANGED
@@ -5,7 +5,7 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "armchair"
8
- gem.version = '0.0.1'
8
+ gem.version = '0.0.2'
9
9
  gem.summary = %Q{Minimal CouchDB interface}
10
10
  gem.description = %Q{A minimal CouchDB interface that can do nothing but add documents and iterate over documents.}
11
11
  gem.email = "danishkirel@gmail.com"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{armchair}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Kirsch"]
@@ -10,7 +10,7 @@ class Armchair
10
10
  # couch = Armchair.new 'http://127.0.0.1:5984/mycouch'
11
11
  #
12
12
  def initialize dburl, batch_size = 100
13
- @dburl = dburl
13
+ @dburl = dburl.gsub(/\/$/,'')
14
14
  @batch_size = batch_size
15
15
  end
16
16
 
@@ -37,7 +37,7 @@ class Armchair
37
37
 
38
38
  # Returns the size of the Armchair (the number of documents stored).
39
39
  def size
40
- RestClient.get(@dburl + '_all_docs?limit=0', :accept => :json) do |r|
40
+ RestClient.get(@dburl + '/_all_docs?limit=0', :accept => :json) do |r|
41
41
  case r.code
42
42
  when 200
43
43
  JSON(r.body)['total_rows']
@@ -51,7 +51,7 @@ class Armchair
51
51
  def each
52
52
  # iterate in batches of @batch_size
53
53
  # initial query
54
- res = RestClient.get(@dburl + "_all_docs?limit=#{@batch_size+1}&include_docs=true", :accept => :json) do |r|
54
+ res = RestClient.get(@dburl + "/_all_docs?limit=#{@batch_size+1}&include_docs=true", :accept => :json) do |r|
55
55
  case r.code
56
56
  when 200
57
57
  JSON(r.body)
@@ -65,7 +65,7 @@ class Armchair
65
65
  # subsequent queries
66
66
  while last
67
67
  startkey = last['key']
68
- res = RestClient.get(@dburl+"_all_docs?startkey=%22#{startkey}%22&limit=#{@batch_size+1}&include_docs=true", :accept => :json) do |r|
68
+ res = RestClient.get(@dburl + "/_all_docs?startkey=%22#{startkey}%22&limit=#{@batch_size+1}&include_docs=true", :accept => :json) do |r|
69
69
  case r.code
70
70
  when 200
71
71
  JSON(r.body)
@@ -5,7 +5,7 @@ require 'armchair'
5
5
  describe Armchair do
6
6
 
7
7
  before(:each) do
8
- @dburl = 'http://localhost:5984/test_armchair/'
8
+ @dburl = 'http://localhost:5984/test_armchair'
9
9
  @couch = Armchair.new @dburl
10
10
  @doc = {'some' => 'doc'}
11
11
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Kirsch