Class: Orchestrate::Search::TimeSeriesBuilder
- Inherits:
-
Object
- Object
- Orchestrate::Search::TimeSeriesBuilder
- Includes:
- AggregateBuilderDelegator, QueryBuilderDelegator
- Defined in:
- lib/orchestrate/search/aggregate_builder.rb
Overview
Time Series Builder object for constructing time series functions for the aggregate param
Instance Attribute Summary collapse
- #builder ⇒ AggregateBuilder readonly
-
#field_name ⇒ #to_s
readonly
The field to operate over.
-
#interval ⇒ #to_s
readonly
The interval of time for the TimeSeries function.
Instance Method Summary collapse
-
#day ⇒ AggregateBuilder
Set time series interval to day.
-
#hour ⇒ AggregateBuilder
Set time series interval to hour.
-
#initialize(builder, field_name) ⇒ TimeSeriesBuilder
constructor
Initialize a new TimeSeriesBuilder object.
-
#month ⇒ AggregateBuilder
Set time series interval to month.
-
#quarter ⇒ AggregateBuilder
Set time series interval to quarter.
-
#time_zone(zone) ⇒ RangeBuilder
Use the designated time zone (e.g., "-0500" or "+0430") when calculating bucket boundaries.
-
#to_param ⇒ #to_s
Constructed aggregate string clause.
-
#to_s ⇒ Object
(also: #inspect)
Pretty-Printed string representation of the TimeSeriesBuilder object.
-
#week ⇒ AggregateBuilder
Set time series interval to week.
-
#year ⇒ AggregateBuilder
Set time series interval to year.
Constructor Details
#initialize(builder, field_name) ⇒ TimeSeriesBuilder
Initialize a new TimeSeriesBuilder object
250 251 252 253 254 255 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 250 def initialize(builder, field_name) @builder = builder @field_name = field_name @interval = nil @time_zone = nil end |
Instance Attribute Details
#builder ⇒ AggregateBuilder (readonly)
239 240 241 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 239 def builder @builder end |
#field_name ⇒ #to_s (readonly)
Returns The field to operate over.
242 243 244 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 242 def field_name @field_name end |
#interval ⇒ #to_s (readonly)
Returns The interval of time for the TimeSeries function.
245 246 247 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 245 def interval @interval end |
Instance Method Details
#day ⇒ AggregateBuilder
Set time series interval to day
302 303 304 305 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 302 def day @interval = 'day' self end |
#hour ⇒ AggregateBuilder
Set time series interval to hour
309 310 311 312 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 309 def hour @interval = 'hour' self end |
#month ⇒ AggregateBuilder
Set time series interval to month
288 289 290 291 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 288 def month @interval = 'month' self end |
#quarter ⇒ AggregateBuilder
Set time series interval to quarter
281 282 283 284 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 281 def quarter @interval = 'quarter' self end |
#time_zone(zone) ⇒ RangeBuilder
Use the designated time zone (e.g., "-0500" or "+0430") when calculating bucket boundaries
317 318 319 320 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 317 def time_zone(zone) @time_zone = zone self end |
#to_param ⇒ #to_s
Returns constructed aggregate string clause.
264 265 266 267 268 269 270 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 264 def to_param if @time_zone.nil? "#{field_name}:time_series:#{interval}" else "#{field_name}:time_series:#{interval}:#{@time_zone}" end end |
#to_s ⇒ Object Also known as: inspect
Returns Pretty-Printed string representation of the TimeSeriesBuilder object.
258 259 260 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 258 def to_s "#<Orchestrate::Search::TimeSeriesBuilder collection=#{collection.name} field_name=#{field_name} interval=#{interval} time_zone=#{@time_zone}>" end |
#week ⇒ AggregateBuilder
Set time series interval to week
295 296 297 298 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 295 def week @interval = 'week' self end |
#year ⇒ AggregateBuilder
Set time series interval to year
274 275 276 277 |
# File 'lib/orchestrate/search/aggregate_builder.rb', line 274 def year @interval = 'year' self end |