Module: Elastic::SiteSearch::Client::User

Included in:
Elastic::SiteSearch::Client
Defined in:
lib/elastic/site-search/client.rb

Instance Method Summary collapse

Instance Method Details

#create_userObject

Create a new user for the configured application.



225
226
227
228
229
230
231
# File 'lib/elastic/site-search/client.rb', line 225

def create_user
  params = {
    :client_id => Elastic::SiteSearch.platform_client_id,
    :client_secret => Elastic::SiteSearch.platform_client_secret
  }
  post("users.json", params)
end

#user(user_id) ⇒ Object

Return a user created by the configured application.

Parameters:

  • user_id (String)

    the Site Search User ID



236
237
238
239
240
241
242
# File 'lib/elastic/site-search/client.rb', line 236

def user(user_id)
  params = {
    :client_id => Elastic::SiteSearch.platform_client_id,
    :client_secret => Elastic::SiteSearch.platform_client_secret
  }
  get("users/#{user_id}.json", params)
end

#users(options = {}) ⇒ Object

List users for the configured application.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :page (Integer)

    page number of users to fetch (server defaults to 1)

  • :per_page (Integer)

    users to return per page (server defaults to 50)



216
217
218
219
220
221
222
# File 'lib/elastic/site-search/client.rb', line 216

def users(options={})
  params = {
    :client_id => Elastic::SiteSearch.platform_client_id,
    :client_secret => Elastic::SiteSearch.platform_client_secret
  }
  get("users.json", params.merge(options))
end