orchestrate 0.11.0 → 0.11.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 052b46ffb077d9256c3626b2d2fe1d6618c0f3c9
4
- data.tar.gz: 34375247e7fc3ce08d2f836df6e0df7f778273f7
3
+ metadata.gz: 4d0d0f4b8f59826a8f9dbba17f58a94d74a56051
4
+ data.tar.gz: 43ad3fb8c92dddd44e4f4757b94b57c48a142f06
5
5
  SHA512:
6
- metadata.gz: 99d0edff2baf770cf3c2173c9245bb42957dee1a92c1d4abca2c24bc8b510569bf6bda09159c2761bbd64d9631cdfd1d2273166597dccb11a12f85c1a110fb3d
7
- data.tar.gz: 6afa7091564272f7f22d0b4d173b03cd76815a63992876aaccadd3b1c08ab11a38a6c20e884e2feafcf8e339651f0bf0b623339927de6a7e6b1e8c5fd27f39a3
6
+ metadata.gz: 7e114a8889c720f8cb505c39fa32e5526f7ad8e47f60cb6acbacd9175e963692c1d2f19cf07388c5482d2098e67e6a44d21b0fc78afe8adb18e22b1d1e342b03
7
+ data.tar.gz: bd4bb4b0a7720b99a906247f6e8eb7d8ec1dfd7516cc7996418e6a09912f0ab435c9e66f6a683967f0ee0b9f553142f6fd8b028876c3ce83e9c50f50b5090960
data/README.md CHANGED
@@ -127,6 +127,7 @@ cafes.near(:location, 12, 19, 4, 'mi').aggregate # Start the near search query
127
127
  # Accepted intervals are: year, quarter, month, week, day, and hour
128
128
  comments.search("*").aggregate # Start the near search query and aggregate param builder
129
129
  .time_series("posted", "day") # get count of comments posted by day
130
+ .time_zone("+1100") # set a specific time zone
130
131
  .find # return SearchResults object to execute our query
131
132
  .each_aggregate # return enumerator for iterating over each aggregate result
132
133
 
@@ -279,6 +280,21 @@ response = client.search(:comments, query, options)
279
280
  response.aggregates # return aggregate results
280
281
 
281
282
 
283
+ # Time-Series Aggregate with Time Zone
284
+
285
+ options = {
286
+ # get count of comments posted by day
287
+ aggregate: "value.posted:time_series:day:+1100"
288
+ }
289
+
290
+ query = "*"
291
+
292
+ response = client.search(:comments, query, options)
293
+
294
+ response.aggregates # return aggregate results
295
+
296
+
297
+
282
298
  # Multiple Aggregate Functions
