Class: BitBucket::Issues::Components
- Defined in:
- lib/bitbucket_rest_api/issues/components.rb
Constant Summary collapse
- VALID_COMPONENT_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 component.
-
#delete(user_name, repo_name, component_id, params = {}) ⇒ Object
Delete a component.
-
#get(user_name, repo_name, component_id, params = {}) ⇒ Object
(also: #find)
Get a single component.
-
#initialize(options = {}) ⇒ Components
constructor
Creates new Issues::Components API.
-
#list(user_name, repo_name, params = {}) ⇒ Object
(also: #all)
List all components for a repository.
-
#update(user_name, repo_name, component_id, params = {}) ⇒ Object
(also: #edit)
Update a component.
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 = {}) ⇒ Components
Creates new Issues::Components API
7 8 9 |
# File 'lib/bitbucket_rest_api/issues/components.rb', line 7 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
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/bitbucket_rest_api/issues/components.rb', line 55 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_COMPONENT_INPUTS, params assert_required_keys(VALID_COMPONENT_INPUTS, params) post_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/components", params) end |
#delete(user_name, repo_name, component_id, params = {}) ⇒ Object
95 96 97 98 99 100 101 102 103 |
# File 'lib/bitbucket_rest_api/issues/components.rb', line 95 def delete(user_name, repo_name, component_id, params = {}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params delete_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/components/#{component_id}", params) end |
#get(user_name, repo_name, component_id, params = {}) ⇒ Object Also known as: find
36 37 38 39 40 41 42 43 |
# File 'lib/bitbucket_rest_api/issues/components.rb', line 36 def get(user_name, repo_name, component_id, params = {}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/components/#{component_id}", params) end |
#list(user_name, repo_name, params = {}) ⇒ Object Also known as: all
List all components for a repository
Examples
bitbucket = BitBucket.new :user => 'user-name', :repo => 'repo-name'
bitbucket.issues.components.list
bitbucket.issues.components.list { |component| ... }
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bitbucket_rest_api/issues/components.rb', line 18 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/components", params) return response unless block_given? response.each { |el| yield el } end |
#update(user_name, repo_name, component_id, params = {}) ⇒ Object Also known as: edit
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/bitbucket_rest_api/issues/components.rb', line 76 def update(user_name, repo_name, component_id, params = {}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params filter! VALID_COMPONENT_INPUTS, params assert_required_keys(VALID_COMPONENT_INPUTS, params) put_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/components/#{component_id}", params) end |