ratom 0.6.1 → 0.6.2
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.
- data/History.txt +6 -0
- data/README.txt +9 -2
- data/lib/atom/pub.rb +10 -3
- data/lib/atom/version.rb +1 -1
- data/spec/atom/pub_spec.rb +14 -1
- metadata +3 -3
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -138,7 +138,15 @@ required to let us update to the entry. For example, lets change the content an
|
|
138
138
|
published_entry.content = Atom::Content::Html.new("<p>rAtom lets me post to and edit my blog using Ruby, how cool!</p>")
|
139
139
|
published_entry.updated = Time.now
|
140
140
|
published_entry.save!
|
141
|
-
|
141
|
+
|
142
|
+
To update an existing Entry:
|
143
|
+
|
144
|
+
existing_entry = Entry.load_entry(URI.parse("http://example.org/afeedentry.atom"))
|
145
|
+
|
146
|
+
existing_entry.title = "I have discovered rAtom"
|
147
|
+
existing_entry.updated = Time.now
|
148
|
+
existing_entry.save!
|
149
|
+
|
142
150
|
You can also delete an entry using the <tt>destroy!</tt> method, but we won't do that will we?.
|
143
151
|
|
144
152
|
=== Extension elements
|
@@ -260,7 +268,6 @@ As of version 0.5.1 rAtom also support authentication via HMAC request signing u
|
|
260
268
|
|
261
269
|
* Support partial content responses from the server.
|
262
270
|
* Support batching of protocol operations.
|
263
|
-
* Examples of editing existing entries.
|
264
271
|
* All my tests have been against internal systems, I'd really like feedback from those who have tried rAtom using existing blog software that supports APP.
|
265
272
|
* Handle all base uri tests.
|
266
273
|
* Add slug support.
|
data/lib/atom/pub.rb
CHANGED
@@ -60,15 +60,22 @@ module Atom
|
|
60
60
|
class Categories < DelegateClass(Array)
|
61
61
|
include Atom::Xml::Parseable
|
62
62
|
elements :categories, :class => Atom::Category
|
63
|
+
attribute :href, :fixed
|
63
64
|
|
64
65
|
def initialize(o)
|
65
66
|
super([])
|
67
|
+
parse(o, :once => true)
|
66
68
|
o.read
|
67
69
|
parse(o)
|
68
70
|
end
|
69
71
|
|
70
72
|
remove_method :categories
|
71
73
|
def categories; self; end
|
74
|
+
|
75
|
+
# True true if fixed was 'yes' or 'true'
|
76
|
+
def fixed?
|
77
|
+
!self.fixed.nil? && %w(yes true).include?(self.fixed.downcase)
|
78
|
+
end
|
72
79
|
end
|
73
80
|
|
74
81
|
class Workspace
|
@@ -128,7 +135,7 @@ module Atom
|
|
128
135
|
uri = URI.parse(href)
|
129
136
|
response = nil
|
130
137
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
131
|
-
request = Net::HTTP::Post.new(uri.
|
138
|
+
request = Net::HTTP::Post.new(uri.request_uri, headers)
|
132
139
|
if opts[:user] && opts[:pass]
|
133
140
|
request.basic_auth(opts[:user], opts[:pass])
|
134
141
|
elsif opts[:hmac_access_id] && opts[:hmac_secret_key]
|
@@ -179,7 +186,7 @@ module Atom
|
|
179
186
|
uri = URI.parse(edit.href)
|
180
187
|
response = nil
|
181
188
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
182
|
-
request = Net::HTTP::Put.new(uri.
|
189
|
+
request = Net::HTTP::Put.new(uri.request_uri, headers)
|
183
190
|
if opts[:user] && opts[:pass]
|
184
191
|
request.basic_auth(opts[:user], opts[:pass])
|
185
192
|
elsif opts[:hmac_access_id] && opts[:hmac_secret_key]
|
@@ -208,7 +215,7 @@ module Atom
|
|
208
215
|
uri = URI.parse(edit.href)
|
209
216
|
response = nil
|
210
217
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
211
|
-
request = Net::HTTP::Delete.new(uri.
|
218
|
+
request = Net::HTTP::Delete.new(uri.request_uri, {'Accept' => 'application/atom+xml', 'User-Agent' => "rAtom #{Atom::VERSION::STRING}"})
|
212
219
|
if opts[:user] && opts[:pass]
|
213
220
|
request.basic_auth(opts[:user], opts[:pass])
|
214
221
|
elsif opts[:hmac_access_id] && opts[:hmac_secret_key]
|
data/lib/atom/version.rb
CHANGED
data/spec/atom/pub_spec.rb
CHANGED
@@ -32,7 +32,12 @@ shared_examples_for 'parser of spec/app/service.xml' do
|
|
32
32
|
it "should have categories" do
|
33
33
|
@collection1.categories.should_not be_nil
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
|
+
it "should have a href on categories" do
|
37
|
+
@collection1.categories.href.should == "http://example.com/cats/forMain.cats"
|
38
|
+
@collection1.categories.fixed?.should be_false
|
39
|
+
end
|
40
|
+
|
36
41
|
it "should have a title" do
|
37
42
|
@collection1.title.should == 'My Blog Entries'
|
38
43
|
end
|
@@ -88,6 +93,14 @@ shared_examples_for 'parser of spec/app/service.xml' do
|
|
88
93
|
it "should have categories" do
|
89
94
|
@collection3.categories.should_not be_nil
|
90
95
|
end
|
96
|
+
|
97
|
+
it "should have fixed == 'yes' on categories" do
|
98
|
+
@collection3.categories.fixed.should == "yes"
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should have fixed? == true on categories" do
|
102
|
+
@collection3.categories.fixed?.should be_true
|
103
|
+
end
|
91
104
|
end
|
92
105
|
|
93
106
|
describe Atom::Pub do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peerworks
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-06-19 00:00:00 +09:30
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.12.2
|
35
35
|
version:
|
36
36
|
description: Atom Syndication and Publication API
|
37
37
|
email: sean@peerworks.org
|