motion-firebase 3.0.1 → 3.0.2
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/README.md +15 -4
- data/lib/firebase/firebase.rb +10 -2
- data/lib/firebase/firebase_auth.rb +1 -1
- data/lib/firebase/version.rb +1 -1
- 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: 066ba16ed6cbd362da36f99fd21f67d612448e4a
|
4
|
+
data.tar.gz: 081d92fe4423446906f32ada90afb492dc712466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 760c222fa74c30b5ce626295fde2557e824d2202ca1b578e8f384e198fc2d58447e0524ef2385f6eff40854662dfcb8cfb72f6394b99eaedc2838c0ff46f59e1
|
7
|
+
data.tar.gz: 7be9163a2d8d3c5dedb2d26877bdc7275bbcecdd13155df19b79ef103898273f386bfcf997f5a3ba5c8eaca954b4ceac98e59c7c9a9ceb04166e0c496c7ebd77
|
data/README.md
CHANGED
@@ -107,9 +107,15 @@ handle = firebase.on(event_type,
|
|
107
107
|
completion: proc { |snapshot, previous_sibling_name| 'completion block' },
|
108
108
|
disconnect: proc { 'completion block' }
|
109
109
|
)
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
```
|
111
|
+
|
112
|
+
Sometimes you just need one to get an update, use `once` if you don't want to
|
113
|
+
subscribe to a stream of changes.
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
firebase.once(event_type) { |snapshot| 'completion block' }
|
117
|
+
firebase.once(event_type) { |snapshot, previous_sibling_name| 'completion block' }
|
118
|
+
firebase.once(event_type,
|
113
119
|
completion: proc { |snapshot, previous_sibling_name| 'completion block' },
|
114
120
|
disconnect: proc { 'completion block' }
|
115
121
|
)
|
@@ -177,8 +183,13 @@ firebase.on_disconnect(value) # set the ref to `value` when disconnected
|
|
177
183
|
firebase.on_disconnect(value) { |error| 'completion block' }
|
178
184
|
firebase.on_disconnect(value, priority: priority)
|
179
185
|
firebase.on_disconnect(value, priority: priority) { |error| 'completion block' }
|
186
|
+
|
187
|
+
# this removes the value on disconnect
|
188
|
+
firebase.remove_on_disconnect
|
189
|
+
# which is the same as, but not as obvious:
|
180
190
|
firebase.on_disconnect(nil)
|
181
|
-
firebase.
|
191
|
+
firebase.remove_on_disconnect { |error| 'completion block' }
|
192
|
+
|
182
193
|
firebase.on_disconnect({ child: values })
|
183
194
|
firebase.on_disconnect({ child: values }) { |error| 'completion block' }
|
184
195
|
|
data/lib/firebase/firebase.rb
CHANGED
@@ -35,8 +35,12 @@ class Firebase
|
|
35
35
|
|
36
36
|
# should we support `Firebase.url = 'myapp/path/to/child/'` ? I'm gonna say
|
37
37
|
# NO for now...
|
38
|
-
unless url.include?('.firebaseio.com')
|
39
|
-
|
38
|
+
unless url.include?('.firebaseio.com/')
|
39
|
+
after_scheme = url.index('//') + 2
|
40
|
+
if url[after_scheme..-1].include?('/')
|
41
|
+
raise "Invalid URL #{url.inspect} in #{__method__}: URL does not include 'firebaseio.com'"
|
42
|
+
end
|
43
|
+
url = "#{url}.firebaseio.com/"
|
40
44
|
end
|
41
45
|
|
42
46
|
@url = url
|
@@ -214,6 +218,10 @@ class Firebase
|
|
214
218
|
return self
|
215
219
|
end
|
216
220
|
|
221
|
+
def remove_on_disconnect(&and_then)
|
222
|
+
on_disconnect(nil, &and_then)
|
223
|
+
end
|
224
|
+
|
217
225
|
def on_disconnect(value, &and_then)
|
218
226
|
if block_given?
|
219
227
|
if value.nil?
|
@@ -21,7 +21,7 @@ class Firebase
|
|
21
21
|
def authenticate(token, options={}, &and_then)
|
22
22
|
and_then ||= options[:completion]
|
23
23
|
disconnect_block = options[:disconnect]
|
24
|
-
if
|
24
|
+
if disconnect_block || and_then.arity < 2
|
25
25
|
NSLog('Warning! The Firebase authWithCredential method is deprecated.')
|
26
26
|
NSLog('Instead of using a completion and cancel block, pass one block:')
|
27
27
|
NSLog('fb.auth(token) do |error, auth_data| .. end')
|
data/lib/firebase/version.rb
CHANGED
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.0.2
|
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-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|