mojodna-fire-hydrant 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +70 -14
- data/examples/fire_eagle_consumer.rb +1 -0
- data/fire-hydrant.gemspec +1 -1
- data/lib/fire_hydrant/fire_hydrant.rb +1 -1
- metadata +1 -1
data/README.markdown
CHANGED
@@ -8,7 +8,11 @@ Eagle](http://fireeagle.yahoo.net/ "Fire Eagle")'s XMPP
|
|
8
8
|
|
9
9
|
Install it:
|
10
10
|
|
11
|
-
$ sudo gem install mojodna-fire-hydrant-s http://gems.github.com
|
11
|
+
$ sudo gem install mojodna-fire-hydrant -s http://gems.github.com
|
12
|
+
|
13
|
+
Clone it (to play with):
|
14
|
+
|
15
|
+
$ git clone git://github.com/mojodna/fire-hydrant.git
|
12
16
|
|
13
17
|
Configure it:
|
14
18
|
|
@@ -17,25 +21,38 @@ Configure it:
|
|
17
21
|
|
18
22
|
_Switchboard settings are not presently used._
|
19
23
|
|
20
|
-
|
24
|
+
Add **fireeagle.com** to your roster:
|
25
|
+
|
26
|
+
$ switchboard --jid jid@example.com --password pa55word \
|
27
|
+
roster add fireeagle.com
|
28
|
+
|
29
|
+
Confirm that your roster contains **fireeagle.com** (in order for presence
|
30
|
+
notifications to be sent properly):
|
21
31
|
|
22
|
-
$ switchboard
|
23
|
-
$ switchboard config password pa55word
|
24
|
-
$ switchboard config oauth.consumer_key asdf
|
25
|
-
$ switchboard config oauth.consumer_secret qwerty
|
26
|
-
$ switchboard config oauth.token asdf
|
27
|
-
$ switchboard config oauth.token_secret qwerty
|
28
|
-
$ switchboard config oauth.general_token asdf
|
29
|
-
$ switchboard config oauth.general_token_secret qwerty
|
30
|
-
$ switchboard config pubsub.server fireeagle.com
|
32
|
+
$ switchboard --jid jid@example.com --password pa55word roster list
|
31
33
|
|
32
34
|
Subscribe to location updates corresponding to the configured token:
|
33
35
|
|
34
|
-
$ switchboard
|
36
|
+
$ switchboard --jid jid@example.com --password pa55word \
|
37
|
+
pubsub --oauth \
|
38
|
+
--oauth-consumer-key <consumer key> \
|
39
|
+
--oauth-consumer-secret <consumer secret> \
|
40
|
+
--oauth-token <token> \
|
41
|
+
--oauth-token-secret <token secret> \
|
42
|
+
--server fireeagle.com \
|
43
|
+
--node "/api/0.1/user/<token>" \
|
44
|
+
subscribe
|
35
45
|
|
36
46
|
Check subscriptions:
|
37
47
|
|
38
|
-
$ switchboard
|
48
|
+
$ switchboard --jid jid@example.com --password pa55word \
|
49
|
+
pubsub --oauth \
|
50
|
+
--oauth-consumer-key <consumer key> \
|
51
|
+
--oauth-consumer-secret <consumer secret> \
|
52
|
+
--oauth-token <general token> \
|
53
|
+
--oauth-token-secret <general token secret> \
|
54
|
+
--server fireeagle.com \
|
55
|
+
subscriptions
|
39
56
|
|
40
57
|
Run it:
|
41
58
|
|
@@ -43,7 +60,46 @@ Run it:
|
|
43
60
|
|
44
61
|
If you'd like to unsubscribe:
|
45
62
|
|
46
|
-
|
63
|
+
|
64
|
+
$ switchboard --jid jid@example.com --password pa55word \
|
65
|
+
pubsub --oauth \
|
66
|
+
--oauth-consumer-key <consumer key> \
|
67
|
+
--oauth-consumer-secret <consumer secret> \
|
68
|
+
--oauth-token <token> \
|
69
|
+
--oauth-token-secret <token secret> \
|
70
|
+
--server fireeagle.com \
|
71
|
+
--node "/api/0.1/user/<token>" \
|
72
|
+
unsubscribe
|
73
|
+
|
74
|
+
## Incorporating the Fire Hydrant Into Your Application
|
75
|
+
|
76
|
+
The most basic Fire Eagle consumer looks like:
|
77
|
+
|
78
|
+
config = YAML.load(File.read("fire_hydrant.yml"))
|
79
|
+
hydrant = FireHydrant.new(config)
|
80
|
+
|
81
|
+
hydrant.on_location_update do |user|
|
82
|
+
# insert application-specific functionality here
|
83
|
+
puts "#{user.token} has moved to #{user.locations[0].name}."
|
84
|
+
end
|
85
|
+
|
86
|
+
hydrant.run!
|
87
|
+
|
88
|
+
_examples/fire\_eagle\_consumer.rb_
|
89
|
+
|
90
|
+
The configuration Hash (`config`) must contain `jid`, `password`, and
|
91
|
+
`pubsub.server`, but does not need to be loaded from `fire_hydrant.yml`.
|
92
|
+
|
93
|
+
Your consumer should run as a stand-alone application, as it spawns several
|
94
|
+
threads and is intended to be a long-running process.
|
95
|
+
|
96
|
+
Also, note that running multiple instances of the consumer (each with
|
97
|
+
different resources, in order for all to be online simultaneously) will not
|
98
|
+
distribute updates across instances; **all instances will receive all
|
99
|
+
updates**.
|
100
|
+
|
101
|
+
See the [Fire Eagle gem documentation](http://fireeagle.rubyforge.org/) for
|
102
|
+
more information on how Fire Eagle information is exposed to Ruby.
|
47
103
|
|
48
104
|
## Notes and Gotchas
|
49
105
|
|
data/fire-hydrant.gemspec
CHANGED