Skip to content

dansch/wp_ruby_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wordpress Ruby API

How to integrate your Wordpress Blog in your Rails App (or any Ruby App)? Enter this simple API Wrapper, which makes use of the excellent JSON plugin for wordpress by Dan Phiffer.

Requirements

Configuration

Somewhere in your app (e.g. in an initializer file in Rails):

WpRubyApi::Base.site = "http://path/to/your/wordpress-blog"

If you have permalinks enabled in wordpress:

WpRubyApi::Base.permalinks = :enabled

This setting translates the request to either blog-path/api/json_method?params or blog-path?json=json-method&params. This is part of the JSON API.

Usage

Start your app or hop into the console. You should be able to use methods like this:

WpRubyApi::Post.all
WpRubyApi::Post.find(3)
WpRubyApi::Post.search("my search term")
WpRubyApi::Post.by_category("my-category")
WpRubyApi::Page.find('about')
WpRubyApi::Comment.create({:name => "John Doe", :email => "[email protected]", :content => "This is a comment!", :post_id => 1}) (requires activation in JSON API)

For more methods and documentation take a look at the code.

Installation

Currently only available as a rails plugin.

TODOs

  • docs

  • tests

  • gemify

Project Info

Thanks to John Nunemaker for creating HTTParty. It’s awesome!

Copyright © 2010 Daniel Schoppmann, released under the MIT license

About

Simple Ruby Wrapper for Wordpress JSON API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages