motion-firebase 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 303f35180c398371debc1fe2654063090bf09d30
4
- data.tar.gz: d6ccacf82662b9152576f3a933816a11eaf67652
3
+ metadata.gz: 066ba16ed6cbd362da36f99fd21f67d612448e4a
4
+ data.tar.gz: 081d92fe4423446906f32ada90afb492dc712466
5
5
  SHA512:
6
- metadata.gz: c646b5369d682a9a55f497e111d155def0d32aceb2d92b1dc8efb93a4e647dbe727ebc5126250caf1dde239cdad18d8fba0cd923fad7dea3d72242c32f1e9b5a
7
- data.tar.gz: 0e3b0ef6c29515c7f9aa7062fcd186340e5c78660e8fd62aae2a7228cf44b059f1d865b7e8dc10208b70f7a8f7e142c546489a7731debb12dcef5cd66c7003c2
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
- handle = firebase.once(event_type) { |snapshot| 'completion block' }
111
- handle = firebase.once(event_type) { |snapshot, previous_sibling_name| 'completion block' }
112
- handle = firebase.once(event_type,
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.on_disconnect(nil) { |error| 'completion block' }
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
 
@@ -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
- url = "#{url}.firebaseio.com"
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 disconnect || and_then.arity < 2
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')
@@ -1,6 +1,6 @@
1
1
  module Motion
2
2
  module Firebase
3
- Version = '3.0.1' # motion-firebase gem version
3
+ Version = '3.0.2' # motion-firebase gem version
4
4
  SdkVersion = '1.2.2' # firebase framework version
5
5
  end
6
6
  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.1
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-09 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec