Query your contentful data very easily. This gem is a wrapper for Ruby Contenful Gem project.
Follow these steps for setup the gem.
### Initializer Run this generator to copy the initializer on your project:
$ rails generate kelisto_contentful:initializerthen review the copied file to configure your keys and spaces:
KelistoContentful.connect! access_token: "YOUR_ACCESS_TOKEN",
space: "YOUR_SPACE_ID"Access to any of your content types (defined on your space) with it's name. For example, if your content type is 'Product Details' your may access to that content_type as
KelistoContentful.product_detailsYou can also list your content types by
KelistoContentful.content_typesTo query and order entries from your content types you can use:
whereto query any symbol field defined on the content_typeorder_byto order by a field name
Then use run! to execute the query.
For example, let's say we want all the product details about 'CocaCola' cans ordered by release year.
KelistoContentful.product_details.where(name: 'CocaCola', type: 'can').order_by('year').run!This project uses MIT-LICENSE.