Class: RecombeeApiClient::ListUsers

Inherits:
ApiRequest show all
Defined in:
lib/recombee_api_client/api/list_users.rb

Overview

Gets a list of IDs of users currently present in the catalog.#

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashNormalizer

#camelize, #normalize_hash_to_camel_case

Constructor Details

#initialize(optional = {}) ⇒ ListUsers

  • *Optional arguments (given as hash optional)*

    • filter -> Boolean-returning [ReQL](docs.recombee.com/reql) expression, which allows you to filter users to be listed. Only the users for which the expression is true will be returned.

    • count -> The number of users to be listed.

    • offset -> Specifies the number of users to skip (ordered by userId).

    • returnProperties -> With ‘returnProperties=true`, property values of the listed users are returned along with their IDs in a JSON dictionary.

Example response: “‘json

[
  {
    "userId": "user-81",
    "country": "US",
    "sex": "M"
  },
  {
    "userId": "user-314",
    "country": "CAN",
    "sex": "F"
  }
]

“‘

- +includedProperties+ -> Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.

Example response for ‘includedProperties=country`: “`json

[
  {
    "userId": "user-81",
    "country": "US"
  },
  {
    "userId": "user-314",
    "country": "CAN"
  }
]

“‘



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/recombee_api_client/api/list_users.rb', line 56

def initialize(optional = {})
  optional = normalize_hash_to_camel_case(optional)
  @filter = optional['filter']
  @count = optional['count']
  @offset = optional['offset']
  @return_properties = optional['returnProperties']
  @included_properties = optional['includedProperties']
  @optional = optional
  @timeout = 100_000
  @ensure_https = false
  @optional.each do |par, _|
    raise UnknownOptionalParameter.new(par) unless %w[filter count offset returnProperties
                                                      includedProperties].include? par
  end
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



12
13
14
# File 'lib/recombee_api_client/api/list_users.rb', line 12

def count
  @count
end

#ensure_httpsObject

Returns the value of attribute ensure_https.



13
14
15
# File 'lib/recombee_api_client/api/list_users.rb', line 13

def ensure_https
  @ensure_https
end

#filterObject (readonly)

Returns the value of attribute filter.



12
13
14
# File 'lib/recombee_api_client/api/list_users.rb', line 12

def filter
  @filter
end

#included_propertiesObject (readonly)

Returns the value of attribute included_properties.



12
13
14
# File 'lib/recombee_api_client/api/list_users.rb', line 12

def included_properties
  @included_properties
end

#offsetObject (readonly)

Returns the value of attribute offset.



12
13
14
# File 'lib/recombee_api_client/api/list_users.rb', line 12

def offset
  @offset
end

#return_propertiesObject (readonly)

Returns the value of attribute return_properties.



12
13
14
# File 'lib/recombee_api_client/api/list_users.rb', line 12

def return_properties
  @return_properties
end

#timeoutObject

Returns the value of attribute timeout.



13
14
15
# File 'lib/recombee_api_client/api/list_users.rb', line 13

def timeout
  @timeout
end

Instance Method Details

#body_parametersObject

Values of body parameters as a Hash



78
79
80
# File 'lib/recombee_api_client/api/list_users.rb', line 78

def body_parameters
  {}
end

#methodObject

HTTP method



73
74
75
# File 'lib/recombee_api_client/api/list_users.rb', line 73

def method
  :get
end

#pathObject

Relative path to the endpoint



96
97
98
# File 'lib/recombee_api_client/api/list_users.rb', line 96

def path
  '/{databaseId}/users/list/'
end

#query_parametersObject

Values of query parameters as a Hash. name of parameter => value of the parameter



84
85
86
87
88
89
90
91
92
93
# File 'lib/recombee_api_client/api/list_users.rb', line 84

def query_parameters
  params = {}
  params['filter'] = @optional['filter'] if @optional['filter']
  params['count'] = @optional['count'] if @optional['count']
  params['offset'] = @optional['offset'] if @optional['offset']
  params['returnProperties'] = @optional['returnProperties'] if @optional['returnProperties']
  params['includedProperties'] = @optional['includedProperties'] if @optional['includedProperties']

  params
end