Started on attachment import

* created Attachment
* created Dump#attachments
* specs
* replaced require with autoload
This commit is contained in:
Marc Remolt
2011-06-05 17:43:30 +02:00
parent 814c7b4ca8
commit 772cfdc25b
8 changed files with 101 additions and 18 deletions

View File

@@ -0,0 +1,27 @@
module Refinery
module WordPress
class Attachment
attr_reader :node
def initialize(node)
@node = node
end
def title
node.xpath("title").text
end
def description
node.xpath("description").text
end
def post_date
DateTime.parse node.xpath("wp:post_date").text
end
def url
node.xpath("wp:attachment_url").text
end
end
end
end

View File

@@ -47,6 +47,12 @@ module Refinery
Category.new(category.text)
end
end
def attachments
doc.xpath("//item[wp:post_type = 'attachment']").collect do |attachment|
Attachment.new(attachment)
end
end
end
end
end