No commit activity in last 3 years
No release in over 3 years
This gem encapsulates request to WP V2 API to consume and manage wordpress content in ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.13.7, ~> 0.13
 Project Readme

Wordpress V2 API wrapper

Ruby gem to consume wordpress REST API V2: http://v2.wp-api.org/

Gem Version Code Climate Test Coverage Issue Count

Requirements

  • httparty >= 0.13.7, ~> 0.13

Configuration

config = WpApi::Configuration.new
config.base_uri = <your_site_base_uri>
config.options  = {
  http_proxyaddr: <your_proxy_address>,
  http_proxyport: <your_proxy_port>
}
WpApi.configuration = config

API Reference

http://v2.wp-api.org/reference/

Examples

Retrieve all posts

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/posts')

Paginate posts

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/posts', {query:{page:1, per_page: 10}})

Retrieve specific post

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/posts/<post_id>')

Retrieve all categories

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/categories')

Paginate categories

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/categories', {query:{page:1, per_page: 10}})

Retrieve specific category

WpApi::Content::Entity.get_entities('/wp-json/wp/v2/categories/<category_id>')