Class: Kippt::Users
- Inherits:
-
Object
- Object
- Kippt::Users
- Includes:
- ReadCollectionResource
- Defined in:
- lib/kippt/users.rb
Constant Summary collapse
- VALID_SEARCH_PARAMETERS =
[:q]
Class Method Summary collapse
Instance Method Summary collapse
- #base_uri ⇒ Object
- #collection_class ⇒ Object
-
#initialize(client) ⇒ Users
constructor
A new instance of Users.
- #object_class ⇒ Object
- #search(parameters) ⇒ Object
Methods included from ReadCollectionResource
Constructor Details
#initialize(client) ⇒ Users
Returns a new instance of Users.
7 8 9 |
# File 'lib/kippt/users.rb', line 7 def initialize(client) @client = client end |
Class Method Details
.valid_filter_parameters ⇒ Object
11 12 13 |
# File 'lib/kippt/users.rb', line 11 def self.valid_filter_parameters [:limit, :offset] end |
Instance Method Details
#base_uri ⇒ Object
23 24 25 |
# File 'lib/kippt/users.rb', line 23 def base_uri "users" end |
#collection_class ⇒ Object
19 20 21 |
# File 'lib/kippt/users.rb', line 19 def collection_class Kippt::UserCollection end |
#object_class ⇒ Object
15 16 17 |
# File 'lib/kippt/users.rb', line 15 def object_class Kippt::User end |
#search(parameters) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kippt/users.rb', line 27 def search(parameters) if parameters.is_a?(String) search({:q => parameters}) else validate_search_parameters(parameters) Kippt::UserCollection.new( client.get("#{base_uri}/search", parameters).body, client) end end |