tinyatom 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/tinyatom/feed.rb +21 -14
  3. data/tinyatom.gemspec +1 -1
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
data/lib/tinyatom/feed.rb CHANGED
@@ -6,12 +6,11 @@ module TinyAtom
6
6
  class Feed
7
7
 
8
8
  def initialize(site_url, title, feed_url, options={})
9
- @site_url, @title, @feed_url = site_url, title, feed_url
9
+ @site_url, @title, @feed_url, @feed_options = site_url, title, feed_url,
10
+ options
10
11
 
11
12
  @site_domain = URI(@site_url).domain
12
13
 
13
- @hubs = options[:hubs] || []
14
-
15
14
  @entries = []
16
15
  end
17
16
 
@@ -35,7 +34,10 @@ module TinyAtom
35
34
  xm.link(:href => feed_url, :rel => 'self')
36
35
  xm.updated(updated.xmlschema)
37
36
  xm.id(site_url)
38
- hubs.each { |hub| xm.link(:href => hub, :rel => 'hub') }
37
+ TinyAtom::author(xm, feed_options)
38
+ feed_options.fetch(:hubs, []).each do |hub|
39
+ xm.link(:rel => 'hub', :href => hub)
40
+ end
39
41
 
40
42
  entries.each do |e|
41
43
  xm.entry {
@@ -44,6 +46,7 @@ module TinyAtom
44
46
  xm.id(entry_id(e))
45
47
  xm.updated(e[:updated])
46
48
  xm.summary(e[:summary]) if e[:summary]
49
+ xm.content(e[:content]) if e[:content]
47
50
 
48
51
  TinyAtom::author(xm, e)
49
52
  TinyAtom::enclosure(xm, e)
@@ -65,8 +68,8 @@ module TinyAtom
65
68
  attr_reader :site_url
66
69
  attr_reader :title
67
70
  attr_reader :feed_url
71
+ attr_reader :feed_options
68
72
  attr_reader :site_domain
69
- attr_reader :hubs
70
73
  attr_reader :entries
71
74
  end
72
75
 
@@ -74,29 +77,33 @@ module TinyAtom
74
77
 
75
78
  # Add author tags if present
76
79
  def author(markup, h)
77
- if h[:author_name] or h[:author_email] or h[:author_uri]
80
+ if h[:author_name]
78
81
  markup.author {
79
82
  markup.name(h[:author_name]) if h[:author_name]
80
- markup.name(h[:author_email]) if h[:author_email]
81
- markup.name(h[:author_uri]) if h[:author_uri]
83
+ markup.email(h[:author_email]) if h[:author_email]
84
+ markup.uri(h[:author_uri]) if h[:author_uri]
82
85
  }
83
86
  end
84
87
  end
85
88
 
86
89
  # Add enclosure tags if present
87
90
  def enclosure(markup, h)
88
- if h[:enclosure_type] and h[:link] and h[:enclosure_title]
89
- xm.link(:rel => 'enclosure', :type => h[:enclosure_type],
90
- :href => h[:link], :title => h[:enclosure_title])
91
+ if h[:enclosure_type] and h[:enclosure_href] and h[:enclosure_title]
92
+ link(markup, 'enclosure', h[:enclosure_type], h[:enclosure_href],
93
+ h[:enclosure_title])
91
94
  end
92
95
  end
93
96
 
94
97
  # Add via tags if present
95
98
  def via(markup, h)
96
- if h[:via_type] and h[:via_url] and h[:via_title]
97
- markup.link(:rel => 'via', :type => h[:via_type],
98
- :href => h[:via_url], :title => h[:via_title])
99
+ if h[:via_type] and h[:via_href] and h[:via_title]
100
+ link(markup, 'via', h[:via_type], h[:via_href], h[:via_title])
99
101
  end
100
102
  end
101
103
 
104
+ # Create link tag
105
+ def link(markup, rel, type, href, title)
106
+ markup.link(:rel => rel, :type => type, :href => href, :title => title)
107
+ end
108
+
102
109
  end
data/tinyatom.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tinyatom}
8
- s.version = "0.0.1"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matthew M. Boedicker"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinyatom
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 0
9
8
  - 1
10
- version: 0.0.1
9
+ - 0
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthew M. Boedicker