Sha256: f700f1ccbd4452091a33e0d0e1ad109224247e0a3537449e137c304cd5b58d80

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

MicroCMS.service_domain = ENV.fetch('YOUR_DOMAIN', nil)
MicroCMS.api_key = ENV.fetch('YOUR_API_KEY', nil)

endpoint = ENV.fetch('YOUR_ENDPOINT', nil)

puts MicroCMS.list(endpoint)

puts MicroCMS.list(endpoint, {
                     limit: 100,
                     offset: 1,
                     orders: ['updatedAt'],
                     q: 'Hello',
                     fields: %w[id title],
                     filters: 'publishedAt[greater_than]2021-01-01'
                   })

puts MicroCMS.get(endpoint, 'ruby')

puts MicroCMS.get(endpoint, 'ruby', { draft_key: 'abcdef1234' })

puts MicroCMS.create(endpoint, { text: 'Hello, microcms-ruby-sdk!' })

puts MicroCMS.create(endpoint, { id: 'microcms-ruby-sdk', text: 'Hello, microcms-ruby-sdk!' })

puts MicroCMS.create(endpoint, { text: 'Hello, microcms-ruby-sdk!' }, { status: 'draft' })

puts MicroCMS.update(endpoint, { id: 'microcms-ruby-sdk', text: 'Hello, microcms-ruby-sdk update method!' })

MicroCMS.delete(endpoint, 'microcms-ruby-sdk')

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
microcms-ruby-sdk-1.2.0 examples/examples.rb
microcms-ruby-sdk-1.1.0 examples/examples.rb