Class: Mooset::Endpoints::Gitlab::UserSearch
- Includes:
- Paginate
- 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
- #alll ⇒ Object
- #create(email, password, opts = {}) ⇒ Object
- #group_members(id) ⇒ Object
-
#initialize(endpoint) ⇒ UserSearch
constructor
A new instance of UserSearch.
Methods included from Paginate
Methods included from Findable
Constructor Details
#initialize(endpoint) ⇒ UserSearch
Returns a new instance of UserSearch.
9 10 11 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 9 def initialize(endpoint) @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 7 def endpoint @endpoint end |
Instance Method Details
#all ⇒ Object
13 14 15 16 17 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 13 def all return to_enum(:all) unless block_given? paginate ->(page){ connection.users(page: page) }, ->(object){ yield User.build(endpoint, object) } end |
#alll ⇒ Object
19 20 21 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 19 def alll @alll ||= all.to_a end |
#create(email, password, opts = {}) ⇒ Object
53 54 55 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 53 def create(email, password, opts = {}) User.build(endpoint, connection.create_user(email, password, opts)) end |
#group_members(id) ⇒ Object
57 58 59 60 61 |
# File 'lib/mooset/endpoints/gitlab/user_search.rb', line 57 def group_members(id) return to_enum(:group_members, id) unless block_given? paginate ->(page) { connection.group_members(id, page: page) }, ->(object) { yield User.build(endpoint, object) } end |