xommelier 0.1.34 → 0.1.35

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 (87) hide show
  1. checksums.yaml +5 -5
  2. data/.gitlab-ci.yml +19 -0
  3. data/.rubocop_todo.yml +110 -42
  4. data/.travis.yml +1 -2
  5. data/.yardopts +4 -0
  6. data/LICENSE +21 -0
  7. data/README.md +9 -167
  8. data/bin/console +1 -1
  9. data/{examples → example}/atom.rb +10 -8
  10. data/example/building_an_atom_feed.output.xml +31 -0
  11. data/example/building_an_atom_feed.rb +49 -0
  12. data/example/building_an_atom_feed_using_hash.output.xml +34 -0
  13. data/example/building_an_atom_feed_using_hash.rb +28 -0
  14. data/example/reading_an_atom_feed.rb +13 -0
  15. data/{examples → example}/xml.rb +0 -0
  16. data/lib/xommelier.rb +0 -1
  17. data/lib/xommelier/atom.rb +0 -1
  18. data/lib/xommelier/atom/category.rb +0 -1
  19. data/lib/xommelier/atom/content.rb +0 -1
  20. data/lib/xommelier/atom/entry.rb +0 -1
  21. data/lib/xommelier/atom/feed.rb +0 -1
  22. data/lib/xommelier/atom/full.rb +0 -1
  23. data/lib/xommelier/atom/generator.rb +0 -1
  24. data/lib/xommelier/atom/history.rb +0 -1
  25. data/lib/xommelier/atom/link.rb +0 -1
  26. data/lib/xommelier/atom/links_extension.rb +0 -1
  27. data/lib/xommelier/atom/person.rb +0 -1
  28. data/lib/xommelier/atom/source.rb +0 -1
  29. data/lib/xommelier/atom/threading.rb +0 -1
  30. data/lib/xommelier/common.rb +1 -2
  31. data/lib/xommelier/core_ext.rb +0 -1
  32. data/lib/xommelier/core_ext/boolean.rb +0 -1
  33. data/lib/xommelier/core_ext/date.rb +0 -1
  34. data/lib/xommelier/core_ext/float.rb +0 -1
  35. data/lib/xommelier/core_ext/numeric.rb +1 -2
  36. data/lib/xommelier/core_ext/string.rb +0 -1
  37. data/lib/xommelier/core_ext/symbol.rb +0 -1
  38. data/lib/xommelier/core_ext/time.rb +0 -1
  39. data/lib/xommelier/core_ext/uri.rb +0 -1
  40. data/lib/xommelier/ds.rb +0 -1
  41. data/lib/xommelier/dsig11.rb +0 -1
  42. data/lib/xommelier/factory_girl.rb +0 -1
  43. data/lib/xommelier/open_search.rb +0 -1
  44. data/lib/xommelier/opml.rb +0 -1
  45. data/lib/xommelier/rss.rb +0 -1
  46. data/lib/xommelier/rss/atomic.rb +0 -1
  47. data/lib/xommelier/sitemap.rb +0 -1
  48. data/lib/xommelier/version.rb +1 -2
  49. data/lib/xommelier/xml.rb +0 -1
  50. data/lib/xommelier/xml/element.rb +0 -1
  51. data/lib/xommelier/xml/element/namespace.rb +0 -1
  52. data/lib/xommelier/xml/element/serialization.rb +2 -7
  53. data/lib/xommelier/xml/element/structure.rb +0 -1
  54. data/lib/xommelier/xml/element/structure/property.rb +0 -1
  55. data/lib/xommelier/xml/namespace.rb +0 -1
  56. data/lib/xommelier/xml/schema.rb +0 -1
  57. data/spec/functional/xommelier/atom/feed/building_hash_spec.rb +0 -1
  58. data/spec/functional/xommelier/atom/feed/building_spec.rb +0 -1
  59. data/spec/functional/xommelier/atom/feed/parsing_spec.rb +2 -3
  60. data/spec/functional/xommelier/atom/threading/building_spec.rb +0 -1
  61. data/spec/functional/xommelier/open_search/description/building_spec.rb +0 -1
  62. data/spec/functional/xommelier/open_search/description/parsing_spec.rb +0 -1
  63. data/spec/functional/xommelier/rss/rss/building_spec.rb +0 -1
  64. data/spec/functional/xommelier/rss/rss/parsing_spec.rb +0 -1
  65. data/spec/lib/xommelier/atom/entry_spec.rb +0 -1
  66. data/spec/lib/xommelier/atom_spec.rb +0 -1
  67. data/spec/lib/xommelier/ds/canonicalization_method_spec.rb +0 -1
  68. data/spec/lib/xommelier/ds/digest_method_spec.rb +0 -1
  69. data/spec/lib/xommelier/ds/reference_spec.rb +0 -1
  70. data/spec/lib/xommelier/ds/signature_method_spec.rb +0 -1
  71. data/spec/lib/xommelier/ds/signature_spec.rb +0 -1
  72. data/spec/lib/xommelier/ds/signed_info_spec.rb +0 -1
  73. data/spec/lib/xommelier/ds/transform_spec.rb +0 -1
  74. data/spec/lib/xommelier/ds_spec.rb +0 -1
  75. data/spec/lib/xommelier/rss/email_address_spec.rb +0 -1
  76. data/spec/lib/xommelier/xml/element/serialization_spec.rb +0 -1
  77. data/spec/lib/xommelier/xml/element/structure_spec.rb +0 -1
  78. data/spec/lib/xommelier/xml/element_spec.rb +0 -1
  79. data/spec/lib/xommelier/xml_spec.rb +0 -1
  80. data/spec/lib/xommelier_spec.rb +0 -1
  81. data/spec/spec_helper.rb +1 -3
  82. data/spec/support/fixtures.rb +0 -1
  83. data/spec/support/namespaced_module.rb +0 -1
  84. data/spec/support/schema_validatable.rb +0 -1
  85. data/xommelier.gemspec +8 -10
  86. metadata +43 -37
  87. data/MIT-LICENSE +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7cbfd8f546a2bbc53ff4c9e6a1afc454ad6d84d9