283
299
  options = {
284
300
  # multiple aggregate params are separated by commas
@@ -396,7 +412,10 @@ end
396
412
 
397
413
  ## Release Notes
398
414
 
399
- ### January 7, 2014: release 0.11.0
415
+ ### February 17, 2015: release 0.11.1
416
+ - Implement `Search::TimeSeriesBuilder#time_zone` to designate time zone when calculating time series bucket boundaries.
417
+
418
+ ### January 7, 2015: release 0.11.0
400
419
  - **BACKWARDS-INCOMPATIBLE** `Orchestrate::Collection` searches require `#find` method at the end of the method call/chain. Example: `users.search('foo').find`.
401
420
  - Implement `Orchestrate::Search` module, refactor functionality of prior `Orchestrate::Collection::SearchResults`.
402
421
  - Implement results enumeration & request firing functionality in prior `Orchestrate::Collection::SearchResults` to `Orchestrate::Search::Results`
@@ -474,4 +493,4 @@ end
474
493
  ### May 21, 2014: release 0.5.0
475
494
  Initial Port from @jimcar
476
495
  - Uses Faraday HTTP Library as backend, with examples of alternate adapters
477
- - Cleanup client method signatures
496
+ - Cleanup client method signatures
@@ -220,6 +220,7 @@ module Orchestrate::Search
220
220
  @builder = builder
221
221
  @field_name = field_name
222
222
  @interval = nil
223
+ @time_zone = nil
223
224
  end
224
225
 
225
226
  def_delegator :@builder, :options
@@ -236,13 +237,17 @@ module Orchestrate::Search
236
237
 
237
238
  # @return Pretty-Printed string representation of the TimeSeriesBuilder object
238
239
  def to_s
239
- "#<Orchestrate::Search::TimeSeriesBuilder collection=#{collection.name} field_name=#{field_name} interval=#{interval}>"
240
+ "#<Orchestrate::Search::TimeSeriesBuilder collection=#{collection.name} field_name=#{field_name} interval=#{interval} time_zone=#{@time_zone}>"
240
241
  end
241
242
  alias :inspect :to_s
242
243
 
243
244
  # @return [#to_s] constructed aggregate string clause
244
245
  def to_param
245
- "#{field_name}:time_series:#{interval}"
246
+ if @time_zone.nil?
247
+ "#{field_name}:time_series:#{interval}"
248
+ else
249
+ "#{field_name}:time_series:#{interval}:#{@time_zone}"
250
+ end
246
251
  end
247
252
 
248
253
  # Set time series interval to year
@@ -286,5 +291,13 @@ module Orchestrate::Search
286
291
  @interval = 'hour'
287
292
  self
288
293
  end
294
+
295
+ # Use the designated time zone (e.g., "-0500" or "+0430") when calculating bucket boundaries
296
+ # @param zone [String]
297
+ # @return [RangeBuilder]
298
+ def time_zone(zone)
299
+ @time_zone = zone
300
+ self
301
+ end
289
302
  end
290
303
  end
@@ -1,4 +1,4 @@
1
1
  module Orchestrate
2
2
  # @return [String] The version number of the Orchestrate Gem
3
- VERSION = "0.11.0"
3
+ VERSION = "0.11.1"
4
4
  end
@@ -49,6 +49,17 @@ class CollectionAggregates < MiniTest::Unit::TestCase
49
49
  "count" => 17
50
50
  }]
51
51
  }]
52
+ @time_series_with_time_zone = [{
53
+ "aggregate_kind" => "time_series",
54
+ "field_name" => "value.bar",
55
+ "interval" => "day",
56
+ "time_zone" => "+1100",
57
+ "value_count" => 100,
58
+ "buckets" => [{
59
+ "bucket" => "2014-11-01",
60
+ "count" => 17
61
+ }]
62
+ }]
52
63
  @limit = 100
53
64
  @total = 110
54
65
 
@@ -67,6 +78,9 @@ class CollectionAggregates < MiniTest::Unit::TestCase
67
78
  when 'bar:time_series:day'
68
79
  { "results" => 100.times.map{|i| @make_listing.call(i)}, "count" => 100, "total_count" => @total,
69
80
  "aggregates" => @time_series }
81
+ when 'bar:time_series:day:+1100'
82
+ { "results" => 100.times.map{|i| @make_listing.call(i)}, "count" => 100, "total_count" => @total,
83
+ "aggregates" => @time_series_with_time_zone }
70
84
  else
71
85
  raise ArgumentError.new("unexpected aggregate: #{aggregate}")
72
86
  end
@@ -107,6 +121,12 @@ class CollectionAggregates < MiniTest::Unit::TestCase
107
121
  assert_equal @time_series, results.aggregates
108
122
  end
109
123
 
124
+ def test_basic_time_series_aggregate_with_time_zone
125
+ results = @items.search("foo").aggregate.time_series("bar").day.time_zone("+1100").find
126
+ results.each_aggregate
127
+ assert_equal @time_series_with_time_zone, results.aggregates
128
+ end
129
+
110
130
  def test_each_aggregate_enum
111
131
  results = @items.search("foo").aggregate.time_series("bar").day.find
112
132
  enum = results.each_aggregate
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orchestrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Lyon
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-01-08 00:00:00.000000000 Z
14
+ date: 2015-02-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday