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 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
- Configure switchboard:
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 config jid jid@example.com
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 pubsub subscribe
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 pubsub subscriptions
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
- $ switchboard pubsub unsubscribe
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
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'rubygems'
2
3
  require 'fire_hydrant'
3
4
  require 'yaml'
4
5
 
data/fire-hydrant.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "fire-hydrant"
3
- s.version = "0.0.1"
3
+ s.version = "0.0.2"
4
4
  s.summary = "Fire Eagle XMPP PubSub tools"
5
5
  s.description = "Tools for consuming Fire Eagle's XMPP PubSub feed."
6
6
  s.authors = ["Seth Fitzsimmons"]
@@ -7,7 +7,7 @@ rescue LoadError => e
7
7
  puts "The #{gem} gem is required."
8
8
  end
9
9
 
10
- class FireHydrant < Switchboard::Core
10
+ class FireHydrant < Switchboard::Client
11
11
  DEFAULTS = {
12
12
  "resource" => "fire_hydrant"
13
13
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mojodna-fire-hydrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Fitzsimmons