4
- data.tar.gz: 0a1ea0a41b9f169e02cbc65b20763e67aa597d55
2
+ SHA256:
3
+ metadata.gz: 4705ce526033f604f2622bec11450dd7afd4032a34df09d5b71beb569c6f1022
4
+ data.tar.gz: 485c88af2cbbca7b477073ab18ac1077b7d70e993dab591a429c34c315b41858
5
5
  SHA512:
6
- metadata.gz: 0c4a70b3018965c81ad18c362e8fc3a59d8755ad7713eaedcb18f736651867044b68a599a506bccbf0c5c3497eff07ff130ae98552978afe241ec423afa07384
7
- data.tar.gz: b68e31e5b1c23981ae55ac1b62d735cdd188e089a5071e3a9cf083d372a620f17e7a6c63238e98da117e3e3e8d8e988334d04069982709b2d8cc9c856fd1055a
6
+ metadata.gz: f90951abc1a2e9d35192a3bc254a040a12cb81c310f8a142ce39d62d1d66ee3d2b86ec52bf9eb25df0164e81da1a30ff1a00b1d5eeef7c03578f30f0071069ed
7
+ data.tar.gz: dd753cd00aea1bdac155918206d7731c8fa85078392a493dbea8154657a70981a89bd40b0bf0e1e600cfe6e0c178757aa6e081e5618cce0dd66d1bd22ba0b577
@@ -0,0 +1,19 @@
1
+ # This file is a template, and might need editing before it works on your project.
2
+ # Official language image. Look for the different tagged releases at:
3
+ image: ruby:latest
4
+
5
+ # Cache gems in between builds
6
+ cache:
7
+ paths:
8
+ - .bundle
9
+
10
+ # This is a basic example for a gem or script which doesn't use
11
+ # services such as redis or postgres
12
+ before_script:
13
+ - ruby -v # Print out ruby version for debugging
14
+ - gem install bundler --no-ri --no-rdoc # Bundler is not installed with the image
15
+ - bundle install -j $(nproc) --path .bundle # Install dependencies into ./.bundle
16
+
17
+ rake:
18
+ script:
19
+ - rake
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-04-06 23:00:54 +0300 using RuboCop version 0.48.1.
3
+ # on 2018-10-07 22:45:49 +0300 using RuboCop version 0.59.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -9,15 +9,49 @@
9
9
  # Offense count: 1
