Module: GReader

Defined in:
lib/greader.rb,
lib/greader/tag.rb,
lib/greader/feed.rb,
lib/greader/entry.rb,
lib/greader/client.rb,
lib/greader/entries.rb,
lib/greader/utilities.rb

Overview

Google Reader API client.

Common usage

First, log in (returns a Client or ‘nil`):

@client = GReader.auth email: '[email protected]', password: 'password'

Common Client usage

A Client has many Feeds and Tags:

@client.feeds                #=> [#<Feed>, #<Feed>, ...]
@client.tags                 #=> [#<Tag>, #<Tag>, ...]

@client.feed('FEED_ID')
@client.tag('TAG_ID')

Common Feed usage

@client.feeds.each do |feed|
  p feed.id
  p feed.title
  p feed.url

  # A Feed has many entries
  feed.entries.each do |entry|
    p entry.title
    p entry.content
  end
end

Common Tag usage

A Tag also has many feeds:

# Tag
@client.tag('TAG_ID').feeds.each { |feed| }

Other

GReader.version            #=> "0.0.0"

See also

Feed

A website’s feed.

Entry

An entry in a feed.

Tag

A feed’s tag.

Defined Under Namespace

Modules: Utilities Classes: Client, Entries, Entry, Feed, ParseError, Tag

Constant Summary collapse

PREFIX =
File.expand_path('../greader/', __FILE__)
VERSION =
"0.0.2"
Error =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.auth(options = {}) ⇒ Object



65
66
67
68
# File 'lib/greader.rb', line 65

def self.auth(options={})
  client = GReader::Client.new options
  client  if client.logged_in?
end

.html_processorsObject

Returns a list of HTML pre-processors. HTML snippets will be passed through this.

Examples:

GReader.html_processors << lambda { |s| s.strip }
GReader.process_html('<p>  ')   #=> '<p>'


77
78
79
# File 'lib/greader.rb', line 77

def self.html_processors
  @html_processors ||= Array.new
end

.process_html(str) ⇒ Object

Processes an HTML snippet through the given HTML processors.



83
84
85
86
87
# File 'lib/greader.rb', line 83

def self.process_html(str)
  html = str.dup
  html_processors.each { |proc| html = proc.call(html) }
  html
end

.versionObject



89
90
91
# File 'lib/greader.rb', line 89

def self.version
  VERSION
end