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 9 def initialize(message) @message = message end
Private Instance Methods
access_token()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 35 def access_token @access_token ||= access_tokens[sender_name] end
access_tokens()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 15 def access_tokens message.robot.brain.data[NAMESPACE] ||= {} end
api_endpoint()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 63 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 19 def body message[:description] || "" end
client()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 39 def client Octokit::Client.new(client_options) end
client_options()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 47 def client_options client_options_with_nil_value.reject {|key, value| value.nil? } end
client_options_with_nil_value()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 51 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 68 def github_base_url case when ENV["GITHUB_BASE_URL"] ENV["GITHUB_BASE_URL"] when ENV["GITHUB_HOST"] "https://#{ENV['GITHUB_HOST']}" end end
has_access_token?()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 31 def has_access_token? !!access_token end
repository()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 43 def repository message[:repo] end
require_access_token()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 27 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 23 def sender_name message.from_name end
web_endpoint()
click to toggle source
# File lib/ruboty/github/actions/base.rb, line 59 def web_endpoint "#{github_base_url}/" if github_base_url end