Sha256: cf6508a4276c147defa67f8d4e0f1c0874d72dba09daf423251e7b93acaa9950
Contents?: true
Size: 892 Bytes
Versions: 3
Compression:
Stored size: 892 Bytes
Contents
require 'htmlentities' module WP::API class Post < Resource def title _remove_entities(super) end def content _remove_entities(super) end def categories terms['category'].collect {|cat| WP::API::Category.new(cat) } end def prev item = link_header_items.find {|rel, url| rel == "prev" } item.last if item end def next item = link_header_items.find {|rel, url| rel == "next" } item.last if item end def items items = link_header_items.select {|rel, url| rel == "item" } items.empty? ? [] : items.collect(&:last) end private def link_header_items @link_header_items ||= headers['link'].split(', ').collect do |header| [ header.match(/rel="([^"]+)"/)[1], header.match(/<([^>]+)>/)[1] ] end rescue [] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wp-api-0.1.2 | lib/wp/api/resources/post.rb |
wp-api-0.1.1 | lib/wp/api/resources/post.rb |
wp-api-0.0.4 | lib/wp/api/resources/post.rb |