Class: Bucketface::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/bucketface/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth = {}) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bucketface/client.rb', line 9

def initialize(auth={})
  if auth[:password].nil?
    @login = auth[:login]
    @token = auth[:token]
    self.class.basic_auth(nil, nil)
  else
    @login = auth[:login]
    self.class.basic_auth(@login, auth[:password])
  end
  @@api = self
end

Instance Attribute Details

#loginObject (readonly)

Returns the value of attribute login.



7
8
9
# File 'lib/bucketface/client.rb', line 7

def 
  @login
end

Class Method Details

.apiObject



21
22
23
# File 'lib/bucketface/client.rb', line 21

def self.api
  @@api
end

Instance Method Details

#branches(repo) ⇒ Object



62
63
64
65
# File 'lib/bucketface/client.rb', line 62

def branches(repo)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/branches/")
end

#changeset(repo, changeset) ⇒ Object



87
88
89
90
# File 'lib/bucketface/client.rb', line 87

def changeset(repo, changeset)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/changesets/#{changeset}/")
end

#changesets(repo) ⇒ Object



82
83
84
85
# File 'lib/bucketface/client.rb', line 82

def changesets(repo)
  repo = Repository.new(repo)
  get_resource("/repositories/#{repo.user}/#{repo}/changesets/").changesets
end

#delete_issue(repo, id) ⇒ Object



77
78
79
80
# File 'lib/bucketface/client.rb', line 77

def delete_issue(repo, id)
  repo = Repository.new(repo)
  delete("/repositories/#{repo.user}/#{repo}/issues/#{id}/")
end

#events(login = self.login) ⇒ Object



92
93
94
# File 'lib/bucketface/client.rb', line 92

def events(=self.)
  get("/users/#{}/events/").events
end

#followers(login = self.login) ⇒ Object



29
30
31
# File 'lib/bucketface/client.rb', line 29

def followers(=self.)
  get("/users/#{}/followers/").followers
end

#groups(login = self.login) ⇒ Object



101
102
103
# File 'lib/bucketface/client.rb', line 101

def groups(=self.)
  get("/groups/{login}/")
end

#issue(repo, id) ⇒ Object



48
49
50
51
# File 'lib/bucketface/client.rb', line 48

def issue(repo, id)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/issues/#{id}/")
end

#issue_followers(repo, id) ⇒ Object



38
39
40
41
# File 'lib/bucketface/client.rb', line 38

def issue_followers(repo, id)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/issues/#{id}/followers/").followers
end

#issues(repo) ⇒ Object



43
44
45
46
# File 'lib/bucketface/client.rb', line 43

def issues(repo)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/issues/").issues
end

#list_repos(login = self.login) ⇒ Object



58
59
60
# File 'lib/bucketface/client.rb', line 58

def list_repos(=self.)
  get("/users/#{}/").repositories
end

#open_issue(repo, title, body) ⇒ Object



72
73
74
75
# File 'lib/bucketface/client.rb', line 72

def open_issue(repo, title, body)
  rep = Repository.new(repo)
  post("/repositories/#{rep.user}/#{rep}/issues/", :body => {:title => title, :content => body, :status => 'new'})
end

#repo(repo) ⇒ Object



53
54
55
56
# File 'lib/bucketface/client.rb', line 53

def repo(repo)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/")
end

#repo_events(repo) ⇒ Object



96
97
98
99
# File 'lib/bucketface/client.rb', line 96

def repo_events(repo)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/events/").events
end

#repo_followers(repo) ⇒ Object



33
34
35
36
# File 'lib/bucketface/client.rb', line 33

def repo_followers(repo)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/followers/").followers
end

#tags(repo) ⇒ Object



67
68
69
70
# File 'lib/bucketface/client.rb', line 67

def tags(repo)
  repo = Repository.new(repo)
  get("/repositories/#{repo.user}/#{repo}/tags/")
end

#user(login = self.login) ⇒ Object



25
26
27
# File 'lib/bucketface/client.rb', line 25

def user(=self.)
  get("/users/#{}/").user
end