Module: Session
- Included in:
- TessituraRest
- Defined in:
- lib/tessitura_rest/web/session.rb
Instance Method Summary collapse
- #create_session(ip, options = {}) ⇒ Object
- #get_expiration(key, options = {}) ⇒ Object
- #get_promotion(key, code, code_string, options = {}) ⇒ Object
- #get_renewals(key, season_id, renewal, mode_of_sale, options = {}) ⇒ Object
- #get_session(key, options = {}) ⇒ Object
- #get_shipping_methods(key, options = {}) ⇒ Object
- #get_variables(key, options = {}) ⇒ Object
- #load_existing_order(key, order_id, options = {}) ⇒ Object
- #send_credentials(key, email, login_type, template_id, options = {}) ⇒ Object
- #send_credentials_v16(key, email, login_type, template_id, options = {}) ⇒ Object
- #set_expiration(key, timeoffset, expiration, options = {}) ⇒ Object
- #set_expiration_v16(key, expiration, timeoffset = 0, options = {}) ⇒ Object
- #transfer_session(session_key, new_session_key, options = {}) ⇒ Object
- #update_login(key, user_name, old_password, new_password, email, new_email, options = {}) ⇒ Object
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, = {}) parameters = { 'IpAddress': ip, 'Organization': 'Tessitura Web', } .merge!(basic_auth: @auth, headers: @headers) .merge!(body: parameters.to_json) response = self.class.post(base_api_endpoint('Web/Session'), ) 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, = {}) .merge!(basic_auth: @auth, headers: @headers) response = self.class.get(base_api_endpoint("Web/Session/#{key}/Expiration"), ) 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, = {}) parameters = { 'PromoCode': code, 'PromoCodeString': code_string, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) response = self.class.post(base_api_endpoint("Web/Session/#{key}/PromoCode"), ) 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, = {}) .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}"), ) 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, = {}) .merge!(basic_auth: @auth, headers: @headers) response = self.class.get(base_api_endpoint("Web/Session/#{key}"), ) 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, = {}) .merge!(basic_auth: @auth, headers: @headers) response = self.class.get(base_api_endpoint("Web/Session/#{key}/DeliveryMethods"), ) 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, = {}) .merge!(basic_auth: @auth, headers: @headers) response = self.class.get(base_api_endpoint("Web/Session/#{key}/Variables"), ) 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, = {}) .merge!(basic_auth: @auth, headers: @headers) self.class.post(base_api_endpoint("Web/Session/#{key}/LoadOrder/#{order_id}"), ) 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, login_type, template_id, = {}) parameters = { 'TemplateFormatId': template_id, 'LoginTypeId': login_type, 'EmailAddress': email, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) self.class.post(base_api_endpoint("Web/Session/#{key}/Login/SendCredentials"), ) 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, login_type, template_id, = {}) parameters = { 'TemplateFormatId': template_id, 'LoginTypeId': login_type, 'EmailAddress': email, 'IsPriority': true, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) self.class.post(base_api_endpoint("Web/Session/#{key}/Login/SendCredentials"), ) 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, = {}) parameters = { 'Expiration': expiration, 'TimeOffset': timeoffset, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) response = self.class.put(base_api_endpoint("Web/Session/#{key}/Expiration"), ) 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, = {}) parameters = { 'Expiration': expiration, 'TimeOffset': timeoffset, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) response = self.class.put(base_api_endpoint("Web/Session/#{key}/Expiration"), ) 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, = {}) parameters = { 'NewSessionKey': new_session_key, } .merge!(basic_auth: @auth, headers: @headers) .merge!(body: parameters.to_json) self.class.post(base_api_endpoint("Web/Session/#{session_key}/Transfer"), ) 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 update_login(key, user_name, old_password, new_password, email, new_email, = {}) parameters = { 'LoginName': user_name, 'NewLoginName': new_email, 'Password': old_password, 'NewPassword': new_password, 'EmailAddress': email, 'NewEmailAddress': new_email, 'LoginTypeId': 1, 'PromotionCode': 0, } .merge!(basic_auth: @auth, headers: @headers) .merge!(:body => parameters.to_json) self.class.put(base_api_endpoint("Web/Session/#{key}/WebLogins"), ) end |