Class: CodeUnion::Command::Feedback

Inherits:
Base
  • Object
show all
Defined in:
lib/codeunion/command/feedback.rb

Overview

“View” in Traditional MVC for the Feedback command. Validates Input and Builds response

Constant Summary collapse

CREATE_ACCESS_TOKEN_URL =
"https://help.github.com/articles/creating-an-access-token-for-command-line-use/"

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from CodeUnion::Command::Base

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/codeunion/command/feedback.rb', line 13

def run
  config = Config.load
  token = config.get("github.access_token")
  repository = config.get("feedback.repository")
  if !token
    fail(CodeUnion::Command::MissingConfig, { :name => "github.access_token",
                                              :help => "See: #{CREATE_ACCESS_TOKEN_URL }" })
  elsif !repository
    fail(CodeUnion::Command::MissingConfig, { :name => "feedback.repository" })
  end
  @feedback_request = FeedbackRequest.new(input, token, repository)
  ensure_valid_input!
  @feedback_request.send!
end