Wordpress V2 API wrapper
Ruby gem to consume wordpress REST API V2: http://v2.wp-api.org/
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>')