simonreed-lyrebird 0.1 → 0.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +16 -2
- data/lib/lyre_bird.rb +2 -4
- data/lib/lyre_bird/route.rb +1 -3
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -6,7 +6,21 @@ Twitter Gateway, allows your app to respond to natural language questions from T
|
|
6
6
|
|
7
7
|
* HTTParty http://github.com/jnunemaker/httparty/ - For accessing the Twitter web service.
|
8
8
|
|
9
|
+
= SYNOPSIS
|
10
|
+
require 'rubygems'
|
11
|
+
require 'lyre_bird'
|
12
|
+
|
13
|
+
routes = [
|
14
|
+
{ 'str' => "Do you have a :item for me" }
|
15
|
+
]
|
16
|
+
|
17
|
+
lyre = LyreBird.new(:username => 'username', :password => 'password', :routes => routes)
|
18
|
+
lyre.check() # Check for new messages.
|
19
|
+
|
9
20
|
== Install
|
10
21
|
|
11
|
-
|
12
|
-
|
22
|
+
sudo gem sources -a http://gems.github.com
|
23
|
+
|
24
|
+
sudo gem install simonreed-lyrebird
|
25
|
+
|
26
|
+
require ''
|
data/lib/lyre_bird.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
CONSOLE = false
|
2
|
-
DEBUG = false
|
3
|
-
|
4
1
|
class LyreBird
|
5
2
|
|
6
3
|
attr_accessor :username
|
7
|
-
attr_accessor :password
|
4
|
+
attr_accessor :password
|
8
5
|
|
9
6
|
def initialize(options={})
|
10
7
|
$responses = {}
|
11
8
|
self.username = options[:username] || 'username'
|
12
9
|
self.password = options[:password] || 'password'
|
10
|
+
$lyrebird_routes = options[:routes] || []
|
13
11
|
end
|
14
12
|
|
15
13
|
def listen(options={})
|
data/lib/lyre_bird/route.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
ROUTES = YAML.load_file("#{RAILS_ROOT}/config/lyre_routes.yml")
|
2
|
-
|
3
1
|
class LyreBird::Route
|
4
2
|
def initialize(options={})
|
5
3
|
|
@@ -9,7 +7,7 @@ class LyreBird::Route
|
|
9
7
|
|
10
8
|
successes = []
|
11
9
|
puts "Parsing '#{str}'" if DEBUG
|
12
|
-
|
10
|
+
$lyrebird_routes.each do | r |
|
13
11
|
route = r['str']
|
14
12
|
clear = r['clear']
|
15
13
|
puts "- Trying '#{route}'" if DEBUG
|