class Tinybucket::Model::Repository

Repository

@see developer.atlassian.com/bitbucket/api/2/reference/resource/repositories

Repository Endpoint

@!attribute [rw] scm

@return [String]

@!attribute [rw] has_wiki

@return [true, false]

@!attribute [rw] description

@return [String]

@!attribute [rw] links

@return [Hash]

@!attribute [rw] updated_on

@return [String]

@!attribute [rw] fork_policy

@return [String]

@!attribute [rw] created_on

@return [String]

@!attribute [rw] owner

@return [Hash]

@!attribute [rw] size

@return [Fixnum]

@!attribute [rw] parent

@return [Hash, NillClass]

@!attribute [rw] uuid

@return [String]

@!attribute [rw] has_issues

@return [true, false]

@!attribute [rw] is_private

@return [true, false]

@!attribute [rw] full_name

@return [String]

@!attribute [rw] name

@return [String]

@!attribute [rw] language

@return [String]

@!attribute [rw] website

@return [String]

@!attribute [rw] type

@return [String]

@!attribute [rw] project

@return [Hash]

Public Class Methods

new(json) click to toggle source
Calls superclass method Tinybucket::Model::Base::new
# File lib/tinybucket/model/repository.rb, line 57
def initialize(json)
  super(json)

  return unless full_name && full_name.split('/').size == 2
  @repo_owner, @repo_slug = full_name.split('/')
end

Public Instance Methods

branch(branch, options = {}) click to toggle source

Get the specific branch on this repository.

@param branch [String] @param options [Hash] @return [Tinybucket::Model::Branches]

# File lib/tinybucket/model/repository.rb, line 136
def branch(branch, options = {})
  branches_resource.find(branch, options)
end
branch_restriction(restriction_id, options = {}) click to toggle source

Get the specific branch restriction information on this repository.

@param restriction_id [String] @param options [Hash] @return [Tinybucket::Model::BranchRestriction]

# File lib/tinybucket/model/repository.rb, line 153
def branch_restriction(restriction_id, options = {})
  branch_restrictions_resource.find(restriction_id, options)
end
branch_restrictions(options = {}) click to toggle source

Get the branch restriction information associated with this repository.

@param options [Hash] @return [Tinybucket::Resource::BranchRestrictions]

# File lib/tinybucket/model/repository.rb, line 144
def branch_restrictions(options = {})
  branch_restrictions_resource(options)
end
branches(options = {}) click to toggle source

Get branches on this repository

@param options [Hash] @return [Tinybucket::Resource::Branches]

# File lib/tinybucket/model/repository.rb, line 127
def branches(options = {})
  branches_resource(options)
end
commit(revision, options = {}) click to toggle source

Get the specific commit on this repository.

@param revision [String] @param options [Hash] @return [Tinybucket::Model::Commit]

# File lib/tinybucket/model/repository.rb, line 119
def commit(revision, options = {})
  commits_resource.find(revision, options)
end
commits(options = {}) click to toggle source

Get commits on this repository.

@param options [Hash] @return [Tinybucket::Resource::Commits]

# File lib/tinybucket/model/repository.rb, line 110
def commits(options = {})
  commits_resource(options)
end
destroy() click to toggle source

Remove this repository

@todo to be implemented. @raise [NotImplementedError] to be implemented.

# File lib/tinybucket/model/repository.rb, line 68
def destroy
  raise NotImplementedError
end
diff(spec, options = {}) click to toggle source

Get the diff for this repository.

@param spec [String] A specification such as a branch name,

revision, or commit SHA.

@param options [Hash] @return [String] diff as raw text.

# File lib/tinybucket/model/repository.rb, line 163
def diff(spec, options = {})
  diff_api.find(spec, options)
end
forks(options = {}) click to toggle source

Get repository forks.

@param options [Hash] @return [Tinybucket::Resource::Forks]

# File lib/tinybucket/model/repository.rb, line 102
def forks(options = {})
  forks_resource(options)
end
patch(spec, options = {}) click to toggle source

Get the patch for the specification.

@param spec [String] A specification such as a branch name,

revision, or commit SHA.

@return [String] patch as raw text.

# File lib/tinybucket/model/repository.rb, line 172
def patch(spec, options = {})
  diff_api.find_patch(spec, options)
end
pull_request(pullrequest_id, options = {}) click to toggle source

Get the specific pull request on this repository.

@param pullrequest_id [String] @param options [Hash] @return [Tinybucket::Model::PullRequest]

# File lib/tinybucket/model/repository.rb, line 86
def pull_request(pullrequest_id, options = {})
  pull_requests_resource.find(pullrequest_id, options)
end
pull_requests(options = {}) click to toggle source

Get pull requests on thie repository.

@param options [Hash] @return [Tinybucket::Enumerator] an enumerator to enumerate

pull requests as {Tinybucket::Model::PullRequest} instance.
# File lib/tinybucket/model/repository.rb, line 77
def pull_requests(options = {})
  pull_requests_resource(options)
end
watchers(options = {}) click to toggle source

Get watchers on this repository.

@param options [Hash] @return [Tinybucket::Resource::Watchers]

# File lib/tinybucket/model/repository.rb, line 94
def watchers(options = {})
  watchers_resource(options)
end

Private Instance Methods

branch_restrictions_resource(options = {}) click to toggle source
# File lib/tinybucket/model/repository.rb, line 178
def branch_restrictions_resource(options = {})
  Tinybucket::Resource::BranchRestrictions.new(self, options)
end
branches_resource(options = {}) click to toggle source
# File lib/tinybucket/model/repository.rb, line 182
def branches_resource(options = {})
  Tinybucket::Resource::Branches.new(self, options)
end
commits_resource(options = {}) click to toggle source
# File lib/tinybucket/model/repository.rb, line 186
def commits_resource(options = {})
  Tinybucket::Resource::Commits.new(self, options)
end
diff_api() click to toggle source
# File lib/tinybucket/model/repository.rb, line 210
def diff_api
  create_api('Diff', repo_keys)
end
forks_resource(options = {}) click to toggle source
# File lib/tinybucket/model/repository.rb, line 202
def forks_resource(options = {})
  Tinybucket::Resource::Forks.new(self, options)
end
hooks_resource(options = {}) click to toggle source
# File lib/tinybucket/model/repository.rb, line 190
def hooks_resource(options = {})
  Tinybucket::Resource::Hooks.new(self, options)
end
load_model() click to toggle source
# File lib/tinybucket/model/repository.rb, line 214
def load_model
  repo_api.find()
end
pull_requests_resource(options = {}) click to toggle source
# File lib/tinybucket/model/repository.rb, line 194
def pull_requests_resource(options = {})
  Tinybucket::Resource::PullRequests.new(self, options)
end
repo_api() click to toggle source
# File lib/tinybucket/model/repository.rb, line 206
def repo_api
  create_api('Repo', repo_keys)
end
watchers_resource(options = {}) click to toggle source
# File lib/tinybucket/model/repository.rb, line 198
def watchers_resource(options = {})
  Tinybucket::Resource::Watchers.new(self, options)
end