class OpenGithubIssue::Reporter

Attributes

controller[R]
params[R]

Public Class Methods

new(params, controller) click to toggle source
# File lib/open_github_issue/reporter.rb, line 3
def initialize(params, controller)
  @params = params
  @controller = controller
end

Public Instance Methods

call() click to toggle source
# File lib/open_github_issue/reporter.rb, line 8
def call
  GithubIssue.call(title, message)
  true
rescue Octokit::Error
  false
end

Private Instance Methods

body() click to toggle source
# File lib/open_github_issue/reporter.rb, line 35
def body
  params[:body]
end
message() click to toggle source
# File lib/open_github_issue/reporter.rb, line 19
    def message
      message = <<-MESSAGE
        **User**: #{name}
        **Path**: #{path}

        ---

        #{body}
      MESSAGE
      message.strip_heredoc
    end
name() click to toggle source
# File lib/open_github_issue/reporter.rb, line 49
def name
  user_name_method = OpenGithubIssue.configuration.user_name_method
  return '' unless user_name_method
  user.public_send(user_name_method)
end
path() click to toggle source
# File lib/open_github_issue/reporter.rb, line 39
def path
  params[:path]
end
title() click to toggle source
# File lib/open_github_issue/reporter.rb, line 31
def title
  params[:title]
end
user() click to toggle source
# File lib/open_github_issue/reporter.rb, line 43
def user
  user_method = OpenGithubIssue.configuration.user_method
  return unless user_method
  controller.public_send(user_method)
end