Sha256: 422bacf452ce293e94f55f9f8d0f438d2f725d3a7f554693debd48a5e0967c3b
Contents?: true
Size: 977 Bytes
Versions: 4
Compression:
Stored size: 977 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 tags terms['post_tag'].collect {|cat| WP::API::Tag.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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
wp-api-0.1.6 | lib/wp/api/resources/post.rb |
wp-api-0.1.5 | lib/wp/api/resources/post.rb |
wp-api-0.1.4 | lib/wp/api/resources/post.rb |
wp-api-0.1.3 | lib/wp/api/resources/post.rb |