Module: Login
- Included in:
- TessituraRest
- Defined in:
- lib/tessitura_rest/web/login.rb
Instance Method Summary collapse
- #login_as_guest(email, session_key, options = {}) ⇒ Object
- #login_using_email(email, password, login_type_id, promotion, session_key, options = {}) ⇒ Object
- #login_using_external(email, login_type_id, promotion, session_key, options = {}) ⇒ Object
- #login_with_token(email, login_type_id, token, promotion, session_key, options = {}) ⇒ Object
- #logout(session_key, options = {}) ⇒ Object
- #with_user(_ip_address, _business_unit_id, options = {}) ⇒ Object
Instance Method Details
#login_as_guest(email, session_key, options = {}) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/tessitura_rest/web/login.rb', line 49 def login_as_guest(email, session_key, = {}) # promotion will be added as a parameter in v 16.0 parameters = { 'ElectronicAddressTypeId': 1, 'EmailAddress': email, 'LoginTypeId': 1, } .merge!(basic_auth: @auth, headers: @headers) .merge!(body: parameters.to_json) response = self.class.post(base_api_endpoint("Web/Session/#{session_key}/LoginAsGuest"), ) JSON.parse(response.body) end |
#login_using_email(email, password, login_type_id, promotion, session_key, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tessitura_rest/web/login.rb', line 8 def login_using_email(email, password, login_type_id, promotion, session_key, = {}) parameters = { 'UserName': email, 'Password': password, 'LoginTypeId': login_type_id, 'PromotionCode': promotion, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) post = self.class.post(base_api_endpoint("Web/Session/#{session_key}/Login"), ) post.success? end |
#login_using_external(email, login_type_id, promotion, session_key, options = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tessitura_rest/web/login.rb', line 22 def login_using_external(email, login_type_id, promotion, session_key, = {}) parameters = { 'UserName': email, 'LoginTypeId': login_type_id, 'PromotionCode': promotion, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) post = self.class.post(base_api_endpoint("Web/Session/#{session_key}/Login/External"), ) post.success? end |
#login_with_token(email, login_type_id, token, promotion, session_key, options = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/tessitura_rest/web/login.rb', line 35 def login_with_token(email, login_type_id, token, promotion, session_key, = {}) parameters = { 'EmailAddress': email, 'ForgotLoginToken': token, 'LoginTypeId': login_type_id, 'PromotionCode': promotion, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) post = self.class.post(base_api_endpoint("Web/Session/#{session_key}/Login/Token"), ) post.success? end |
#logout(session_key, options = {}) ⇒ Object
63 64 65 66 |
# File 'lib/tessitura_rest/web/login.rb', line 63 def logout(session_key, = {}) .merge!(basic_auth: @auth, headers: @headers) self.class.post(base_api_endpoint("Web/Session/#{session_key}/Logout"), ) end |
#with_user(_ip_address, _business_unit_id, options = {}) ⇒ Object
2 3 4 5 6 |
# File 'lib/tessitura_rest/web/login.rb', line 2 def with_user(_ip_address, _business_unit_id, = {}) .merge!(basic_auth: @auth, headers: @headers) response = self.class.get(base_api_endpoint('Web/Session/'), ) JSON.parse(response.body) end |