Class: BitBucket::Issues::Milestones
- Defined in:
- lib/bitbucket_rest_api/issues/milestones.rb
Constant Summary collapse
- VALID_MILESTONE_INPUTS =
%w[ name ].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
Instance Method Summary collapse
-
#create(user_name, repo_name, params = {}) ⇒ Object
Create a milestone.
-
#delete(user_name, repo_name, milestone_id, params = {}) ⇒ Object
Delete a milestone.
-
#get(user_name, repo_name, milestone_id, params = {}) ⇒ Object
(also: #find)
Get a single milestone.
-
#initialize(options = {}) ⇒ Milestones
constructor
Creates new Issues::Milestones API.
-
#list(user_name, repo_name, params = {}) ⇒ Object
(also: #all)
List milestones for a repository.
-
#update(user_name, repo_name, milestone_id, params = {}) ⇒ Object
Update a milestone.
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 = {}) ⇒ Milestones
Creates new Issues::Milestones API
9 10 11 |
# File 'lib/bitbucket_rest_api/issues/milestones.rb', line 9 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, params = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/bitbucket_rest_api/issues/milestones.rb', line 57 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 filter! VALID_MILESTONE_INPUTS, params assert_required_keys(%w[name], params) post_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones", params) end |
#delete(user_name, repo_name, milestone_id, params = {}) ⇒ Object
96 97 98 99 100 101 102 103 |
# File 'lib/bitbucket_rest_api/issues/milestones.rb', line 96 def delete(user_name, repo_name, milestone_id, params = {}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of milestone_id normalize! params delete_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones/#{milestone_id}", params) end |
#get(user_name, repo_name, milestone_id, params = {}) ⇒ Object Also known as: find
38 39 40 41 42 43 44 45 |
# File 'lib/bitbucket_rest_api/issues/milestones.rb', line 38 def get(user_name, repo_name, milestone_id, params = {}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of milestone_id normalize! params get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones/#{milestone_id}", params) end |
#list(user_name, repo_name, params = {}) ⇒ Object Also known as: all
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bitbucket_rest_api/issues/milestones.rb', line 19 def list(user_name, repo_name, params = {}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params response = get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones", params) return response unless block_given? response.each { |el| yield el } end |
#update(user_name, repo_name, milestone_id, params = {}) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/bitbucket_rest_api/issues/milestones.rb', line 78 def update(user_name, repo_name, milestone_id, params = {}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of milestone_id normalize! params filter! VALID_MILESTONE_INPUTS, params assert_required_keys(%w[name], params) put_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones/#{milestone_id}", params) end |