motion-firebase 3.0.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -0
- data/lib/firebase/fquery.rb +49 -0
- data/lib/firebase/version.rb +1 -1
- data/lib/motion-firebase-auth.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7013544f3915514408c9cd0e5d26b30430a8d627
|
4
|
+
data.tar.gz: 1c07a8bf3388e49d5d592fc2490e5bf7f6e76aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b93a6c8dffc7ba0b852bb2dcd9e57e0bf5a7d5c34ff4f6892b7c6538215f5dd3c81f1bf960bae10846e9a7f8bd025d36172049144dd4378ae0160ff9bad7818e
|
7
|
+
data.tar.gz: c49f30050e8f6c0c91f88c8d13fb5c096c3102b62d9cd1757ced67cfedb63092ba1eeb5e4ca6b7f52b7a2fa54e5acfa1025be2636c47cfde7029372d3effb58d
|
data/README.md
CHANGED
@@ -157,6 +157,52 @@ firebase.limit(limit)
|
|
157
157
|
# => firebase.queryLimitedToNumberOfChildren(limit)
|
158
158
|
```
|
159
159
|
|
160
|
+
##### Querying
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
firebase.query(order_by_key: true)
|
164
|
+
# => firebase.queryOrderedByKey
|
165
|
+
|
166
|
+
firebase.query(order_by_priority: true)
|
167
|
+
# => firebase.queryOrderedByPriority
|
168
|
+
|
169
|
+
firebase.query(order_by: 'key')
|
170
|
+
# => firebase.queryOrderedByChild('key')
|
171
|
+
|
172
|
+
firebase.query(first: value)
|
173
|
+
# => firebase.queryLimitedToFirst(value)
|
174
|
+
|
175
|
+
firebase.query(last: value)
|
176
|
+
# => firebase.queryLimitedToLast(value)
|
177
|
+
|
178
|
+
firebase.query(starting_at: value)
|
179
|
+
firebase.query(starting_at: value, child: 'key')
|
180
|
+
# => firebase.queryStartingAtValue(value)
|
181
|
+
# => firebase.queryStartingAtValue(value, childKey: 'key')
|
182
|
+
|
183
|
+
firebase.query(ending_at: value)
|
184
|
+
firebase.query(ending_at: value, child: 'key')
|
185
|
+
# => firebase.queryEndingAtValue(value)
|
186
|
+
# => firebase.queryEndingAtValue(value, childKey: 'key')
|
187
|
+
|
188
|
+
firebase.query(equal_to: value)
|
189
|
+
firebase.query(equal_to: value, child: 'key')
|
190
|
+
# => firebase.queryEqualToValue(value)
|
191
|
+
# => firebase.queryEqualToValue(value, childKey: 'key')
|
192
|
+
|
193
|
+
# and of course these can all be combined into one call:
|
194
|
+
firebase.query(
|
195
|
+
first: 5, # last: 6,
|
196
|
+
starting_at: 'foo',
|
197
|
+
ending_at: 'bar')
|
198
|
+
|
199
|
+
# => firebase.queryLimitedToFirst(5)
|
200
|
+
# .queryLimitedToLast(6)
|
201
|
+
# .queryStartingAtValue('foo')
|
202
|
+
# .queryEndingAtValue('bar')
|
203
|
+
|
204
|
+
```
|
205
|
+
|
160
206
|
##### Managing presence
|
161
207
|
|
162
208
|
SOO COOL! Play with these, you can *easily* create a presence system for your
|
data/lib/firebase/fquery.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
class FQuery
|
2
2
|
|
3
|
+
# previously the 'key' method was called 'name'
|
4
|
+
def name
|
5
|
+
self.key
|
6
|
+
end
|
7
|
+
|
3
8
|
def on(event_type, options={}, &and_then)
|
4
9
|
and_then = and_then || options[:completion]
|
5
10
|
raise "event handler is required" unless and_then
|
@@ -88,4 +93,48 @@ class FQuery
|
|
88
93
|
queryLimitedToNumberOfChildren(limit)
|
89
94
|
end
|
90
95
|
|
96
|
+
def query(options={})
|
97
|
+
fb_query = self
|
98
|
+
|
99
|
+
if options[:order_by_key]
|
100
|
+
fb_query = fb_query.queryOrderedByKey
|
101
|
+
end
|
102
|
+
|
103
|
+
if options[:order_by_priority]
|
104
|
+
fb_query = fb_query.queryOrderedByPriority
|
105
|
+
end
|
106
|
+
|
107
|
+
if options[:order_by]
|
108
|
+
fb_query = fb_query.queryOrderedByChild(options[:order_by])
|
109
|
+
end
|
110
|
+
|
111
|
+
if options[:first]
|
112
|
+
fb_query = fb_query.queryLimitedToFirst(options[:first])
|
113
|
+
end
|
114
|
+
|
115
|
+
if options[:last]
|
116
|
+
fb_query = fb_query.queryLimitedToLast(options[:last])
|
117
|
+
end
|
118
|
+
|
119
|
+
if options[:starting_at] && options[:key]
|
120
|
+
fb_query = fb_query.queryStartingAtValue(options[:starting_at], childKey: options[:key])
|
121
|
+
elsif options[:starting_at]
|
122
|
+
fb_query = fb_query.queryStartingAtValue(options[:starting_at])
|
123
|
+
end
|
124
|
+
|
125
|
+
if options[:ending_at] && options[:key]
|
126
|
+
fb_query = fb_query.queryEndingAtValue(options[:ending_at], childKey: options[:key])
|
127
|
+
elsif options[:ending_at]
|
128
|
+
fb_query = fb_query.queryEndingAtValue(options[:ending_at])
|
129
|
+
end
|
130
|
+
|
131
|
+
if options[:equal_to] && options[:key]
|
132
|
+
fb_query = fb_query.queryEqualToValue(options[:equal_to], childKey: options[:key])
|
133
|
+
elsif options[:equal_to]
|
134
|
+
fb_query = fb_query.queryEqualToValue(options[:equal_to])
|
135
|
+
end
|
136
|
+
|
137
|
+
fb_query
|
138
|
+
end
|
139
|
+
|
91
140
|
end
|
data/lib/firebase/version.rb
CHANGED
data/lib/motion-firebase-auth.rb
CHANGED
@@ -4,7 +4,7 @@ end
|
|
4
4
|
|
5
5
|
|
6
6
|
Motion::Project::App.setup do |app|
|
7
|
-
app.
|
8
|
-
app.
|
9
|
-
app.
|
7
|
+
app.warn 'Firebase', 'As of version 1.2.2 of Firebase (motion-firebase version 3.0.0), you no'
|
8
|
+
app.warn '', 'longer need to include motion-firebase-auth, because FirebaseSimpleLogin'
|
9
|
+
app.warn '', 'is part of the core Firebase SDK.'
|
10
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-firebase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|