10
10
  # Cop supports --auto-correct.
11
11
  # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
12
- # Include: **/Gemfile, **/gems.rb
12
+ # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
13
  Bundler/OrderedGems:
14
14
  Exclude:
15
15
  - 'Gemfile'
16
16
 
17
+ # Offense count: 11
18
+ # Cop supports --auto-correct.
19
+ Layout/EmptyLineAfterGuardClause:
20
+ Exclude:
21
+ - 'lib/xommelier/common.rb'
22
+ - 'lib/xommelier/core_ext/float.rb'
23
+ - 'lib/xommelier/core_ext/numeric.rb'
24
+ - 'lib/xommelier/core_ext/string.rb'
25
+ - 'lib/xommelier/core_ext/time.rb'
26
+ - 'lib/xommelier/core_ext/uri.rb'
27
+ - 'lib/xommelier/ds.rb'
28
+ - 'lib/xommelier/dsig11.rb'
29
+ - 'lib/xommelier/xml/element/serialization.rb'
30
+ - 'lib/xommelier/xml/element/structure/property.rb'
31
+ - 'lib/xommelier/xml/schema.rb'
32
+
33
+ # Offense count: 7
34
+ # Cop supports --auto-correct.
35
+ Layout/EmptyLineAfterMagicComment:
36
+ Exclude:
37
+ - 'Gemfile'
38
+ - 'Rakefile'
39
+ - 'bin/console'
40
+ - 'bin/rake'
41
+ - 'bin/rubocop'
42
+ - 'example/atom.rb'
43
+ - 'example/xml.rb'
44
+
17
45
  # Offense count: 1
18
46
  Lint/ShadowingOuterLocalVariable:
19
47
  Exclude:
20
- - 'examples/atom.rb'
48
+ - 'example/atom.rb'
49
+
50
+ # Offense count: 1
51
+ # Configuration parameters: CheckForMethodsWithNoSideEffects.
52
+ Lint/Void:
53
+ Exclude:
54
+ - 'lib/xommelier/xml/schema.rb'
21
55
 
22
56
  # Offense count: 9
23
57
  Metrics/AbcSize:
@@ -25,6 +59,7 @@ Metrics/AbcSize:
25
59
 
26
60
  # Offense count: 15
27
61
  # Configuration parameters: CountComments, ExcludedMethods.
62
+ # ExcludedMethods: refine
28
63
  Metrics/BlockLength:
29
64
  Max: 96
30
65
 
@@ -32,26 +67,46 @@ Metrics/BlockLength:
32
67
  Metrics/CyclomaticComplexity:
33
68
  Max: 14
34
69
 
35
- # Offense count: 125
36
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
37
- # URISchemes: http, https
38
- Metrics/LineLength:
39
- Max: 265
40
-
41
- # Offense count: 10
42
- # Configuration parameters: CountComments.
70
+ # Offense count: 9
71
+ # Configuration parameters: CountComments, ExcludedMethods.
43
72
  Metrics/MethodLength:
44
73
  Max: 46
45
74
 
46
75
  # Offense count: 1
47
76
  # Configuration parameters: CountComments.
48
77
  Metrics/ModuleLength:
49
- Max: 203
78
+ Max: 199
50
79
 
51
80
  # Offense count: 3
52
81
  Metrics/PerceivedComplexity:
53
82
  Max: 15
54
83
 
84
+ # Offense count: 3
85
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
86
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
87
+ Naming/MemoizedInstanceVariableName:
88
+ Exclude:
89
+ - 'lib/xommelier/rss.rb'
90
+ - 'lib/xommelier/xml/schema.rb'
91
+
92
+ # Offense count: 1
93
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
94
+ # NamePrefix: is_, has_, have_
95
+ # NamePrefixBlacklist: is_, has_, have_
96
+ # NameWhitelist: is_a?
97
+ # MethodDefinitionMacros: define_method, define_singleton_method
98
+ Naming/PredicateName:
99
+ Exclude:
100
+ - 'spec/**/*'
101
+ - 'lib/xommelier/ds.rb'
102
+
103
+ # Offense count: 1
104
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
105
+ # AllowedNames: io, id, to, by, on, in, at, ip, db
106
+ Naming/UncommunicativeMethodParamName:
107
+ Exclude:
108
+ - 'lib/xommelier/xml/element/serialization.rb'
109
+
55
110
  # Offense count: 1
