Class: Contentful::Bootstrap::Generator
- Inherits:
-
Object
- Object
- Contentful::Bootstrap::Generator
- Defined in:
- lib/contentful/bootstrap/generator.rb
Instance Attribute Summary collapse
-
#content_types_only ⇒ Object
readonly
Returns the value of attribute content_types_only.
Instance Method Summary collapse
- #generate_json ⇒ Object
-
#initialize(space_id, access_token, content_types_only) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(space_id, access_token, content_types_only) ⇒ Generator
Returns a new instance of Generator.
12 13 14 15 |
# File 'lib/contentful/bootstrap/generator.rb', line 12 def initialize(space_id, access_token, content_types_only) @client = Contentful::Client.new(access_token: access_token, space: space_id) @content_types_only = content_types_only end |
Instance Attribute Details
#content_types_only ⇒ Object (readonly)
Returns the value of attribute content_types_only.
10 11 12 |
# File 'lib/contentful/bootstrap/generator.rb', line 10 def content_types_only @content_types_only end |
Instance Method Details
#generate_json ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/contentful/bootstrap/generator.rb', line 17 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 |