Module: Session

Included in:
TessituraRest
Defined in:
lib/tessitura_rest/web/session.rb

Instance Method Summary collapse

Instance Method Details

#create_session(ip, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/tessitura_rest/web/session.rb', line 8

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 = {}) ⇒ Object



20
21
22
23
24
# File 'lib/tessitura_rest/web/session.rb', line 20

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 = {}) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/tessitura_rest/web/session.rb', line 59

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 = {}) ⇒ Object



71
72
73
74
75
# File 'lib/tessitura_rest/web/session.rb', line 71

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 = {}) ⇒ Object



2
3
4
5
6
# File 'lib/tessitura_rest/web/session.rb', line 2

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 = {}) ⇒ Object



106
107
108
109
110
# File 'lib/tessitura_rest/web/session.rb', line 106

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 = {}) ⇒ Object



36
37
38
39
40
# File 'lib/tessitura_rest/web/session.rb', line 36

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 = {}) ⇒ Object



54
55
56
57
# File 'lib/tessitura_rest/web/session.rb', line 54

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 = {}) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/tessitura_rest/web/session.rb', line 77

def send_credentials(key, email, , template_id, options = {})
  parameters =
    {
      'TemplateFormatId': template_id,
      'LoginTypeId': ,
      '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 = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tessitura_rest/web/session.rb', line 42

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 = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/tessitura_rest/web/session.rb', line 26

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 = {}) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/tessitura_rest/web/session.rb', line 89

def (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