Class: Commenter::GitHubSession
- Inherits:
-
Object
- Object
- Commenter::GitHubSession
- Defined in:
- lib/commenter/github_session.rb
Overview
Shared connection setup for the GitHub integration commands: loads the configuration file, builds the Octokit client, and resolves the target repository. One constructor, one test surface.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(config_path) ⇒ GitHubSession
constructor
A new instance of GitHubSession.
Constructor Details
#initialize(config_path) ⇒ GitHubSession
Returns a new instance of GitHubSession.
13 14 15 16 17 18 |
# File 'lib/commenter/github_session.rb', line 13 def initialize(config_path) @config = load_config(config_path) @client = Octokit::Client.new(access_token: required_token) @repo = @config.dig("github", "repository") raise "GitHub repository not specified in config" unless @repo end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
11 12 13 |
# File 'lib/commenter/github_session.rb', line 11 def client @client end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/commenter/github_session.rb', line 11 def config @config end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
11 12 13 |
# File 'lib/commenter/github_session.rb', line 11 def repo @repo end |