indextank 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/indextank.rb +1 -1
  2. data/lib/indextank/index.rb +22 -0
  3. metadata +3 -64
data/lib/indextank.rb CHANGED
@@ -5,7 +5,7 @@ directory = File.expand_path(File.dirname(__FILE__))
5
5
  require File.join(directory, 'indextank', 'client')
6
6
 
7
7
  module IndexTank
8
- VERSION = "1.0.7"
8
+ VERSION = "1.0.8"
9
9
 
10
10
  def self.setup_connection(url, &block)
11
11
  @conn = Faraday::Connection.new(:url => url) do |builder|
@@ -56,6 +56,28 @@ module IndexTank
56
56
  refresh.status != 404
57
57
  end
58
58
 
59
+ def batch_insert(documents)
60
+ puts documents.to_json
61
+ resp = @conn.put do |req|
62
+ req.url "docs"
63
+ req.body = documents.to_json
64
+ end
65
+ case resp.status
66
+ when 200
67
+ resp.body
68
+ when 401
69
+ raise InvalidApiKey
70
+ when 409
71
+ raise IndexInitializing
72
+ when 404
73
+ raise NonExistentIndex
74
+ when 400
75
+ raise InvalidArgument, resp.body
76
+ else
77
+ raise UnexpectedHTTPException, resp.body
78
+ end
79
+ end
80
+
59
81
  # the options argument may contain an :index_code definition to override
60
82
  # this instance's default index_code
61
83
  # it can also contain any of the following:
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indextank
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 7
10
- version: 1.0.7
5
+ version: 1.0.8
11
6
  platform: ruby
12
7
  authors:
13
8
  - Santiago Perez
@@ -17,7 +12,7 @@ autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
14
 
20
- date: 2011-01-07 00:00:00 -08:00
15
+ date: 2011-01-07 00:00:00 -03:00
21
16
  default_executable:
22
17
  dependencies:
23
18
  - !ruby/object:Gem::Dependency
@@ -28,11 +23,6 @@ dependencies:
28
23
  requirements:
29
24
  - - ">="
30
25
  - !ruby/object:Gem::Version
31
- hash: 7
32
- segments:
33
- - 1
34
- - 4
35
- - 0
36
26
  version: 1.4.0
37
27
  type: :development
38
28
  version_requirements: *id001
@@ -44,13 +34,6 @@ dependencies:
44
34
  requirements:
45
35
  - - ">="
46
36
  - !ruby/object:Gem::Version
47
- hash: 62196421
48
- segments:
49
- - 2
50
- - 0
51
- - 0
52
- - beta
53
- - 19
54
37
  version: 2.0.0.beta.19
55
38
  type: :development
56
39
  version_requirements: *id002
@@ -62,13 +45,6 @@ dependencies:
62
45
  requirements:
63
46
  - - ">="
64
47
  - !ruby/object:Gem::Version
65
- hash: 62196421
66
- segments:
67
- - 2
68
- - 0
69
- - 0
70
- - beta
71
- - 19
72
48
  version: 2.0.0.beta.19
73
49
  type: :development
74
50
  version_requirements: *id003
@@ -80,11 +56,6 @@ dependencies:
80
56
  requirements:
81
57
  - - ">="
82
58
  - !ruby/object:Gem::Version
83
- hash: 33
84
- segments:
85
- - 0
86
- - 10
87
- - 11
88
59
  version: 0.10.11
89
60
  type: :development
90
61
  version_requirements: *id004
@@ -96,11 +67,6 @@ dependencies:
96
67
  requirements:
97
68
  - - ">="
98
69
  - !ruby/object:Gem::Version
99
- hash: 49
100
- segments:
101
- - 0
102
- - 8
103
- - 7
104
70
  version: 0.8.7
105
71
  type: :development
106
72
  version_requirements: *id005
@@ -112,9 +78,6 @@ dependencies:
112
78
  requirements:
113
79
  - - ">="
114
80
  - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
81
  version: "0"
119
82
  type: :development
120
83
  version_requirements: *id006
@@ -126,11 +89,6 @@ dependencies:
126
89
  requirements:
127
90
  - - ">="
128
91
  - !ruby/object:Gem::Version
129
- hash: 17
130
- segments:
131
- - 0
132
- - 3
133
- - 1
134
92
  version: 0.3.1
135
93
  type: :development
136
94
  version_requirements: *id007
@@ -142,9 +100,6 @@ dependencies:
142
100
  requirements:
143
101
  - - ">="
144
102
  - !ruby/object:Gem::Version
145
- hash: 3
146
- segments:
147
- - 0
148
103
  version: "0"
149
104
  type: :runtime
150
105
  version_requirements: *id008
@@ -156,11 +111,6 @@ dependencies:
156
111
  requirements:
157
112
  - - ">="
158
113
  - !ruby/object:Gem::Version
159
- hash: 13
160
- segments:
161
- - 0
162
- - 7
163
- - 7
164
114
  version: 0.7.7
165
115
  type: :runtime
166
116
  version_requirements: *id009
@@ -172,11 +122,6 @@ dependencies:
172
122
  requirements:
173
123
  - - ">="
174
124
  - !ruby/object:Gem::Version
175
- hash: 11
176
- segments:
177
- - 1
178
- - 4
179
- - 6
180
125
  version: 1.4.6
181
126
  type: :runtime
182
127
  version_requirements: *id010
@@ -217,23 +162,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
162
  requirements:
218
163
  - - ">="
219
164
  - !ruby/object:Gem::Version
220
- hash: 3
221
- segments:
222
- - 0
223
165
  version: "0"
224
166
  required_rubygems_version: !ruby/object:Gem::Requirement
225
167
  none: false
226
168
  requirements:
227
169
  - - ">="
228
170
  - !ruby/object:Gem::Version
229
- hash: 3
230
- segments:
231
- - 0
232
171
  version: "0"
233
172
  requirements: []
234
173
 
235
174
  rubyforge_project: nowarning
236
- rubygems_version: 1.4.1
175
+ rubygems_version: 1.6.1
237
176
  signing_key:
238
177
  specification_version: 3
239
178
  summary: Ruby Client for the IndexTank API