Class: Omnom::Source::Feed

Inherits:
Base
  • Object
show all
Defined in:
lib/omnom/source/feed.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #feed_key, #key, #options, #settings, #source_id

Instance Method Summary collapse

Methods inherited from Base

config, configure, cron, every, feed_url, full_key, guid_namespace, icon, icon_from_url, inherited, #initialize, key, required_config, required_options, #update, url

Methods included from ParserMethods

#html_to_text

Constructor Details

This class inherits a constructor from Omnom::Source::Base

Instance Method Details

#after_initializeObject



7
8
9
# File 'lib/omnom/source/feed.rb', line 7

def after_initialize
  @settings[:icon] = self.class.icon_from_url(@options[:url]) if @settings[:icon].blank?
end

#author_nameObject



48
49
50
# File 'lib/omnom/source/feed.rb', line 48

def author_name
  @entry.author
end

#descriptionObject



32
33
34
# File 'lib/omnom/source/feed.rb', line 32

def description
  @entry.summary || @entry.content
end

#get_raw_postsObject



11
12
13
# File 'lib/omnom/source/feed.rb', line 11

def get_raw_posts
  Feedzirra::Feed.fetch_and_parse(@options[:url]).entries
end

#guidObject



36
37
38
# File 'lib/omnom/source/feed.rb', line 36

def guid
  @entry.id
end

#post_attributes(entry) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/omnom/source/feed.rb', line 15

def post_attributes(entry)
  @entry = entry
  {
    title: title,
    description: description,
    guid: guid,
    url: url,
    published_at: published_at,
    author_name: author_name,
    tags: tags
  }
end

#published_atObject



44
45
46
# File 'lib/omnom/source/feed.rb', line 44

def published_at
  @entry.published
end

#tagsObject



52
53
54
# File 'lib/omnom/source/feed.rb', line 52

def tags
  @entry.categories
end

#titleObject



28
29
30
# File 'lib/omnom/source/feed.rb', line 28

def title
  @entry.title
end

#urlObject



40
41
42
# File 'lib/omnom/source/feed.rb', line 40

def url
  @entry.url
end