Module: BitBucket::Validations::Presence

Included in:
BitBucket::Validations
Defined in:
lib/bitbucket_rest_api/validations/presence.rb

Instance Method Summary collapse

Instance Method Details

#_validate_presence_of(*params) ⇒ Object

Ensures that essential arguments are present before request is made



7
8
9
10
11
# File 'lib/bitbucket_rest_api/validations/presence.rb', line 7

def _validate_presence_of(*params)
  params.each do |param|
    raise ArgumentError, 'parameter cannot be nil' if param.nil?
  end
end

#_validate_user_repo_params(user_name, repo_name) ⇒ Object

Check if user or repository parameters are passed

Raises:

  • (ArgumentError)


15
16
17
18
# File 'lib/bitbucket_rest_api/validations/presence.rb', line 15

def _validate_user_repo_params(user_name, repo_name)
  raise ArgumentError, '[user] parameter cannot be nil' if user_name.nil?
  raise ArgumentError, '[repo] parameter cannot be nil' if repo_name.nil?
end