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

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



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

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

#nextObject



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

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

#prevObject



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

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

#titleObject



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

def title
  _remove_entities(super)
end