McRecord
McRecord is an ORM for MicroCMS API like ActiveRecord written in Ruby.
https://document.microcms.io/content-api/get-list-contents
Usage
Configure MicroCMS API
Configure MicroCMS to use API.
https://document.microcms.io/manual/create-api
Installation
Create a Gemfile like below, and bundle install
.
gem "mc_record"
Implementation
Create a Ruby source file like below.
require "mc_record"
McRecord::Base.config(
service_domain: "[Domain Name]",
api_key: "[API Key]",
end_point: "[End Point]"
)
class Content < McRecord::Base
end
content = Content.find("[ID]")
puts content.name
content.category = ""
Content.all
Content.where(category: "[Name of Category]")
Supported features
The following methods are supported.
Future Issues.
It looks like Active Record, but doesn't offer the complexities of Active Record::Relation.
For example, it does not support method chaining, lazy loading, etc.