Class: Bucket::Client
- Inherits:
-
Object
- Object
- Bucket::Client
- Defined in:
- lib/bucket/client.rb
Constant Summary collapse
- GIT_URL =
"[email protected]"
Instance Method Summary collapse
-
#create_repo(name, options = {}) ⇒ Object
Returns the created repository scm url.
-
#initialize(credentials) ⇒ Client
constructor
A new instance of Client.
- #repo_full_name(repo) ⇒ Object
- #repo_url(user, name) ⇒ Object
- #repos_list ⇒ Object
Constructor Details
#initialize(credentials) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/bucket/client.rb', line 5 def initialize(credentials) @connection = BitBucket.new basic_auth: "#{credentials["username"]}:#{credentials["password"]}" end |
Instance Method Details
#create_repo(name, options = {}) ⇒ Object
Returns the created repository scm url
22 23 24 25 26 |
# File 'lib/bucket/client.rb', line 22 def create_repo(name, ={}) = .merge(is_private: ![:public]) @connection.repos.create(.merge(name: name)) end |
#repo_full_name(repo) ⇒ Object
17 18 19 |
# File 'lib/bucket/client.rb', line 17 def repo_full_name(repo) "#{repo[:owner]}/#{repo[:slug]}" end |
#repo_url(user, name) ⇒ Object
13 14 15 |
# File 'lib/bucket/client.rb', line 13 def repo_url(user, name) "#{GIT_URL}:#{user}/#{name}.git" end |
#repos_list ⇒ Object
9 10 11 |
# File 'lib/bucket/client.rb', line 9 def repos_list @connection.repos.list end |