Class: Adocsite::WpPost
- Inherits:
-
Object
- Object
- Adocsite::WpPost
- Defined in:
- lib/adocsite/wp/post.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#excerpt ⇒ Object
readonly
Returns the value of attribute excerpt.
-
#img_srcs ⇒ Object
readonly
Returns the value of attribute img_srcs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#post_media ⇒ Object
readonly
Returns the value of attribute post_media.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize ⇒ WpPost
constructor
A new instance of WpPost.
- #process(article_name) ⇒ Object
- #process_by_title(article_title) ⇒ Object
Constructor Details
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
3 4 5 |
# File 'lib/adocsite/wp/post.rb', line 3 def categories @categories end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
3 4 5 |
# File 'lib/adocsite/wp/post.rb', line 3 def content @content end |
#excerpt ⇒ Object (readonly)
Returns the value of attribute excerpt.
3 4 5 |
# File 'lib/adocsite/wp/post.rb', line 3 def excerpt @excerpt end |
#img_srcs ⇒ Object (readonly)
Returns the value of attribute img_srcs.
3 4 5 |
# File 'lib/adocsite/wp/post.rb', line 3 def img_srcs @img_srcs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/adocsite/wp/post.rb', line 3 def name @name end |
#post_media ⇒ Object (readonly)
Returns the value of attribute post_media.
3 4 5 |
# File 'lib/adocsite/wp/post.rb', line 3 def post_media @post_media end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/adocsite/wp/post.rb', line 3 def title @title end |
Instance Method Details
#process(article_name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/adocsite/wp/post.rb', line 16 def process(article_name) @name = article_name context = Adocsite::Context::new(@engine, Adocsite::Request.new('article', @name)) article = context.get_article if article.nil? abort "Can't find article." end @categories = article.categories @content = article.content @title = article.title @excerpt = article.abstract collect_images create_post upload_post_media replace_images(@post_media) update_post end |
#process_by_title(article_title) ⇒ Object
11 12 13 14 |
# File 'lib/adocsite/wp/post.rb', line 11 def process_by_title(article_title) article_name = Adocsite::Content::title_to_name(article_title) process(article_name) end |