Class: Bsm::Sso::Client::User

Inherits:
AbstractResource show all
Defined in:
lib/bsm/sso/client/user.rb

Class Method Summary collapse

Methods inherited from AbstractResource

#attributes, get, headers, #id, #initialize, #respond_to_missing?, site, site=

Constructor Details

This class inherits a constructor from Bsm::Sso::Client::AbstractResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Bsm::Sso::Client::AbstractResource

Class Method Details

.all(options = {}) ⇒ Object



5
6
7
# File 'lib/bsm/sso/client/user.rb', line 5

def all(options={})
  get('/users', options.reverse_merge(expects: [200, 404, 422], collection: true))
end

.sso_authenticate(credentials) ⇒ Object



23
24
25
# File 'lib/bsm/sso/client/user.rb', line 23

def sso_authenticate(credentials)
  get '/authenticate', query: credentials.slice(:email, :password)
end

.sso_authorize(token) ⇒ Object



19
20
21
# File 'lib/bsm/sso/client/user.rb', line 19

def sso_authorize(token)
  get '/authorize', query: { auth_token: token }
end

.sso_consume(ticket, service) ⇒ Object



15
16
17
# File 'lib/bsm/sso/client/user.rb', line 15

def sso_consume(ticket, service)
  get '/consume', query: { ticket: ticket, service: service }
end

.sso_find(id) ⇒ Object



9
10
11
12
13
# File 'lib/bsm/sso/client/user.rb', line 9

def sso_find(id)
  Bsm::Sso::Client.cache_store.fetch "users:#{id}", expires_in: Bsm::Sso::Client.expire_after do
    get "/users/#{id}", expects: [200, 404, 422]
  end
end

.sso_sign_in_url(params = {}) ⇒ Object



27
28
29
# File 'lib/bsm/sso/client/user.rb', line 27

def (params={})
  sso_custom_absolute_method_root_url(:sign_in, params)
end

.sso_sign_out_url(params = {}) ⇒ Object



31
32
33
# File 'lib/bsm/sso/client/user.rb', line 31

def sso_sign_out_url(params={})
  sso_custom_absolute_method_root_url(:sign_out, params)
end