Class: Kippt::Users

Inherits:
Object
  • Object
show all
Includes:
ReadCollectionResource
Defined in:
lib/kippt/users.rb

Constant Summary collapse

VALID_SEARCH_PARAMETERS =
[:q]

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ReadCollectionResource

#[], #fetch

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_parametersObject



11
12
13
# File 'lib/kippt/users.rb', line 11

def self.valid_filter_parameters
  [:limit, :offset]
end

Instance Method Details

#base_uriObject



23
24
25
# File 'lib/kippt/users.rb', line 23

def base_uri
  "users"
end

#collection_classObject



19
20
21
# File 'lib/kippt/users.rb', line 19

def collection_class
  Kippt::UserCollection
end

#object_classObject



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