Class: Ace::Git::Providers::Base
- Inherits:
-
Object
- Object
- Ace::Git::Providers::Base
- Defined in:
- lib/ace/git/providers/base.rb
Overview
Abstract provider contract implemented by provider packages.
The core defines the interface and the normalized evidence types; implementations own all provider CLI invocation, output parsing, and authentication verification. The core itself never executes a provider CLI and never parses provider output.
Subclasses receive the resolved server identity and may accept two optional constructor keywords (see for):
- timeout: operation timeout in seconds
- runner: injectable command runner for tests; a callable receiving keyword arguments (args:, timeout:, env:) and returning a Hash with :stdout, :stderr, :exit_code
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#authenticated? ⇒ Boolean
True when the provider CLI is authenticated.
-
#available? ⇒ Boolean
True when the provider CLI binary is installed.
- #check_authenticated! ⇒ Object
- #check_available! ⇒ Object
-
#checks(ref:) ⇒ Array<ProviderCheck>
Fetch check/CI status evidence for a reference.
-
#initialize(server:, timeout: nil, runner: nil) ⇒ Base
constructor
A new instance of Base.
-
#issue(number:) ⇒ ProviderIssue
Fetch one issue.
-
#pull_request(number:) ⇒ ProviderPullRequest
Fetch one pull request.
-
#pull_request_diff(number:) ⇒ String
Fetch the full diff of one pull request.
-
#pull_request_for_branch(branch:) ⇒ ProviderPullRequest?
Find the pull request associated with a branch.
-
#recent_pull_requests(limit:) ⇒ Array<ProviderPullRequest>
List recent pull requests across states (newest first).
-
#repository ⇒ ProviderRepository
Fetch repository metadata for the resolved server.
Constructor Details
#initialize(server:, timeout: nil, runner: nil) ⇒ Base
Returns a new instance of Base.
25 26 27 28 29 |
# File 'lib/ace/git/providers/base.rb', line 25 def initialize(server:, timeout: nil, runner: nil) @server = server @timeout = timeout || Ace::Git.network_timeout @runner = runner end |
Instance Attribute Details
#server ⇒ Object (readonly)
Returns the value of attribute server.
20 21 22 |
# File 'lib/ace/git/providers/base.rb', line 20 def server @server end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
20 21 22 |
# File 'lib/ace/git/providers/base.rb', line 20 def timeout @timeout end |
Instance Method Details
#authenticated? ⇒ Boolean
Returns true when the provider CLI is authenticated.
42 43 44 |
# File 'lib/ace/git/providers/base.rb', line 42 def authenticated? raise NotImplementedError, "Providers must implement #{self.class}#authenticated?" end |
#available? ⇒ Boolean
Returns true when the provider CLI binary is installed.
32 33 34 |
# File 'lib/ace/git/providers/base.rb', line 32 def available? raise NotImplementedError, "Providers must implement #{self.class}#available?" end |
#check_authenticated! ⇒ Object
47 48 49 |
# File 'lib/ace/git/providers/base.rb', line 47 def check_authenticated! raise NotImplementedError, "Providers must implement #{self.class}#check_authenticated!" end |
#check_available! ⇒ Object
37 38 39 |
# File 'lib/ace/git/providers/base.rb', line 37 def check_available! raise NotImplementedError, "Providers must implement #{self.class}#check_available!" end |
#checks(ref:) ⇒ Array<ProviderCheck>
Fetch check/CI status evidence for a reference.
96 97 98 |
# File 'lib/ace/git/providers/base.rb', line 96 def checks(ref:) raise NotImplementedError, "Providers must implement #{self.class}#checks" end |
#issue(number:) ⇒ ProviderIssue
Fetch one issue.
88 89 90 |
# File 'lib/ace/git/providers/base.rb', line 88 def issue(number:) raise NotImplementedError, "Providers must implement #{self.class}#issue" end |
#pull_request(number:) ⇒ ProviderPullRequest
Fetch one pull request.
55 56 57 |
# File 'lib/ace/git/providers/base.rb', line 55 def pull_request(number:) raise NotImplementedError, "Providers must implement #{self.class}#pull_request" end |
#pull_request_diff(number:) ⇒ String
Fetch the full diff of one pull request.
72 73 74 |
# File 'lib/ace/git/providers/base.rb', line 72 def pull_request_diff(number:) raise NotImplementedError, "Providers must implement #{self.class}#pull_request_diff" end |
#pull_request_for_branch(branch:) ⇒ ProviderPullRequest?
Find the pull request associated with a branch.
64 65 66 |
# File 'lib/ace/git/providers/base.rb', line 64 def pull_request_for_branch(branch:) raise NotImplementedError, "Providers must implement #{self.class}#pull_request_for_branch" end |
#recent_pull_requests(limit:) ⇒ Array<ProviderPullRequest>
List recent pull requests across states (newest first).
80 81 82 |
# File 'lib/ace/git/providers/base.rb', line 80 def recent_pull_requests(limit:) raise NotImplementedError, "Providers must implement #{self.class}#recent_pull_requests" end |
#repository ⇒ ProviderRepository
Fetch repository metadata for the resolved server.
103 104 105 |
# File 'lib/ace/git/providers/base.rb', line 103 def repository raise NotImplementedError, "Providers must implement #{self.class}#repository" end |