Class: Contentful::Bootstrap::CommandRunner
- Inherits:
-
Object
- Object
- Contentful::Bootstrap::CommandRunner
- Defined in:
- lib/contentful/bootstrap/command_runner.rb
Instance Attribute Summary collapse
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #create_space(space_name, options = {}) ⇒ Object
- #generate_json(space_id, options = {}) ⇒ Object
- #generate_token(space, options = {}) ⇒ Object
-
#initialize(config_path = '') ⇒ CommandRunner
constructor
A new instance of CommandRunner.
- #update_space(space_id, options = {}) ⇒ Object
Constructor Details
#initialize(config_path = '') ⇒ CommandRunner
Returns a new instance of CommandRunner.
9 10 11 12 |
# File 'lib/contentful/bootstrap/command_runner.rb', line 9 def initialize(config_path = '') @config_path = config_path @token = Token.new(config_path) end |
Instance Attribute Details
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
7 8 9 |
# File 'lib/contentful/bootstrap/command_runner.rb', line 7 def config_path @config_path end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/contentful/bootstrap/command_runner.rb', line 7 def token @token end |
Instance Method Details
#create_space(space_name, options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/contentful/bootstrap/command_runner.rb', line 14 def create_space(space_name, = {}) Contentful::Bootstrap::Commands::CreateSpace.new( @token, space_name, ).run end |
#generate_json(space_id, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/contentful/bootstrap/command_runner.rb', line 32 def generate_json(space_id, = {}) filename = .fetch(:filename, nil) access_token = .fetch(:access_token, nil) environment = .fetch(:environment, 'master') content_types_only = .fetch(:content_types_only, false) quiet = .fetch(:quiet, false) use_preview = .fetch(:use_preview, false) content_type_ids = .fetch(:content_type_ids, []) raise 'Access Token required' if access_token.nil? Contentful::Bootstrap::Commands::GenerateJson.new( space_id, access_token, environment, filename, content_types_only, quiet, use_preview, content_type_ids ).run end |
#generate_token(space, options = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/contentful/bootstrap/command_runner.rb', line 26 def generate_token(space, = {}) Contentful::Bootstrap::Commands::GenerateToken.new( @token, space, ).run end |
#update_space(space_id, options = {}) ⇒ Object
20 21 22 23 24 |
# File 'lib/contentful/bootstrap/command_runner.rb', line 20 def update_space(space_id, = {}) Contentful::Bootstrap::Commands::UpdateSpace.new( @token, space_id, ).run end |