class Ruboty::Github::Actions::Base
Constants
- NAMESPACE
Attributes
message[R]
Public Class Methods
new(message)
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 11 def initialize(message) @message = message end
Private Instance Methods
access_token()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 37 def access_token @access_token ||= access_tokens[sender_name] end
access_tokens()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 17 def access_tokens message.robot.brain.data[NAMESPACE] ||= {} end
api_endpoint()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 65 def api_endpoint "#{github_base_url}/api/v3" if github_base_url end
body()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 21 def body message[:description] || '' end
client()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 41 def client Octokit::Client.new(client_options) end
client_options()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 49 def client_options client_options_with_nil_value.compact end
client_options_with_nil_value()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 53 def client_options_with_nil_value { access_token: access_token, api_endpoint: api_endpoint, web_endpoint: web_endpoint } end
github_base_url()
click to toggle source
@note GITHUB_HOST will be deprecated on the next major version
# File lib/ruboty/github/actions/base.rb, line 70 def github_base_url if ENV.fetch('GITHUB_BASE_URL', nil) ENV.fetch('GITHUB_BASE_URL', nil) elsif ENV.fetch('GITHUB_HOST', nil) "https://#{ENV.fetch('GITHUB_HOST', nil)}" end end
has_access_token?()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 33 def has_access_token? !!access_token end
repository()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 45 def repository message[:repo] end
require_access_token()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 29 def require_access_token message.reply("I don't know your github access token") end
sender_name()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 25 def sender_name message.from_name end
web_endpoint()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 61 def web_endpoint "#{github_base_url}/" if github_base_url end