Class: YourMembership::Sa::Auth
- Defined in:
- lib/your_membership/sa_auth.rb
Overview
YourMembership System Administrator Member Authentication
Class Method Summary collapse
-
.authenticate(session, user_name, password = nil, password_hash = nil) ⇒ YourMembership::Member
Authenticates a member’s username and password and binds them to the current API session.
Methods inherited from Base
build_XML_request, new_call_id, post, response_to_array, response_to_array_of_hashes, response_valid?, response_ym_error?
Class Method Details
.authenticate(session, user_name, password = nil, password_hash = nil) ⇒ YourMembership::Member
Authenticates a member’s username and password and binds them to the current API session.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/your_membership/sa_auth.rb', line 15 def self.authenticate(session, user_name, password = nil, password_hash = nil) = {} [:Username] = user_name [:Password] = password if password [:PasswordHash] = password_hash if password_hash response = post('/', :body => build_XML_request('Sa.Auth.Authenticate', session, )) response_valid? response if response['YourMembership_Response']['Sa.Auth.Authenticate'] session.get_authenticated_user else return false end YourMembership::Member.create_from_session(session) end |