Class: Geet::Github::RemoteRepository
- Inherits:
-
Object
- Object
- Geet::Github::RemoteRepository
- Defined in:
- lib/geet/github/remote_repository.rb
Overview
A remote repository. Currently only provides the parent path.
It’s a difficult choice whether to independently use the repository path, or relying on the one stored in the ApiInterface. The former design is conceptually cleaner, but it practically (as of the current design) introduces duplication. All in all, for simplicity, the latter design is chosen, but is subject to redesign.
Instance Attribute Summary collapse
-
#parent_path ⇒ Object
readonly
Nil if the repository is not a fork.
Class Method Summary collapse
-
.find(api_interface) ⇒ Object
Get the repository parent path.
Instance Method Summary collapse
-
#initialize(api_interface, parent_path: nil) ⇒ RemoteRepository
constructor
A new instance of RemoteRepository.
Constructor Details
#initialize(api_interface, parent_path: nil) ⇒ RemoteRepository
Returns a new instance of RemoteRepository.
17 18 19 20 |
# File 'lib/geet/github/remote_repository.rb', line 17 def initialize(api_interface, parent_path: nil) @api_interface = api_interface @parent_path = parent_path end |
Instance Attribute Details
#parent_path ⇒ Object (readonly)
Nil if the repository is not a fork.
15 16 17 |
# File 'lib/geet/github/remote_repository.rb', line 15 def parent_path @parent_path end |
Class Method Details
.find(api_interface) ⇒ Object
Get the repository parent path.
26 27 28 29 30 31 32 33 34 |
# File 'lib/geet/github/remote_repository.rb', line 26 def self.find(api_interface) api_path = "/repos/#{api_interface.repository_path}" response = api_interface.send_request(api_path) parent_path = response['parent']&.fetch("full_name") self.new(api_interface, parent_path: parent_path) end |