class Ellen::Github::Actions::Base
Constants
- NAMESPACE
Attributes
message[R]
Public Class Methods
new(message)
click to toggle source
# File lib/ellen/github/actions/base.rb, line 9 def initialize(message) @message = message end
Private Instance Methods
access_token()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 31 def access_token @access_token ||= access_tokens[sender_name] end
access_tokens()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 15 def access_tokens message.robot.brain.data[NAMESPACE] ||= {} end
api_endpoint()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 59 def api_endpoint "https://#{github_host}/api/v3" if github_host end
client()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 35 def client Octokit::Client.new(client_options) end
client_options()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 43 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/ellen/github/actions/base.rb, line 47 def client_options_with_nil_value { access_token: access_token, api_endpoint: api_endpoint, web_endpoint: web_endpoint, } end
github_host()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 63 def github_host ENV["GITHUB_HOST"] end
has_access_token?()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 27 def has_access_token? !!access_token end
repository()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 39 def repository message[:repo] end
require_access_token()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 23 def require_access_token message.reply("I don't know your github access token") end
sender_name()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 19 def sender_name message.from_name end
web_endpoint()
click to toggle source
# File lib/ellen/github/actions/base.rb, line 55 def web_endpoint "https://#{github_host}/" if github_host end