Class: Commenter::GitHubSession

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#clientObject (readonly)

Returns the value of attribute client.



11
12
13
# File 'lib/commenter/github_session.rb', line 11

def client
  @client
end

#configObject (readonly)

Returns the value of attribute config.



11
12
13
# File 'lib/commenter/github_session.rb', line 11

def config
  @config
end

#repoObject (readonly)

Returns the value of attribute repo.



11
12
13
# File 'lib/commenter/github_session.rb', line 11

def repo
  @repo
end