module Login

Public Instance Methods

login_using_email(email, password, login_type_id, promotion, session_key, options={}) click to toggle source
# File lib/tessitura_rest/web/login.rb, line 9
def login_using_email(email, password, login_type_id, promotion, session_key, options={})
  parameters =
    {
      'UserName': email,
      'Password': password, 
      'LoginTypeId': login_type_id,
      'PromotionCode': promotion
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters)
  post = self.class.post(base_api_endpoint("Web/Session/#{session_key}/Login"), options)
  post['IsLoggedIn']
end
login_using_external(email, login_type_id, promotion, session_key, options={}) click to toggle source
# File lib/tessitura_rest/web/login.rb, line 23
def login_using_external(email, login_type_id, promotion, session_key, options={})
  parameters =
    {
      'UserName': email,
      'LoginTypeId': login_type_id,
      'PromotionCode': promotion
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json, :headers => {'Content-Type' => 'application/json'})
  post = self.class.post(base_api_endpoint("Web/Session/#{session_key}/Login/External"), options)
  post.success?
end
login_with_token(email, login_type_id, token, promotion, session_key, options={}) click to toggle source
# File lib/tessitura_rest/web/login.rb, line 36
def login_with_token(email, login_type_id, token, promotion, session_key, options={})
  parameters =
    {
      'EmailAddress': email,
      'ForgotLoginToken': token,
      'LoginTypeId': login_type_id,
      'PromotionCode': promotion
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json, :headers => {'Content-Type' => 'application/json'})
  post = self.class.post(base_api_endpoint("Web/Session/#{session_key}/Login/Token"), options)
  post['IsLoggedIn']
end
logout(session_key, options={}) click to toggle source
# File lib/tessitura_rest/web/login.rb, line 50
def logout(session_key, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => {}, :headers => {'Content-Type' => 'application/json'})
  self.class.post(base_api_endpoint("/Web/Session/#{session_key}/Logout"), options)
end
with_user(ip_address, business_unit_id, options={}) click to toggle source
# File lib/tessitura_rest/web/login.rb, line 3
def with_user(ip_address, business_unit_id, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  response = self.class.get(base_api_endpoint('Web/Session/'), options)
  JSON.parse(response.body)
end