Class: Bucket::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bucket/client.rb

Constant Summary collapse

GIT_URL =
"[email protected]"

Instance Method Summary collapse

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, options={})
  options = options.merge(is_private: !options[:public])

  @connection.repos.create(options.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_listObject



9
10
11
# File 'lib/bucket/client.rb', line 9

def repos_list
  @connection.repos.list
end