Class: Contentful::Exporter::Wordpress::Post

Inherits:
Blog
  • Object
show all
Defined in:
lib/wordpress/post.rb

Direct Known Subclasses

PostAttachment, PostAuthor, PostCategoryDomain

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Blog

#blog_extractor, #create_directory, #link_asset, #link_entry, #output_logger, #write_json_to_file

Constructor Details

#initialize(xml, settings) ⇒ Post

Returns a new instance of Post.



9
10
11
12
# File 'lib/wordpress/post.rb', line 9

def initialize(xml, settings)
  @xml = xml
  @settings = settings
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



7
8
9
# File 'lib/wordpress/post.rb', line 7

def settings
  @settings
end

#xmlObject (readonly)

Returns the value of attribute xml.



7
8
9
# File 'lib/wordpress/post.rb', line 7

def xml
  @xml
end

Instance Method Details

#post_extractorObject



14
15
16
17
18
# File 'lib/wordpress/post.rb', line 14

def post_extractor
  output_logger.info 'Extracting posts...'
  create_directory("#{settings.entries_dir}/post")
  extract_posts
end

#post_id(post) ⇒ Object



20
21
22
# File 'lib/wordpress/post.rb', line 20

def post_id(post)
  "post_#{post.xpath('wp:post_id').text}"
end