Class: Contentful::Bootstrap::Commands::CreateSpace
- Defined in:
- lib/contentful/bootstrap/commands/create_space.rb
Instance Attribute Summary collapse
-
#json_template ⇒ Object
readonly
Returns the value of attribute json_template.
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(token, space_name, template_name = nil, json_template = nil, mark_processed = false, trigger_oauth = true) ⇒ CreateSpace
constructor
A new instance of CreateSpace.
- #run ⇒ Object
Methods included from Support
Constructor Details
#initialize(token, space_name, template_name = nil, json_template = nil, mark_processed = false, trigger_oauth = true) ⇒ CreateSpace
Returns a new instance of CreateSpace.
12 13 14 15 16 17 18 19 |
# File 'lib/contentful/bootstrap/commands/create_space.rb', line 12 def initialize( token, space_name, template_name = nil, json_template = nil, mark_processed = false, trigger_oauth = true) super(token, space_name, trigger_oauth) @template_name = template_name @json_template = json_template @mark_processed = mark_processed end |
Instance Attribute Details
#json_template ⇒ Object (readonly)
Returns the value of attribute json_template.
11 12 13 |
# File 'lib/contentful/bootstrap/commands/create_space.rb', line 11 def json_template @json_template end |
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
11 12 13 |
# File 'lib/contentful/bootstrap/commands/create_space.rb', line 11 def template_name @template_name end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/contentful/bootstrap/commands/create_space.rb', line 21 def run puts "Creating Space '#{@space}'" new_space = fetch_space puts "Space '#{@space}' created!" puts create_template(new_space) unless @template_name.nil? create_json_template(new_space) unless @json_template.nil? access_token = generate_token(new_space) puts puts "Space ID: '#{new_space.id}'" puts "Access Token: '#{access_token}'" puts puts 'You can now insert those values into your configuration blocks' puts "Manage your content at https://app.contentful.com/spaces/#{new_space.id}" new_space end |