Module: Checkdin::Users

Included in:
Client
Defined in:
lib/checkdin/users.rb

Instance Method Summary collapse

Instance Method Details

#create_user(options = {}) ⇒ Object

Create a user in the checkd.in system tied to the authenticating client.

Parameters:

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

Options Hash (options):

  • String (Object)

    :identifier - The authenticating client’s internal identifier for this user.

  • String (Object)

    :email - A valid email for the user



40
41
42
43
44
45
# File 'lib/checkdin/users.rb', line 40

def create_user(options={})
  response = connection.post do |req|
    req.url "users", options
  end
  return_error_or_body(response)
end

#create_user_authentication(id, options = {}) ⇒ Object

Create an authentication for a user

param [Integer] id The ID of the user

Parameters:

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

Options Hash (options):

  • String (Object)

    :provider - The name of the provider for the authentication (twitter, facebook, foursquare, linkedin, instagram)

  • String (Object)

    :uid - The user’s id for the provider (on the provider’s service, not your internal identifier)

  • String (Object)

    :oauth_token - The user’s oauth token or access token that can be used to retrieve data on their behalf on the service.

  • String (Object)

    :oauth_token_secret - The user’s oauth token secret or access token secret that is used in combination with the oauth token (required for twitter)

  • String (Object)

    :nickname - The user’s nickname on the provider’s service.



76
77
78
79
80
81
# File 'lib/checkdin/users.rb', line 76

def create_user_authentication(id, options={})
  response = connection.post do |req|
    req.url "users/#{id}/authentications", options
  end
  return_error_or_body(response)
end

#user(id) ⇒ Object

Retrieve information about a single user

param [Integer] id The ID of the user



8
9
10
11
# File 'lib/checkdin/users.rb', line 8

def user(id)
  response = connection.get("users/#{id}")
  return_error_or_body(response)
end

#user_authentication(user_id, id) ⇒ Object

Retrieve information about a user’s specific authentication to an external service

param [Integer] user_id The ID of the user param [Integer] id The ID of the authentication



61
62
63
64
# File 'lib/checkdin/users.rb', line 61

def user_authentication(user_id, id)
  response = connection.get("users/#{user_id}/authentications/#{id}")
  return_error_or_body(response)
end

#user_authentications(id) ⇒ Object

Retrieve a list of a user’s authentications to external services (Facebook, Foursquare, etc.)

param [Integer] id The ID of the user



51
52
53
54
# File 'lib/checkdin/users.rb', line 51

def user_authentications(id)
  response = connection.get("users/#{id}/authentications")
  return_error_or_body(response)
end

#users(options = {}) ⇒ Object

Get a list of all users for the authenticating client.

Parameters:

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

Options Hash (options):

  • Integer (Object)

    :limit - The maximum number of records to return.



18
19
20
21
22
23
# File 'lib/checkdin/users.rb', line 18

def users(options={})
  response = connection.get do |req|
    req.url "users", options
  end
  return_error_or_body(response)
end

#whitelabel_user_lookup(id) ⇒ Object

Lookup the checkd.in ID of a user based on their whitelabel ID.

params [Integer] id The whitelabel identifier of the user (passed to checkd.in during creation)



29
30
31
32
# File 'lib/checkdin/users.rb', line 29

def whitelabel_user_lookup(id)
  response = connection.get("users/whitelabel/#{id}")
  return_error_or_body(response)
end