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.to_json)
  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



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/tessitura_rest/web/session.rb', line 71

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.to_json)
  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



83
84
85
86
87
# File 'lib/tessitura_rest/web/session.rb', line 83

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



131
132
133
134
135
# File 'lib/tessitura_rest/web/session.rb', line 131

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



66
67
68
69
# File 'lib/tessitura_rest/web/session.rb', line 66

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



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

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.to_json)
  self.class.post(base_api_endpoint("Web/Session/#{key}/Login/SendCredentials"), options)
end

#send_credentials_v16(key, email, login_type, template_id, options = {}) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/tessitura_rest/web/session.rb', line 101

def send_credentials_v16(key, email, , template_id, options = {})
  parameters =
    {
      'TemplateFormatId': template_id,
      'LoginTypeId': ,
      'EmailAddress': email,
      'IsPriority': true,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  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.to_json)
  response = self.class.put(base_api_endpoint("Web/Session/#{key}/Expiration"), options)
  JSON.parse(response.body)
end

#set_expiration_v16(key, expiration, timeoffset = 0, options = {}) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/tessitura_rest/web/session.rb', line 54

def set_expiration_v16(key, expiration, timeoffset = 0, options = {})
  parameters =
    {
      'Expiration': expiration,
      'TimeOffset': timeoffset,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  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.to_json)
  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



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/tessitura_rest/web/session.rb', line 114

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)
  self.class.put(base_api_endpoint("Web/Session/#{key}/WebLogins"), options)
end