Class: Mooset::Endpoints::Gitlab::UserSearch
- Inherits:
-
Object
- Object
- Mooset::Endpoints::Gitlab::UserSearch
- Defined in:
- lib/mooset/endpoints/gitlab/user_search.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Instance Method Summary collapse
- #all ⇒ Object
- #find(id) ⇒ Object
-
#initialize(endpoint) ⇒ UserSearch
constructor
A new instance of UserSearch.
- #memberof(id) ⇒ Object
Constructor Details
#initialize(endpoint) ⇒ UserSearch
Returns a new instance of UserSearch.
7 8 9 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 7 def initialize(endpoint) @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 5 def endpoint @endpoint end |
Instance Method Details
#all ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 11 def all page = 1 objects = [] while (o = connection.users(page: page)).length > 0 do objects += o page += 1 end objects.collect do |object| User.build(endpoint.endpoint_name, object) end end |
#find(id) ⇒ Object
25 26 27 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 25 def find(id) User.build(endpoint.endpoint_name, connection.user(id)) end |
#memberof(id) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 29 def memberof(id) page = 1 objects = [] while (o = connection.group_members(id, page: page)).length > 0 do objects += o page += 1 end objects.collect do |object| User.build(endpoint.endpoint_name, object) end end |