Class: BitBucket::Client::User

Inherits:
API
  • Object
show all
Defined in:
lib/bitbucket_rest_api/client/user.rb

Constant Summary collapse

DEFAULT_USER_OPTIONS =
{
    "first_name"      => "",
    "last_name"       => "",
    "avatar"          => ""
    # TODO: can this filed be modified?
    # "resource_uri"    => ""
}.freeze

Constants included from Validations

Validations::VALID_API_KEYS

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

#current_options

Instance Method Summary collapse

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

#normalize!

Methods included from ParameterFilter

#filter!

Methods included from Validations::Required

#assert_required_keys

Methods included from Validations::Token

#validates_token_for

Methods included from Validations::Format

#assert_valid_values

Methods included from Validations::Presence

#assert_presence_of

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

#dashboardObject

GET the list of repositories on the dashboard Gets the repositories list from the account’s dashboard.



91
92
93
# File 'lib/bitbucket_rest_api/client/user.rb', line 91

def dashboard
  get_request("/user/repositories/dashboard")
end

#followsObject

GET a list of repositories an account follows Gets the details of the repositories that the individual or team account follows. This call returns the full data about the repositories including if the repository is a fork of another repository. An account always “follows” its own repositories.



63
64
65
# File 'lib/bitbucket_rest_api/client/user.rb', line 63

def follows
  get_request("/user/follows")
end

#overviewObject

GET a list of repositories the account is following Gets a list of the repositories the account follows. This is the same list that appears on the Following tab on your account dashboard.



83
84
85
# File 'lib/bitbucket_rest_api/client/user.rb', line 83

def overview
  get_request("/user/repositories/overview")
end

#privilegesObject

GET a list of user privileges



52
53
54
# File 'lib/bitbucket_rest_api/client/user.rb', line 52

def privileges
  get_request("/user/privileges")
end

#profileObject

Gets the basic information associated with an account and a list of all of the repositories owned by the user. See confluence.atlassian.com/display/BITBUCKET/user+Endpoint#userEndpoint-GETauserprofile

Examples

bitbucket = BitBucket.new
bitbucket.user_api.profile


23
24
25
# File 'lib/bitbucket_rest_api/client/user.rb', line 23

def profile
  get_request("/user")
end

#repositoriesObject Also known as: repos

GET a list of repositories visible to an account Gets the details of the repositories that the user owns or has at least read access to. Use this if you’re looking for a full list of all of the repositories associated with a user.



72
73
74
# File 'lib/bitbucket_rest_api/client/user.rb', line 72

def repositories
  get_request("/user/repositories")
end

#update(params = { }) ⇒ Object

Parameters

  • :first_name Optional string

  • :last_name Optional string

  • :avatar Optional string

  • :resource_uri Optional string

Examples

bitbucket = BitBucket.new
bitbucket.user_api.update :first_name => 'first-name', :last_name => 'last-name'


42
43
44
45
46
47
48
# File 'lib/bitbucket_rest_api/client/user.rb', line 42

def update( params={ })
  normalize! params
  filter! DEFAULT_USER_OPTIONS, params

  put_request("/user", DEFAULT_USER_OPTIONS.merge(params))

end