glass-rails 1.0.4 → 1.0.5
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a740d70335aad3f64c715122c72881360bc8bbfc
|
4
|
+
data.tar.gz: 0148e1df2284ed65cc3043d83670156465e1c85c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79e7d4da1ee906570c6ff3908f933c52e6bd976ed85636b9b2d202322ab4d5d954de719ffb129135510a0292cfbd9374d621c859fb2f8d8765b7ccb991983f0c
|
7
|
+
data.tar.gz: 1286d9ac8eb2acc8cb636d282a64fa46c9cf23d29c7dfb7389a6d286e15a984e7d2b67cac071d7762327be3ccedc2154fdd007b766ec50e7a1458caae74d47e7
|
@@ -19,6 +19,9 @@ class GoogleAccount < ActiveRecord::Base
|
|
19
19
|
def subscribe_to_google_notifications
|
20
20
|
subscription = Glass::Subscription.new google_account: self
|
21
21
|
subscription.insert
|
22
|
+
end
|
23
|
+
def update_location(location)
|
24
|
+
|
22
25
|
end
|
23
26
|
def list
|
24
27
|
Glass::Client.new(google_account: self).list
|
@@ -30,4 +33,4 @@ class GoogleAccount < ActiveRecord::Base
|
|
30
33
|
def generate_verification_secret
|
31
34
|
self.verification_secret = SecureRandom.urlsafe_base64
|
32
35
|
end
|
33
|
-
end
|
36
|
+
end
|
data/lib/glass/client.rb
CHANGED
@@ -58,6 +58,16 @@ module Glass
|
|
58
58
|
self
|
59
59
|
end
|
60
60
|
|
61
|
+
def get_location(id='latest')
|
62
|
+
response_hash(self.google_client.execute(get_location_parameters(id)).response)
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_location_parameters(id)
|
66
|
+
{ api_method: self.mirror_api.locations.get,
|
67
|
+
parameters: { "id" => id}
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
61
71
|
def json_content(options, api_method="insert")
|
62
72
|
if c = options[:content]
|
63
73
|
data = c.is_a?(String) ? {text: c} : c
|
@@ -213,4 +223,4 @@ module Glass
|
|
213
223
|
self.api_keys = ::Glass._api_keys
|
214
224
|
end
|
215
225
|
end
|
216
|
-
end
|
226
|
+
end
|
data/lib/glass/rails/version.rb
CHANGED
@@ -27,9 +27,7 @@ module Glass
|
|
27
27
|
## Perform the corresponding notification actions
|
28
28
|
def handle!
|
29
29
|
if collection == "locations"
|
30
|
-
|
31
|
-
# When your Glassware receives a location update, send a request to the glass.locations.get endpoint to retrieve the latest known location.
|
32
|
-
# Something like: google_account.handle_location_update
|
30
|
+
handle_location
|
33
31
|
else
|
34
32
|
self.glass_item_id = params[:itemId]
|
35
33
|
handle_reply(params)
|
@@ -38,6 +36,11 @@ module Glass
|
|
38
36
|
end
|
39
37
|
|
40
38
|
private
|
39
|
+
def handle_location
|
40
|
+
google_client = ::Glass::Client.new(google_account: self.google_account)
|
41
|
+
google_account.update_location(google_client.get_location)
|
42
|
+
end
|
43
|
+
|
41
44
|
def handle_reply(params)
|
42
45
|
return unless has_user_action? :reply
|
43
46
|
google_client = ::Glass::Client.new(google_account: self.google_account)
|
@@ -80,4 +83,4 @@ module Glass
|
|
80
83
|
end
|
81
84
|
end
|
82
85
|
end
|
83
|
-
end
|
86
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glass-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kunal Modi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|