contentful-labs / cma_import_script

Sample script using the contentful management api to create a space with data.

Home Page:https://www.contentful.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cma_import_script

Script showing usage of the contentful-management gem which is a wrapper for the Content Management API.

Description

This script is a showcase on how you can play with the contentful-management gem in order to load your data to the Contentful platform. The script uses the Open Beer Database, which includes the following domain models:

  • Brewery
  • Beer
  • Category
  • Style

The script loads only a selected sample of the items due to the size of the data (time of execution). You can change the pre-selected set of breweries and beer styles by changing the BREWERIES_IDS and STYLE_IDS constants in the script.

Installation

$ bundle install

Data source setup

Download openbeerdb_csv.zip from Open Beer Database and unzip it into data directory.

Usage

Note that you need to specify your access token and organization id in the script.rb file (ACCESS_TOKEN, ORGANIZATION_ID). Your access token can be found at CMA - documentation

Script execution:

$ ruby script.rb

About

Sample script using the contentful management api to create a space with data.

https://www.contentful.com/

License:MIT License


Languages

Language:Ruby 100.0%