56
111
  RSpec/DescribeSymbol:
57
112
  Exclude:
@@ -65,7 +120,14 @@ RSpec/EmptyExampleGroup:
65
120
  - 'spec/lib/xommelier/xml_spec.rb'
66
121
  - 'spec/lib/xommelier_spec.rb'
67
122
 
123
+ # Offense count: 2
124
+ # Cop supports --auto-correct.
125
+ RSpec/EmptyLineAfterExampleGroup:
126
+ Exclude:
127
+ - 'spec/functional/xommelier/atom/feed/parsing_spec.rb'
128
+
68
129
  # Offense count: 5
130
+ # Cop supports --auto-correct.
69
131
  RSpec/EmptyLineAfterFinalLet:
70
132
  Exclude:
71
133
  - 'spec/functional/xommelier/atom/feed/parsing_spec.rb'
@@ -75,6 +137,7 @@ RSpec/EmptyLineAfterFinalLet:
75
137
  - 'spec/lib/xommelier/ds/signature_spec.rb'
76
138
 
77
139
  # Offense count: 12
140
+ # Cop supports --auto-correct.
78
141
  RSpec/EmptyLineAfterSubject:
79
142
  Exclude:
80
143
  - 'spec/functional/xommelier/atom/feed/parsing_spec.rb'
@@ -84,7 +147,8 @@ RSpec/EmptyLineAfterSubject:
84
147
  - 'spec/lib/xommelier/ds/transform_spec.rb'
85
148
 
86
149
  # Offense count: 101
87
- # Configuration parameters: EnforcedStyle, SupportedStyles.
150
+ # Cop supports --auto-correct.
151
+ # Configuration parameters: EnforcedStyle.
88
152
  # SupportedStyles: is_expected, should
89
153
  RSpec/ImplicitExpect:
90
154
  Exclude:
@@ -104,7 +168,16 @@ RSpec/ImplicitExpect:
104
168
  - 'spec/lib/xommelier/ds/transform_spec.rb'
105
169
  - 'spec/lib/xommelier/ds_spec.rb'
106
170
 
171
+ # Offense count: 1
172
+ # Cop supports --auto-correct.
173
+ # Configuration parameters: EnforcedStyle.
174
+ # SupportedStyles: single_line_only, disallow
175
+ RSpec/ImplicitSubject:
176
+ Exclude:
177
+ - 'spec/functional/xommelier/atom/feed/parsing_spec.rb'
178
+
107
179
  # Offense count: 6
180
+ # Cop supports --auto-correct.
108
181
  RSpec/LeadingSubject:
109
182
  Exclude:
110
183
  - 'spec/functional/xommelier/atom/feed/building_hash_spec.rb'
@@ -115,6 +188,7 @@ RSpec/LeadingSubject:
115
188
  - 'spec/lib/xommelier/ds/signature_spec.rb'
116
189
 
117
190
  # Offense count: 1
191
+ # Configuration parameters: AggregateFailuresByDefault.
118
192
  RSpec/MultipleExpectations:
119
193
  Max: 2
120
194
 
@@ -127,17 +201,21 @@ RSpec/NamedSubject:
127
201
  - 'spec/support/schema_validatable.rb'
128
202
 
129
203
  # Offense count: 5
130
- # Configuration parameters: Max.
131
204
  RSpec/NestedGroups:
132
- Exclude:
133
- - 'spec/functional/xommelier/atom/feed/parsing_spec.rb'
205
+ Max: 5
134
206
 
135
207
  # Offense count: 2
136
208
  RSpec/RepeatedExample:
137
209
  Exclude:
138
210
  - 'spec/functional/xommelier/rss/rss/parsing_spec.rb'
139
211
 
212
+ # Offense count: 1
213
+ Security/Open:
214
+ Exclude:
215
+ - 'spec/support/fixtures.rb'
216
+
140
217
  # Offense count: 69
218
+ # Configuration parameters: AllowedChars.
141
219
  Style/AsciiComments:
