Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 951 Bytes

README.textile

File metadata and controls

34 lines (23 loc) · 951 Bytes

Gnap
/næp/

Gnap is an interface to Gnip’s api. It has not been written yet. The following code is how I hope to make it work, and is subject to change.


require 'gnap'
gnap = Gnap.new("username", "password")

# current notifications stream for twitter
gnap.publishers("twitter").notifications

# five minutes ago
gnap.publishers("twitter").notifications(5.minutes.ago)

# from a filter
gnap.publishers("twitter").filter("bobs_rule").notifications(5.minutes.ago)

# gnip doesn't appear to me to support time ranges, so I don't.
# one call to notifications == one request!


# create a new filter
gnap.publishers("twitter").create_filter!("bobs_rule", :actor => "some actor rule text")

# add a rule
gnap.publishers("twitter").filter("bobs_rule").add_rule!("actor", "bob")

# add several rules
gnap.publishers("twitter").filter("bobs_rule").add_rules!({"actor" => ["bob", "steve", "alan", "and so on"])