tickethub 0.3.57 → 0.3.58
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 +4 -4
- data/lib/tickethub/aggregate.rb +35 -0
- data/lib/tickethub/collection.rb +5 -0
- data/lib/tickethub/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94c7871d5fcda272bafd53c70b2c414f5eea12bb
|
4
|
+
data.tar.gz: 7c84a68c15ab1c6ec8dcb4e5ade9170268f04742
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baed47e8af035b3be817962422543cb41b42bc86d8e39b9a99a7553b17a8c6fe1684374aa4bd8c089ac4c6aa2aa30ba94b05f6aed8c9e660b1cb24279da955b3
|
7
|
+
data.tar.gz: 1ca5e53bf54b548cb786670d946e0a16358f0404efe004997f541a4064d78d9aef0ee249ed894c4400b042b90ad35deaafe21eb17583c3f7dbc935bc8781d403
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Tickethub
|
2
|
+
class Aggregate
|
3
|
+
|
4
|
+
def initialize(collection, group = [])
|
5
|
+
@group = Array group.dup
|
6
|
+
@collection = collection
|
7
|
+
end
|
8
|
+
|
9
|
+
def minimum(field)
|
10
|
+
@collection.get aggregate: { field: field, group: @group, operation: 'minimum' }
|
11
|
+
end
|
12
|
+
|
13
|
+
alias_method :min, :minimum
|
14
|
+
|
15
|
+
def maximum(field)
|
16
|
+
@collection.get aggregate: { field: field, group: @group, operation: 'maximum' }
|
17
|
+
end
|
18
|
+
|
19
|
+
alias_method :max, :maximum
|
20
|
+
|
21
|
+
def average(field)
|
22
|
+
@collection.get aggregate: { field: field, group: @group, operation: 'average' }
|
23
|
+
end
|
24
|
+
|
25
|
+
alias_method :avg, :average
|
26
|
+
|
27
|
+
def sum(field)
|
28
|
+
@collection.get aggregate: { field: field, group: @group, operation: 'sum' }
|
29
|
+
end
|
30
|
+
|
31
|
+
def count(column = :all)
|
32
|
+
@collection.get aggregate: { field: field, group: @group, operation: 'count' }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/tickethub/collection.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'cgi'
|
2
2
|
require_relative 'helpers'
|
3
|
+
require_relative 'aggregate'
|
3
4
|
|
4
5
|
module Tickethub
|
5
6
|
class Collection < Enumerator
|
@@ -149,6 +150,10 @@ module Tickethub
|
|
149
150
|
end
|
150
151
|
end
|
151
152
|
|
153
|
+
def aggregate(*group)
|
154
|
+
Tickethub::Aggregate.new self, group
|
155
|
+
end
|
156
|
+
|
152
157
|
def create(attributes = {})
|
153
158
|
@klass.call endpoint, post(attributes), @options
|
154
159
|
rescue Tickethub::ResourceInvalid => err
|
data/lib/tickethub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tickethub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.58
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- Gemfile
|
92
92
|
- lib/tickethub.rb
|
93
93
|
- lib/tickethub/address.rb
|
94
|
+
- lib/tickethub/aggregate.rb
|
94
95
|
- lib/tickethub/app.rb
|
95
96
|
- lib/tickethub/app/category.rb
|
96
97
|
- lib/tickethub/app/subscription.rb
|