Class: Contentful::Bootstrap::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/contentful/bootstrap/generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(space_id, access_token) ⇒ Generator

Returns a new instance of Generator.



10
11
12
# File 'lib/contentful/bootstrap/generator.rb', line 10

def initialize(space_id, access_token)
  @client = Contentful::Client.new(access_token: access_token, space: space_id)
end

Instance Method Details

#generate_jsonObject



14
15
16
17
18
19
20
21
# File 'lib/contentful/bootstrap/generator.rb', line 14

def generate_json
  template = {}
  template['version'] = Contentful::Bootstrap.major_version
  template['contentTypes'] = content_types
  template['assets'] = assets
  template['entries'] = entries
  JSON.pretty_generate(template)
end