Class: Tinybucket::Client
- Inherits:
-
Object
- Object
- Tinybucket::Client
- Includes:
- Model::Concerns::Enumerable
- Defined in:
- lib/tinybucket/client.rb
Instance Method Summary collapse
-
#repo(owner, repo_slug) ⇒ Tinybucket::Model::Repository
Get the repository.
-
#repos(*args) ⇒ Tinybucket::Resource::Repos
Get Repositories.
-
#team(teamname) ⇒ Tinybucket::Model::Team
Get the team.
-
#teams(role_name, options = {}) ⇒ Tinybucket::Resource::Teams
Get teams.
-
#user(username) ⇒ Tinybucket::Model::Profile
Get the user profile.
Instance Method Details
#repo(owner, repo_slug) ⇒ Tinybucket::Model::Repository
Get the repository
48 49 50 51 52 53 |
# File 'lib/tinybucket/client.rb', line 48 def repo(owner, repo_slug) Tinybucket::Model::Repository.new({}).tap do |m| m.repo_owner = owner m.repo_slug = repo_slug end end |
#repos(owner, options) ⇒ Tinybucket::Resource::Repos #repos(options) ⇒ Tinybucket::Resource::Repos
Get Repositories
when you want to get repositories of the owner, call with owner, options. ex) repos(‘owner’, options) or repos(‘owner’)
when you want to get public repositories of the owner, call with options. ex) repos(options) or repos
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/tinybucket/client.rb', line 23 def repos(*args) case args.size when 0 public_repos when 1 case args.first when Hash then public_repos(args.first) when String, Symbol then owners_repos(args.first) else raise ArgumentError end when 2 case args.first when String, Symbol then owners_repos(args[0], args[1]) else raise ArgumentError end else raise ArgumentError end end |
#team(teamname) ⇒ Tinybucket::Model::Team
Get the team
68 69 70 71 72 |
# File 'lib/tinybucket/client.rb', line 68 def team(teamname) Tinybucket::Model::Team.new({}).tap do |m| m.username = teamname end end |
#teams(role_name, options = {}) ⇒ Tinybucket::Resource::Teams
Get teams
60 61 62 |
# File 'lib/tinybucket/client.rb', line 60 def teams(role_name, = {}) Tinybucket::Resource::Teams.new(role_name, ) end |
#user(username) ⇒ Tinybucket::Model::Profile
Get the user profile
78 79 80 81 82 |
# File 'lib/tinybucket/client.rb', line 78 def user(username) Tinybucket::Model::Profile.new({}).tap do |m| m.username = username end end |