Class: WP::API::Post

Inherits:
Resource show all
Defined in:
lib/wp/api/resources/post.rb

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #headers

Instance Method Summary collapse

Methods inherited from Resource

#id, #initialize, #meta

Constructor Details

This class inherits a constructor from WP::API::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class WP::API::Resource

Instance Method Details

#categoriesObject



13
14
15
# File 'lib/wp/api/resources/post.rb', line 13

def categories
  terms['category'].collect {|cat| WP::API::Category.new(cat) }
end

#contentObject



9
10
11
# File 'lib/wp/api/resources/post.rb', line 9

def content
  _remove_entities(super)
end

#itemsObject



31
32
33
34
# File 'lib/wp/api/resources/post.rb', line 31

def items
  items = link_header_items.select {|rel, url| rel == "item" }
  items.empty? ? [] : items.collect(&:last)
end

#nextObject



26
27
28
29
# File 'lib/wp/api/resources/post.rb', line 26

def next
  item = link_header_items.find {|rel, url| rel == "next" }
  item.last if item
end

#prevObject



21
22
23
24
# File 'lib/wp/api/resources/post.rb', line 21

def prev
  item = link_header_items.find {|rel, url| rel == "prev" }
  item.last if item
end

#tagsObject



17
18
19
# File 'lib/wp/api/resources/post.rb', line 17

def tags
  terms['post_tag'].collect {|cat| WP::API::Tag.new(cat) }
end

#titleObject



5
6
7
# File 'lib/wp/api/resources/post.rb', line 5

def title
  _remove_entities(super)
end