class WordpressClient::Post
Represents a post in Wordpress.
@see v2.wp-api.org/reference/posts/ API documentation for Post
Attributes
categories[RW]
category_ids[RW]
content_html[RW]
date[RW]
excerpt_html[RW]
featured_media[RW]
featured_media_id[RW]
guid[RW]
id[RW]
meta[RW]
slug[RW]
status[RW]
tag_ids[RW]
title_html[RW]
updated_at[RW]
url[RW]
Public Class Methods
new( id: nil, slug: nil, url: nil, guid: nil, status: "unknown", title_html: nil, excerpt_html: nil, content_html: nil, updated_at: nil, date: nil, categories: [], tags: [], category_ids: [], tag_ids: [], featured_media: nil, meta: {} )
click to toggle source
Construct a new instance with the given attributes.
# File lib/wordpress_client/post.rb, line 70 def initialize( id: nil, slug: nil, url: nil, guid: nil, status: "unknown", title_html: nil, excerpt_html: nil, content_html: nil, updated_at: nil, date: nil, categories: [], tags: [], category_ids: [], tag_ids: [], featured_media: nil, meta: {} ) @id = id @slug = slug @url = url @guid = guid @status = status @title_html = title_html @excerpt_html = excerpt_html @content_html = content_html @updated_at = updated_at @date = date @categories = categories @tags = tags @category_ids = category_ids @tag_ids = tag_ids @featured_media = featured_media @meta = meta end
parse(data)
click to toggle source
@api private
# File lib/wordpress_client/post.rb, line 65 def self.parse(data) PostParser.parse(data) end
Public Instance Methods
featured_image()
click to toggle source
Returns the featured media, if the featured media is an image.
# File lib/wordpress_client/post.rb, line 107 def featured_image if featured_media featured_media.as_image end end