ruby-druid 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWIxYTMwMjQwMWQzNWQyODRkNDJiMTBmMTY1ODhkNzNlYTM1MWNkZA==
5
+ data.tar.gz: !binary |-
6
+ MzZjYWM0MjM2M2NkODcwNTdhNGFkMjZjZjliODFhNGI0MTcwZjYzNQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MDExNjUyM2QwZTFkOWU0NDhmYWIwNWRmMTc0MDQ4OGYzYzg0NmM1NTgzNDc5
10
+ ZjQ5MmRiYjU2ZGUwYzA2OGMzYmU3OTMzMWE1YTIwMjJhM2EwNTYzMWFiYTA0
11
+ YTAwMGU1N2JmZjdlYmRlYjllMjE0NjkzOWRjZTkyYzAyMjlhYWQ=
12
+ data.tar.gz: !binary |-
13
+ MWQ3NjdjZDYzMzM2MzdjYWU0OTc0NGFhYTRiMjNhMDcxMTY4ZmEyZmFlNjg2
14
+ MWViZjgyMGY0OWVjYzNmOTVkMjMwZTg3MTY0ODc3MmIyNTIyMDEzYTA0ZDRk
15
+ MDliMGUzYWI3MWQ0MjQ2ZjU5ZWVkZDM1ZWRmYWY0YjU2YmY2MGM=
@@ -170,8 +170,26 @@ module Druid
170
170
  @properties.to_json
171
171
  end
172
172
 
173
+ def limit_spec(limit, columns)
174
+ @properties[:limitSpec] = {
175
+ :type => :default,
176
+ :limit => limit,
177
+ :columns => order_by_column_spec(columns)
178
+ }
179
+ self
180
+ end
181
+
173
182
  private
174
183
 
184
+ def order_by_column_spec(columns)
185
+ columns.map do |dimension, direction|
186
+ {
187
+ :dimension => dimension,
188
+ :direction => direction
189
+ }
190
+ end
191
+ end
192
+
175
193
  def mk_interval(from, to)
176
194
  from = today + from if from.is_a?(Fixnum)
177
195
  to = today + to if to.is_a?(Fixnum)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "ruby-druid"
5
- spec.version = "0.1.6"
5
+ spec.version = "0.1.7"
6
6
  spec.authors = ["LiquidM, Inc."]
7
7
  spec.email = ["opensource@liquidm.com"]
8
8
  spec.summary = %q{Ruby client for metamx druid}
@@ -418,4 +418,16 @@ end
418
418
  }
419
419
  end
420
420
 
421
+ it 'takes type, limit and columns from limit method' do
422
+ @query.limit_spec(10, :a => 'ASCENDING', :b => 'DESCENDING')
423
+ result = JSON.parse(@query.to_json)
424
+ result['limitSpec'].should == {
425
+ 'type' => 'default',
426
+ 'limit' => 10,
427
+ 'columns' => [
428
+ { 'dimension' => 'a', 'direction' => 'ASCENDING'},
429
+ { 'dimension' => 'b', 'direction' => 'DESCENDING'}
430
+ ]
431
+ }
432
+ end
421
433
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-druid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
5
- prerelease:
4
+ version: 0.1.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - LiquidM, Inc.
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-06-06 00:00:00.000000000 Z
11
+ date: 2014-08-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: zk
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rest-client
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -76,33 +71,26 @@ files:
76
71
  homepage: https://github.com/liquidm/ruby-druid
77
72
  licenses:
78
73
  - MIT
74
+ metadata: {}
79
75
  post_install_message:
80
76
  rdoc_options: []
81
77
  require_paths:
82
78
  - lib
83
79
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
80
  requirements:
86
81
  - - ! '>='
87
82
  - !ruby/object:Gem::Version
88
83
  version: '0'
89
- segments:
90
- - 0
91
- hash: -3649172061711800760
92
84
  required_rubygems_version: !ruby/object:Gem::Requirement
93
- none: false
94
85
  requirements:
95
86
  - - ! '>='
96
87
  - !ruby/object:Gem::Version
97
88
  version: '0'
98
- segments:
99
- - 0
100
- hash: -3649172061711800760
101
89
  requirements: []
102
90
  rubyforge_project:
103
- rubygems_version: 1.8.25
91
+ rubygems_version: 2.0.5
104
92
  signing_key:
105
- specification_version: 3
93
+ specification_version: 4
106
94
  summary: Ruby client for metamx druid
107
95
  test_files:
108
96
  - spec/lib/client_spec.rb