Module: CASClient::UserAPI
- Included in:
- User
- Defined in:
- lib/cas_client/user_api.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #cas_create ⇒ Object
- #cas_password ⇒ Object
- #cas_password=(_password) ⇒ Object
- #cas_password_confirmation ⇒ Object
- #cas_password_confirmation=(_password_confirmation) ⇒ Object
- #cas_reset_password ⇒ Object
- #cas_retrieve_attributes ⇒ Object
- #cas_update_attributes ⇒ Object
Class Method Details
.included(base) ⇒ Object
7 8 9 |
# File 'lib/cas_client/user_api.rb', line 7 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#cas_create ⇒ Object
92 93 94 95 96 |
# File 'lib/cas_client/user_api.rb', line 92 def cas_create url = URI.parse("#{::CAS_SERVER["internal_cas_domain"]}/api/users") res = handle_response(make_request(url, Net::HTTP::Post.new(url.path))) Yajl::Parser.new(:symbolize_keys => true).parse(res.body) end |
#cas_password ⇒ Object
80 81 82 |
# File 'lib/cas_client/user_api.rb', line 80 def cas_password @cas_password end |
#cas_password=(_password) ⇒ Object
76 77 78 |
# File 'lib/cas_client/user_api.rb', line 76 def cas_password=(_password) @cas_password = _password end |
#cas_password_confirmation ⇒ Object
88 89 90 |
# File 'lib/cas_client/user_api.rb', line 88 def cas_password_confirmation @cas_password_confirmation end |
#cas_password_confirmation=(_password_confirmation) ⇒ Object
84 85 86 |
# File 'lib/cas_client/user_api.rb', line 84 def cas_password_confirmation=(_password_confirmation) @cas_password_confirmation = _password_confirmation end |
#cas_reset_password ⇒ Object
114 115 116 117 |
# File 'lib/cas_client/user_api.rb', line 114 def cas_reset_password res = fetch("#{::CAS_SERVER["internal_cas_domain"]}/api/users/#{self.send(self.class.cas_map[:uuid])}/reset_password") res.body end |
#cas_retrieve_attributes ⇒ Object
109 110 111 112 |
# File 'lib/cas_client/user_api.rb', line 109 def cas_retrieve_attributes res = fetch("#{::CAS_SERVER["internal_cas_domain"]}/api/users/#{self.send(self.class.cas_map[:uuid])}") Yajl::Parser.new(:symbolize_keys => true).parse(res.body) end |
#cas_update_attributes ⇒ Object
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/cas_client/user_api.rb', line 98 def cas_update_attributes if self.changes.keys.include?(self.class.cas_map[:uuid].to_s) _user_identifier = self.changes[self.class.cas_map[:uuid].to_s].first else _user_identifier = self.send(self.class.cas_map[:uuid]) end url = URI.parse("#{::CAS_SERVER["internal_cas_domain"]}/api/users/#{_user_identifier}") res = handle_response(make_request(url, Net::HTTP::Put.new(url.path))) Yajl::Parser.new(:symbolize_keys => true).parse(res.body) end |