142
220
  Enabled: false
143
221
 
@@ -147,7 +225,8 @@ Style/CaseEquality:
147
225
  - 'lib/xommelier/xml/element/serialization.rb'
148
226
 
149
227
  # Offense count: 1
150
- # Configuration parameters: EnforcedStyle, SupportedStyles.
228
+ # Cop supports --auto-correct.
229
+ # Configuration parameters: AutoCorrect, EnforcedStyle.
151
230
  # SupportedStyles: nested, compact
152
231
  Style/ClassAndModuleChildren:
153
232
  Exclude:
@@ -168,18 +247,6 @@ Style/EachWithObject:
168
247
  Exclude:
169
248
  - 'lib/xommelier/xml/element/serialization.rb'
170
249
 
171
- # Offense count: 7
172
- # Cop supports --auto-correct.
173
- Style/EmptyLineAfterMagicComment:
174
- Exclude:
175
- - 'Gemfile'
176
- - 'Rakefile'
177
- - 'bin/console'
178
- - 'bin/rake'
179
- - 'bin/rubocop'
180
- - 'examples/atom.rb'
181
- - 'examples/xml.rb'
182
-
183
250
  # Offense count: 2
184
251
  # Configuration parameters: MinBodyLength.
185
252
  Style/GuardClause:
@@ -193,10 +260,15 @@ Style/IfInsideElse:
193
260
  - 'lib/xommelier/xml/element/serialization.rb'
194
261
 
195
262
  # Offense count: 1
196
- Style/MethodMissing:
263
+ Style/MissingRespondToMissing:
197
264
  Exclude:
198
265
  - 'lib/xommelier/rss.rb'
199
266
 
267
+ # Offense count: 1
268
+ Style/MixinUsage:
269
+ Exclude:
270
+ - 'example/atom.rb'
271
+
200
272
  # Offense count: 1
201
273
  # Cop supports --auto-correct.
202
274
  Style/MultilineIfModifier:
@@ -214,16 +286,6 @@ Style/PercentLiteralDelimiters:
214
286
  - 'spec/lib/xommelier/atom/entry_spec.rb'
215
287
  - 'spec/lib/xommelier/xml/element_spec.rb'
216
288
 
217
- # Offense count: 1
218
- # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
219
- # NamePrefix: is_, has_, have_
220
- # NamePrefixBlacklist: is_, has_, have_
221
- # NameWhitelist: is_a?
222
- Style/PredicateName:
223
- Exclude:
224
- - 'spec/**/*'
225
- - 'lib/xommelier/ds.rb'
226
-
227
289
  # Offense count: 4
228
290
  # Cop supports --auto-correct.
229
291
  Style/RedundantFreeze:
@@ -235,15 +297,21 @@ Style/RedundantFreeze:
235
297
 
236
298
  # Offense count: 3
237
299
  # Cop supports --auto-correct.
238
- # Configuration parameters: SupportedStyles.
300
+ # Configuration parameters: MinSize.
239
301
  # SupportedStyles: percent, brackets
240
302
  Style/SymbolArray:
241
303
  EnforcedStyle: brackets
242
304
 
243
305
  # Offense count: 1
244
306
  # Cop supports --auto-correct.
245
- # Configuration parameters: EnforcedStyle, SupportedStyles, AllowSafeAssignment.
307
+ # Configuration parameters: EnforcedStyle, AllowSafeAssignment.
246
308
  # SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
247
309
  Style/TernaryParentheses:
248
310
  Exclude:
249
311
  - 'lib/xommelier/xml/element/serialization.rb'
312
+
313
+ # Offense count: 125
314
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
315
+ # URISchemes: http, https
316
+ Metrics/LineLength:
317
+ Max: 265
@@ -2,6 +2,5 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 1.9.3
6
- - 2.3.0
5
+ - 2.5.0
7
6
  bundler_args: --without ide documentation
data/.yardopts CHANGED
@@ -1,2 +1,6 @@
1
1
  --title=Xommelier
2
2
  --markup=markdown
