Class: BitBucket::Client::Issues
- Defined in:
- lib/bitbucket_rest_api/client/issues.rb
Defined Under Namespace
Classes: Comments, Components, Milestones
Constant Summary collapse
- VALID_ISSUE_PARAM_NAMES =
%w[ title content component milestone version responsible priority status kind limit start search sort reported_by ].freeze
- VALID_ISSUE_PARAM_VALUES =
{ 'priority' => %w[ trivial minor major critical blocker ], 'status' => ['new', 'open', 'resolved', 'on hold', 'invalid', 'duplicate', 'wontfix'], 'kind' => %w[ bug enhancement proposal task ] }
Constants included from Validations
Constants included from Validations::Token
Validations::Token::TOKEN_REQUIRED, Validations::Token::TOKEN_REQUIRED_REGEXP
Constants included from BitBucket::Constants
BitBucket::Constants::ACCEPT, BitBucket::Constants::ACCEPT_CHARSET, BitBucket::Constants::CACHE_CONTROL, BitBucket::Constants::CONTENT_LENGTH, BitBucket::Constants::CONTENT_TYPE, BitBucket::Constants::DATE, BitBucket::Constants::ETAG, BitBucket::Constants::LOCATION, BitBucket::Constants::META_FIRST, BitBucket::Constants::META_LAST, BitBucket::Constants::META_NEXT, BitBucket::Constants::META_PREV, BitBucket::Constants::META_REL, BitBucket::Constants::PARAM_PAGE, BitBucket::Constants::PARAM_START_PAGE, BitBucket::Constants::QUERY_STR_SEP, BitBucket::Constants::RATELIMIT_LIMIT, BitBucket::Constants::RATELIMIT_REMAINING, BitBucket::Constants::SERVER, BitBucket::Constants::USER_AGENT
Instance Attribute Summary
Attributes inherited from API
Instance Method Summary collapse
-
#create(user_name, repo_name, params = { }) ⇒ Object
Create an issue.
-
#delete(user_name, repo_name, issue_id, params = { }) ⇒ Object
Delete a single issue.
-
#edit(user_name, repo_name, issue_id, params = { }) ⇒ Object
Edit an issue.
-
#get(user_name, repo_name, issue_id, params = { }) ⇒ Object
(also: #find)
Get a single issue.
-
#list_repo(user_name, repo_name, params = { }) ⇒ Object
(also: #list_repository)
List issues for a repository.
Methods inherited from API
#_merge_user_into_params!, #_merge_user_repo_into_params!, #_update_user_repo_params, #api_methods_in, #append_arguments, #arguments, extract_class_name, inherited, #initialize, #method_missing, namespace, #process_basic_auth, #set, #set_api_client, #setup, #with, #yield_or_eval
Methods included from BitBucket::ClassMethods
#configuration, #configure, #require_all
Methods included from Normalizer
Methods included from ParameterFilter
Methods included from Validations::Required
Methods included from Validations::Token
Methods included from Validations::Format
Methods included from Validations::Presence
Methods included from Request::Verbs
#delete_request, #get_request, #options_request, #patch_request, #post_request, #put_request
Methods included from Authorization
#authenticated?, #authentication, #basic_authed?
Constructor Details
This class inherits a constructor from BitBucket::API
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BitBucket::API
Instance Method Details
#create(user_name, repo_name, params = { }) ⇒ Object
Create an issue
Inputs
<tt>:title</tt> - Required string
<tt>:content</tt> - Optional string
<tt>:responsible</tt> - Optional string - Login for the user that this issue should be assigned to.
<tt>:milestone</tt> - Optional number - Milestone to associate this issue with
<tt>:version</tt> - Optional number - Version to associate this issue with
<tt>:component</tt> - Optional number - Component to associate this issue with
<tt>:priority</tt> - Optional string - The priority of this issue
* <tt>trivial</tt>
* <tt>minor</tt>
* <tt>major</tt>
* <tt>critical</tt>
* <tt>blocker</tt>
<tt>:status</tt> - Optional string - The status of this issue
* <tt>new</tt>
* <tt>open</tt>
* <tt>resolved</tt>
* <tt>on hold</tt>
* <tt>invalid</tt>
* <tt>duplicate</tt>
* <tt>wontfix</tt>
<tt>:kind</tt> - Optional string - The kind of issue
* <tt>bug</tt>
* <tt>enhancement</tt>
* <tt>proposal</tt>
* <tt>task</tt>
Examples
bitbucket = BitBucket.new :user => 'user-name', :repo => 'repo-name'
bitbucket.issues.create
"title" => "Found a bug",
"content" => "I'm having a problem with this.",
"responsible" => "octocat",
"milestone" => 1,
"priority" => "blocker"
152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/bitbucket_rest_api/client/issues.rb', line 152 def create(user_name, repo_name, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params _merge_user_into_params!(params) unless params.has_key?('user') filter! VALID_ISSUE_PARAM_NAMES, params assert_required_keys(%w[ title ], params) post_request("/repositories/#{user}/#{repo.downcase}/issues/", params) end |
#delete(user_name, repo_name, issue_id, params = { }) ⇒ Object
104 105 106 107 108 109 110 111 112 |
# File 'lib/bitbucket_rest_api/client/issues.rb', line 104 def delete(user_name, repo_name, issue_id, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of issue_id normalize! params delete_request("/repositories/#{user}/#{repo}/issues/#{issue_id}", params) end |
#edit(user_name, repo_name, issue_id, params = { }) ⇒ Object
Edit an issue
Inputs
<tt>:title</tt> - Required string
<tt>:content</tt> - Optional string
<tt>:responsible</tt> - Optional string - Login for the user that this issue should be assigned to.
<tt>:milestone</tt> - Optional number - Milestone to associate this issue with
<tt>:version</tt> - Optional number - Version to associate this issue with
<tt>:component</tt> - Optional number - Component to associate this issue with
<tt>:priority</tt> - Optional string - The priority of this issue
* <tt>trivial</tt>
* <tt>minor</tt>
* <tt>major</tt>
* <tt>critical</tt>
* <tt>blocker</tt>
<tt>:status</tt> - Optional string - The status of this issue
* <tt>new</tt>
* <tt>open</tt>
* <tt>resolved</tt>
* <tt>on hold</tt>
* <tt>invalid</tt>
* <tt>duplicate</tt>
* <tt>wontfix</tt>
<tt>:kind</tt> - Optional string - The kind of issue
* <tt>bug</tt>
* <tt>enhancement</tt>
* <tt>proposal</tt>
* <tt>task</tt>
Examples
bitbucket = BitBucket.new :user => 'user-name', :repo => 'repo-name'
bitbucket.issues.create
"title" => "Found a bug",
"content" => "I'm having a problem with this.",
"responsible" => "octocat",
"milestone" => 1,
"priority" => "blocker"
202 203 204 205 206 207 208 209 210 211 |
# File 'lib/bitbucket_rest_api/client/issues.rb', line 202 def edit(user_name, repo_name, issue_id, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of issue_id normalize! params filter! VALID_ISSUE_PARAM_NAMES, params put_request("/repositories/#{user}/#{repo.downcase}/issues/#{issue_id}/", params) end |
#get(user_name, repo_name, issue_id, params = { }) ⇒ Object Also known as: find
86 87 88 89 90 91 92 93 94 |
# File 'lib/bitbucket_rest_api/client/issues.rb', line 86 def get(user_name, repo_name, issue_id, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of issue_id normalize! params get_request("/repositories/#{user}/#{repo.downcase}/issues/#{issue_id}", params) end |
#list_repo(user_name, repo_name, params = { }) ⇒ Object Also known as: list_repository
List issues for a repository
Inputs
<tt>:limit</tt> - Optional - Number of issues to retrieve, default 15
<tt>:start</tt> - Optional - Issue offset, default 0
<tt>:search</tt> - Optional - A string to search for
<tt>:sort</tt> - Optional - Sorts the output by any of the metadata fields
<tt>:title</tt> - Optional - Contains a filter operation to restrict the list of issues by the issue title
<tt>:content</tt> - Optional - Contains a filter operation to restrict the list of issues by the issue content
<tt>:version</tt> - Optional - Contains an is or ! ( is not) filter to restrict the list of issues by the version
<tt>:milestone</tt> - Optional - Contains an is or ! ( is not) filter to restrict the list of issues by the milestone
<tt>:component</tt> - Optional - Contains an is or ! ( is not) filter to restrict the list of issues by the component
<tt>:kind</tt> - Optional - Contains an is or ! ( is not) filter to restrict the list of issues by the issue kind
<tt>:status</tt> - Optional - Contains an is or ! ( is not) filter to restrict the list of issues by the issue status
<tt>:responsible</tt> - Optional - Contains an is or ! ( is not) filter to restrict the list of issues by the user responsible
<tt>:reported_by</tt> - Optional - Contains a filter operation to restrict the list of issues by the user that reported the issue
Examples
bitbucket = BitBucket.new :user => 'user-name', :repo => 'repo-name'
bitbucket.issues.list_repo :filter => 'kind=bug&kind=enhancement'
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/bitbucket_rest_api/client/issues.rb', line 65 def list_repo(user_name, repo_name, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params filter! VALID_ISSUE_PARAM_NAMES, params assert_valid_values(VALID_ISSUE_PARAM_VALUES, params) response = get_request("/repositories/#{user}/#{repo.downcase}/issues", params) return response.issues unless block_given? response.issues.each { |el| yield el } end |