Sha256: 526cad236dd4b382793770c760ae56ccf67340bd9b17c3911e5d9150a61e0584

Contents?: true

Size: 357 Bytes

Versions: 1

Compression:

Stored size: 357 Bytes

Contents

module WP::API
  module Endpoints

    def posts(query = {})
      posts, headers = get("posts", query)
      posts.collect do |hash|
        WP::API::Post.new(hash, headers)
      end
    end

    def post(id, query = {})
      WP::API::Post.new *get("posts/#{id}", query)
    end

    def post_named(slug)
      posts(name: slug).first
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wp-api-0.1.1 lib/wp/api/endpoints.rb