3
+ --files=example/building_an_atom_feed.rb
4
+ --files=example/building_an_atom_feed_using_hash.rb
5
+ --files=example/reading_an_atom_feed.rb
6
+ --readme=README.md
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ © Alex Semyonov, 2011-2017
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -17,170 +17,13 @@ Look into {Xommelier::Atom}, {Xommelier::Atom::Threading}, and {Xommelier::Atom:
17
17
  * [![Build Status](https://travis-ci.org/alsemyonov/xommelier.png?branch=master)](http://travis-ci.org/alsemyonov/xommelier)
18
18
  * [![Dependency Status](https://gemnasium.com/alsemyonov/xommelier.png)](https://gemnasium.com/alsemyonov/xommelier)
19
19
 
20
- ## Examples with Atom
21
-
22
- ```ruby
23
- require 'xommelier/atom/full'
24
- ```
25
-
26
- ### Reading a feed
27
-
28
- ```ruby
29
- feed = Xommelier::Atom::Feed.parse(open('spec/fixtures/feed.atom.xml'))
30
- puts feed.id, feed.title, feed.updated
31
-
32
- feed.entries do |entry|
33
- puts entry.id, entry.title, entry.published, entry.updated
34
- puts entry.content || entry.summary
35
- end
36
- ```
37
-
38
- ### Building a feed
39
-
40
- ```ruby
41
- feed = Xommelier::Atom::Feed.new
42
- feed.id = 'http://example.com/blog'
43
- feed.title = 'Example.com blog'
44
- feed.complete = Xommelier::Atom::History::Complete.new
45
-
46
- entry = feed.entry = Xommelier::Atom::Entry.new(
47
- id: 'http://example.com/blog/2012/03/05',
48
- title: "Happy Xommelier's day!",
49
- updated: 5.days.ago
50
- ).tap do |entry|
51
- entry.link = Xommelier::Atom::Link.new(
52
- href: entry.id,
53
- rel: 'alternate',
54
- type: 'text/html'
55
- )
56
- entry.links << Xommelier::Atom::Link.new(
57
- href: "#{entry.id}/comments.atom",
58
- rel: 'replies',
59
- type: 'application/atom+xml',
60
- count: 5
61
- )
62
- end
63
-
64
- # Add Comments
65
- 3.times do |i|
66
- feed.entries << Xommelier::Atom::Entry.new(
67
- id: "http://example.com/blog/2012/03/05#comment_#{i}",
68
- title: ('Hooray! ' * (i + 1)).strip,
69
- updated: (5 - i).days.ago
70
- ).tap do |comment|
71
- comment.in_reply_to = Xommelier::Atom::Threading::InReplyTo.new(
72
- ref: entry.id,
73
- href: entry.link.href
74
- )
75
- end
76
- end
77
-
78
- puts feed.to_xml
79
- ```
80
-
81
- will output:
82
-
83
- ```xml
84
- <?xml version="1.0" encoding="utf-8"?>
85
- <feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:fh="http://purl.org/syndication/history/1.0">
86
- <id>http://example.com/blog</id>
87
- <title>Example.com blog</title>
88
- <fh:complete/>
89
- <entry>
90
- <id>http://example.com/blog/2012/03/05</id>
91
- <title>Happy Xommelier's day!</title>
92
- <updated>2012-02-29T07:52:51+04:00</updated>
93
- <link href="http://example.com/blog/2012/03/05" rel="alternate" type="text/html"/>
94
- <link href="http://example.com/blog/2012/03/05/comments.atom" rel="replies" type="application/atom+xml" thr:count="5"/>
95
- </entry>
96
- <entry>
97
- <id>http://example.com/blog/2012/03/05#comment_0</id>
98
- <title>Hooray!</title>
99
- <updated>2012-02-29T07:52:51+04:00</updated>
100
- <thr:in-reply-to ref="http://example.com/blog/2012/03/05" href="http://example.com/blog/2012/03/05"/>
101
- </entry>
102
- <entry>
103
- <id>http://example.com/blog/2012/03/05#comment_1</id>
104
- <title>Hooray! Hooray!</title>
105
- <updated>2012-03-01T07:52:51+04:00</updated>
106
- <thr:in-reply-to ref="http://example.com/blog/2012/03/05" href="http://example.com/blog/2012/03/05"/>
107
- </entry>
108
- <entry>
109
- <id>http://example.com/blog/2012/03/05#comment_2</id>
110
- <title>Hooray! Hooray! Hooray!</title>
111
- <updated>2012-03-02T07:52:51+04:00</updated>
112
- <thr:in-reply-to ref="http://example.com/blog/2012/03/05" href="http://example.com/blog/2012/03/05"/>
113
- </entry>
114
- </feed>
115
- ```
116
-
117
- ### Building from hash
118
-
119
- ```ruby
120
- feed = Xommelier::Atom::Feed.new(
121
- {
122
- title: 'Xommelier nest elements',
123
- subtitle: 'Xommelier is able to build complex objects from very nested hash',
124
- author: { name: 'Alexander', email: 'al@semyonov.us' },
125
- updated: Time.utc(2012, 04, 04, 04, 04),
126
- contributors: [
127
- { name: 'Ivan', email: 'ivan@example.com' },
128
- { name: 'Pyotr', email: 'pyotr@example.com' },
129
- { name: 'Sidor', email: 'sidor@example.com' },
130
- ],
131
- entries: [
132
- { title: 'First article', updated: Time.utc(2012, 01, 01, 01, 01) },
133
- { title: 'Second article', updated: Time.utc(2012, 02, 02, 02, 02) },
134
- { title: 'Third article', updated: Time.utc(2012, 03, 03, 03, 03) },
135
- ]
136
- }
137
- )
138
-
139
- Xommelier::Atom::Person === feed.author #=> true
140
- Xommelier::Atom::Person === feed.contributors[1] #=> true
141
- Xommelier::Atom::Entry === feed.entries[2] #=> true
142
-
143
- puts feed.to_xml
144
- ```
145
-
146
- will output
147
-
148
- ```xml
149
- <?xml version="1.0" encoding="utf-8"?>
150
- <feed xmlns="http://www.w3.org/2005/Atom">
151
- <title>Xommelier nest elements</title>
152
- <subtitle>Xommelier is able to build complex objects from very nested hash</subtitle>
153
- <author>
154
- <name>Alexander</name>
155
- <email>al@semyonov.us</email>
156
- </author>
157
- <updated>2012-04-04T04:04:00Z</updated>
158
- <contributor>
159
- <name>Ivan</name>
160
- <email>ivan@example.com</email>
161
- </contributor>
162
- <contributor>
163
- <name>Pyotr</name>
164
- <email>pyotr@example.com</email>
165
- </contributor>
166
- <contributor>
167
- <name>Sidor</name>
168
- <email>sidor@example.com</email>
169
- </contributor>
170
- <entry>
171
- <title>First article</title>
172
- <updated>2012-01-01T01:01:00Z</updated>
173
- </entry>
174
- <entry>
175
- <title>Second article</title>
176
- <updated>2012-02-02T02:02:00Z</updated>
177
- </entry>
178
- <entry>
179
- <title>Third article</title>
180
- <updated>2012-03-03T03:03:00Z</updated>
181
- </entry>
182
- </feed>
183
- ```
20
+ ## Examples
21
+
22
+ See `examples` dir for examples of:
23
+
24
+ * reading an Atom feed;
25
+ * building an Atom feed;
26
+ * building an Atom feed from hash;
184
27
 
185
28
  ## Built in XML namespaces:
186
29
 
@@ -191,6 +34,7 @@ will output
191
34
 
192
35
  ## TODO
193
36
 
37
+ * Rebuild on top of ROM
194
38
  * Validating built XML against RelaxNG
195
39
  * Converting XML Schema, RelaxNG, RelaxNG Compact and DTD into Xommelier Ruby DSL
196
40
  * ActiveRecord-like automatic loading of XML Schema, RelaxNG, RelaxNG Compact and DTD without needing to write it down into ruby code
@@ -200,8 +44,6 @@ will output
200
44
  * Art Semyonov, [@artps](https://github.com/artps)
201
45
  * Sergey Ukustov, [@ukstv](https://github.com/ukstv)
202
46
 
203
- © Alexander Semyonov, 2011-2012. See MIT-LICENSE for details
204
-
47
+ © Alex Semyonov, 2011-2017. See LICENSE for details
205
48
 
206
49
  [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/alsemyonov/xommelier/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
207
-