Sha256: cd1897adb95dfde2b3ed55c935bb4dc6accffe1d3b9709d91273f04b897edf91

Contents?: true

Size: 956 Bytes

Versions: 63

Compression:

Stored size: 956 Bytes

Contents

require 'pry'

access_token = 'access token'
organization = 'organization id'

require 'contentful/management'

client = Contentful::Management::Client.new(access_token)
space = Contentful::Management::Space.create(name: 'MySpace', organization_id: organization)

p space.content_types

type1 = space.content_types.create(name: 'ContentType 1')

p space.content_types.all

field = Contentful::Management::Field.new
field.id = 'such_content'
field.name = 'Such Content'
field.type = 'Text' # content types maybe as symbol?

type2 = space.content_types.new
type2.name = 'ContentType 2'
type2.fields = [field]
type2.save

field2 = Contentful::Management::Field.new
field2.id = 'wow_content'
field2.name = 'Wow Content'
field2.type = 'Location' # content types maybe as symbol?

type2.update(name: 'whoat', fields: [field, field2])

type2.fields.add(field2)

type2.activate
p type2.active?
type2.deactivate

type1.destroy

# clean up afterwards!
space.destroy

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
contentful-management-3.10.0 examples/content_types.rb
contentful-management-3.9.0 examples/content_types.rb
contentful-management-3.8.0 examples/content_types.rb
contentful-management-3.7.0 examples/content_types.rb
contentful-management-3.6.0 examples/content_types.rb
contentful-management-3.5.0 examples/content_types.rb
contentful-management-3.4.0 examples/content_types.rb
contentful-management-3.3.0 examples/content_types.rb
contentful-management-3.2.0 examples/content_types.rb
contentful-management-3.1.0 examples/content_types.rb
contentful-management-3.0.0 examples/content_types.rb
contentful-management-2.13.1 examples/content_types.rb
contentful-management-2.13.0 examples/content_types.rb
contentful-management-2.12.1 examples/content_types.rb
contentful-management-2.12.0 examples/content_types.rb
contentful-management-2.11.0 examples/content_types.rb
contentful-management-2.10.0 examples/content_types.rb
contentful-management-2.9.1 examples/content_types.rb
contentful-management-2.9.0 examples/content_types.rb
contentful-management-2.8.2 examples/content_types.rb