Class: Contentful::Bootstrap::Templates::Base

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

Direct Known Subclasses

Blog, Catalogue, Gallery, JsonTemplate

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(space) ⇒ Base

Returns a new instance of Base.



11
12
13
# File 'lib/contentful/bootstrap/templates/base.rb', line 11

def initialize(space)
  @space = space
end

Instance Attribute Details

#spaceObject (readonly)

Returns the value of attribute space.



9
10
11
# File 'lib/contentful/bootstrap/templates/base.rb', line 9

def space
  @space
end

Instance Method Details

#assetsObject



38
39
40
# File 'lib/contentful/bootstrap/templates/base.rb', line 38

def assets
  []
end

#content_typesObject



30
31
32
# File 'lib/contentful/bootstrap/templates/base.rb', line 30

def content_types
  []
end

#entriesObject



34
35
36
# File 'lib/contentful/bootstrap/templates/base.rb', line 34

def entries
  {}
end

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/contentful/bootstrap/templates/base.rb', line 15

def run
  begin
    create_content_types
    create_assets
    create_entries
  rescue Contentful::Management::Error => e
    error = e.error
    puts "Error at: #{error[:url]}"
    puts "Message: #{error[:message]}"
    puts "Details: #{error[:details]}"

    raise e
  end
end