Class: BitBucket::Issues::Comments
- Defined in:
- lib/bitbucket_rest_api/issues/comments.rb
Constant Summary collapse
- VALID_ISSUE_COMMENT_PARAM_NAME =
%w[ content ].freeze
Constants included from Validations
Constants included from Validations::Token
Validations::Token::TOKEN_REQUIRED, Validations::Token::TOKEN_REQUIRED_REGEXP
Constants included from Request
Request::METHODS, Request::METHODS_WITH_BODIES
Constants included from Connection
Constants included from Constants
Constants::ACCEPT, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::QUERY_STR_SEP, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::SERVER, Constants::USER_AGENT
Instance Method Summary collapse
-
#create(user_name, repo_name, issue_id, params = {}) ⇒ Object
Create a comment.
-
#delete(user_name, repo_name, comment_id, params = {}) ⇒ Object
Delete a comment.
-
#edit(user_name, repo_name, comment_id, params = {}) ⇒ Object
Edit a comment.
-
#get(user_name, repo_name, comment_id, params = {}) ⇒ Object
(also: #find)
Get a single comment.
-
#initialize(options = {}) ⇒ Comments
constructor
Creates new Issues::Comments API.
-
#list(user_name, repo_name, issue_id, params = {}) ⇒ Object
(also: #all)
List comments on an issue.
Methods inherited from API
#_merge_mime_type, #_merge_user_into_params!, #_merge_user_repo_into_params!, #_update_user_repo_params, #api_methods_in, inherited, #method_missing, #process_basic_auth, #set_api_client, #setup, #update_and_validate_user_repo_params
Methods included from Normalizer
Methods included from ParameterFilter
Methods included from AutoloadHelper
#autoload_all, #lookup_constant, #register_constant
Methods included from Validations::Required
#assert_required_keys, #assert_required_values_present, #parse_values
Methods included from Validations::Token
Methods included from Validations::Format
Methods included from Validations::Presence
#_validate_presence_of, #_validate_user_repo_params
Methods included from Request
#delete_request, #get_request, #patch_request, #post_request, #put_request, #request
Methods included from Connection
#caching?, #clear_cache, #connection, #default_middleware, #default_options, #stack
Methods included from Authorization
#authenticated?, #authentication, #basic_authed?
Constructor Details
#initialize(options = {}) ⇒ Comments
Creates new Issues::Comments API
11 12 13 |
# File 'lib/bitbucket_rest_api/issues/comments.rb', line 11 def initialize( = {}) super() end |
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, issue_id, params = {}) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/bitbucket_rest_api/issues/comments.rb', line 64 def create(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 # _merge_mime_type(:issue_comment, params) filter! VALID_ISSUE_COMMENT_PARAM_NAME, params assert_required_keys(%w[ content ], params) post_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/#{issue_id}/comments/", params) end |
#delete(user_name, repo_name, comment_id, params = {}) ⇒ Object
106 107 108 109 110 111 112 113 114 115 |
# File 'lib/bitbucket_rest_api/issues/comments.rb', line 106 def delete(user_name, repo_name, comment_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of comment_id normalize! params # _merge_mime_type(:issue_comment, params) delete_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/comments/#{comment_id}", params) end |
#edit(user_name, repo_name, comment_id, params = {}) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/bitbucket_rest_api/issues/comments.rb', line 87 def edit(user_name, repo_name, comment_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of comment_id normalize! params # _merge_mime_type(:issue_comment, params) filter! VALID_ISSUE_COMMENT_PARAM_NAME, params assert_required_keys(%w[ content ], params) put_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/comments/#{comment_id}", params) end |
#get(user_name, repo_name, comment_id, params = {}) ⇒ Object Also known as: find
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/bitbucket_rest_api/issues/comments.rb', line 42 def get(user_name, repo_name, comment_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of comment_id normalize! params # _merge_mime_type(:issue_comment, params) get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/comments/#{comment_id}", params) end |
#list(user_name, repo_name, issue_id, params = {}) ⇒ Object Also known as: all
List comments on an issue
Examples
bitbucket = BitBucket.new
bitbucket.issues.comments.all 'user-name', 'repo-name', 'issue-id'
bitbucket.issues.comments.all 'user-name', 'repo-name', 'issue-id' {|com| .. }
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bitbucket_rest_api/issues/comments.rb', line 22 def list(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 # _merge_mime_type(:issue_comment, params) response = get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/#{issue_id}/comments/", params) return response unless block_given? response.each { |el| yield el } end |