Module: DroneCI::UserAPI

Included in:
API
Defined in:
lib/drone-ci/api/user.rb

Instance Method Summary collapse

Instance Method Details

#user_buildsObject

Returns the currently authenticated user’s build feed.

Reference: docs.drone.io/api/user/user_builds/



8
9
10
# File 'lib/drone-ci/api/user.rb', line 8

def user_builds
  api.get('user/builds')
end

#user_infoObject

Returns the currently authenticated user.

Reference: docs.drone.io/api/user/user_info/



15
16
17
# File 'lib/drone-ci/api/user.rb', line 15

def 
  api.get('user')
end

#user_repos(latest: nil) ⇒ Object

Returns the currently authenticated user’s repository list.

Optionally, include the latest build for each active repository.

Reference: docs.drone.io/api/user/user_repos/



24
25
26
27
28
29
30
# File 'lib/drone-ci/api/user.rb', line 24

def user_repos(latest: nil)
  api.get('user/repos') do |request|
    { latest: latest }.compact.each do |key, value|
      request.params[key] = value
    end
  end
end

#user_sync(async: nil) ⇒ Object

Synchronize the currently authenticated user’s repository list.

Reference: docs.drone.io/api/user/user_sync/



35
36
37
38
39
40
41
# File 'lib/drone-ci/api/user.rb', line 35

def user_sync(async: nil)
  api.post('user/repos') do |request|
    { async: async }.compact.each do |key, value|
      request.params[key] = value
    end
  end
end

#user_token(rotate: nil) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/drone-ci/api/user.rb', line 47

def user_token(rotate: nil)
  api.post('user/token') do |request|
    { rotate: rotate }.compact.each do |key, value|
      request.params[key] = value
    end
  end
end