Class: Geet::Github::Repository
- Inherits:
-
Object
- Object
- Geet::Github::Repository
- Extended by:
- T::Sig
- Defined in:
- lib/geet/github/repository.rb
Instance Attribute Summary collapse
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#html_url ⇒ Object
readonly
Returns the value of attribute html_url.
-
#ssh_url ⇒ Object
readonly
Returns the value of attribute ssh_url.
Class Method Summary collapse
- .create(name, visibility, api_interface) ⇒ Object
- .fetch(path, api_interface) ⇒ Object
- .fork(upstream_path, name, api_interface) ⇒ Object
Instance Method Summary collapse
-
#initialize(response, api_interface) ⇒ Repository
constructor
A new instance of Repository.
- #update_default_branch(branch) ⇒ Object
Constructor Details
#initialize(response, api_interface) ⇒ Repository
Returns a new instance of Repository.
59 60 61 62 63 64 |
# File 'lib/geet/github/repository.rb', line 59 def initialize(response, api_interface) @full_name = T.let(T.cast(response.fetch("full_name"), String), String) @html_url = T.let(T.cast(response.fetch("html_url"), String), String) @ssh_url = T.let(T.cast(response.fetch("ssh_url"), String), String) @api_interface = T.let(api_interface, Geet::Github::ApiInterface) end |
Instance Attribute Details
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
10 11 12 |
# File 'lib/geet/github/repository.rb', line 10 def full_name @full_name end |
#html_url ⇒ Object (readonly)
Returns the value of attribute html_url.
13 14 15 |
# File 'lib/geet/github/repository.rb', line 13 def html_url @html_url end |
#ssh_url ⇒ Object (readonly)
Returns the value of attribute ssh_url.
16 17 18 |
# File 'lib/geet/github/repository.rb', line 16 def ssh_url @ssh_url end |
Class Method Details
.create(name, visibility, api_interface) ⇒ Object
25 26 27 28 |
# File 'lib/geet/github/repository.rb', line 25 def self.create(name, visibility, api_interface) response = api_interface.send_request("/user/repos", data: {name:, private: visibility == "private"}) from_response(response, api_interface) end |
.fetch(path, api_interface) ⇒ Object
48 49 50 51 |
# File 'lib/geet/github/repository.rb', line 48 def self.fetch(path, api_interface) response = api_interface.send_request("/repos/#{path}") from_response(response, api_interface) end |
.fork(upstream_path, name, api_interface) ⇒ Object
37 38 39 40 |
# File 'lib/geet/github/repository.rb', line 37 def self.fork(upstream_path, name, api_interface) response = api_interface.send_request("/repos/#{upstream_path}/forks", data: {name:}) from_response(response, api_interface) end |
Instance Method Details
#update_default_branch(branch) ⇒ Object
67 68 69 |
# File 'lib/geet/github/repository.rb', line 67 def update_default_branch(branch) @api_interface.send_request("/repos/#{@full_name}", data: {default_branch: branch}, http_method: :patch) end |