module Session

Public Instance Methods

create_session(ip, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 9
def create_session(ip, options={})
  parameters =
      {
          'IpAddress': ip,
          'Organization': 'Tessitura Web'
      }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(body: parameters)
  response = self.class.post(base_api_endpoint('Web/Session'), options)
  JSON.parse(response.body)
end
get_expiration(key, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 21
def get_expiration(key, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  response = self.class.get(base_api_endpoint("Web/Session/#{key}/Expiration"), options)
  JSON.parse(response.body)
end
get_promotion(key, code, code_string, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 60
def get_promotion(key, code, code_string, options={})
  parameters =
    {
      'PromoCode': code,
      'PromoCodeString': code_string
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters)
  response = self.class.post(base_api_endpoint("Web/Session/#{key}/PromoCode"), options)
  JSON.parse(response.body)
end
get_renewals(key, season_id, renewal, mode_of_sale, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 72
def get_renewals(key, season_id, renewal, mode_of_sale, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  response = self.class.get(base_api_endpoint("Web/Session/#{key}/Orders/Search?seasonId=#{season_id}&renewalsOnly=#{renewal}&modeOfSaleId=#{mode_of_sale}"), options)
  JSON.parse(response.body)
end
get_session(key, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 3
def get_session(key, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  response = self.class.get(base_api_endpoint("Web/Session/#{key}"), options)
  JSON.parse(response.body)
end
get_shipping_methods(key, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 107
def get_shipping_methods(key, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  response = self.class.get(base_api_endpoint("Web/Session/#{key}/DeliveryMethods"), options)
  JSON.parse(response.body)
end
get_variables(key, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 37
def get_variables(key, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  response = self.class.get(base_api_endpoint("Web/Session/#{key}/Variables"), options)
  JSON.parse(response.body)
end
load_existing_order(key, order_id, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 55
def load_existing_order(key, order_id, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.post(base_api_endpoint("Web/Session/#{key}/LoadOrder/#{order_id}"), options)
end
send_credentials(key, email, login_type, template_id, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 78
def send_credentials(key, email, login_type, template_id, options={})
  parameters =
  {
    'TemplateFormatId': template_id,
    'LoginTypeId': login_type,
    'EmailAddress': email
  }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters)
  self.class.post(base_api_endpoint("/Web/Session/#{key}/Login/SendCredentials"), options)
end
set_expiration(key, timeoffset, expiration, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 43
def set_expiration(key, timeoffset, expiration, options={})
  parameters =
  {
    'Expiration': expiration,
    'TimeOffset': timeoffset
  }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters)
  response = self.class.put(base_api_endpoint("Web/Session/#{key}/Expiration"), options)
  JSON.parse(response.body)
end
transfer_session(session_key, new_session_key, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 27
def transfer_session(session_key, new_session_key, options={})
  parameters =
    {
      'NewSessionKey': new_session_key,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(body: parameters)
  self.class.post(base_api_endpoint("Web/Session/#{session_key}/Transfer"), options)
end
update_login(key, user_name, old_password, new_password, email, new_email, options={}) click to toggle source
# File lib/tessitura_rest/web/session.rb, line 90
def update_login(key, user_name, old_password, new_password, email, new_email, options={})
  parameters =
      {
        'LoginName': user_name,
        'NewLoginName': new_email,
        'Password': old_password,
        'NewPassword': new_password,
        'EmailAddress': email,
        'NewEmailAddress': new_email,
        'LoginTypeId': 1,
        'PromotionCode': 0,
      }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json, :headers => {'Content-Type' => 'application/json'})
  self.class.put(base_api_endpoint("Web/Session/#{key}/WebLogins"), options)
end