Postwave Ruby Client 🌊
A Ruby client for displaying Postwave blogs.
Installation
gem install postwave-client
Usage
Create a Postwave Client
postwave_client = Postwave::Client.new("path/to/config/postwave.yaml")
If you'd like to preload all the posts:
postwave_client = Postwave::Client.new("path/to/config/postwave.yaml", preload: true)
Get a Single Post
Pass in the stub (the filename without '.md') for the post.
post = postwave_client.post("my-great-post")
puts post.title
Get a Collection of Posts
This will give you a list of posts for displaying on a page.
You can also filter by tags and specify offsets and limits (useful for pagination).
posts = postwave_client.posts
tagged_posts = postwave_client.posts(tag: "lizards")
page2_posts = postwave_client.posts(offset: 10, limit: 10)
Posts will be in reverse chronological order.
Get an Index of Posts
This will give you a quick list of post summaries containing the title, date, and stub, useful for building an archive page or quick index of posts.
You can also specify offsets and limits (useful for pagination).
index = postwave_client(index)
puts index.first.stub
page2_index = postwave_client.index(offset: 10, limit: 10)
Index will be in reverse chronological order.
Get Tags Used In the Blog
tags = postwave_client.tags
Get Details For A Tag
tag = postwave_clinet.tag("tag1")
Want To Know More About Postwave?
Check out the Postwave repo.
Development
Run the Tests!
rake test