tessitura_rest 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +42 -0
  3. data/.gitignore +10 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +553 -0
  6. data/.travis.yml +5 -0
  7. data/CODE_OF_CONDUCT.md +49 -0
  8. data/Gemfile +10 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +89 -0
  11. data/Rakefile +14 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/lib/tessitura_rest.rb +52 -0
  15. data/lib/tessitura_rest/crm/accounts.rb +8 -0
  16. data/lib/tessitura_rest/crm/actions.rb +36 -0
  17. data/lib/tessitura_rest/crm/addresses.rb +122 -0
  18. data/lib/tessitura_rest/crm/attributes.rb +20 -0
  19. data/lib/tessitura_rest/crm/constituencies.rb +29 -0
  20. data/lib/tessitura_rest/crm/issues.rb +42 -0
  21. data/lib/tessitura_rest/crm/phones.rb +41 -0
  22. data/lib/tessitura_rest/crm/web_logins.rb +8 -0
  23. data/lib/tessitura_rest/custom/email.rb +30 -0
  24. data/lib/tessitura_rest/custom/local_procedure.rb +35 -0
  25. data/lib/tessitura_rest/diagnostics/diagnostics.rb +6 -0
  26. data/lib/tessitura_rest/finance/appeals.rb +7 -0
  27. data/lib/tessitura_rest/finance/gift_certificates.rb +7 -0
  28. data/lib/tessitura_rest/reference_data/billing_schedules.rb +6 -0
  29. data/lib/tessitura_rest/reference_data/countries.rb +7 -0
  30. data/lib/tessitura_rest/reference_data/sections.rb +7 -0
  31. data/lib/tessitura_rest/reference_data/states.rb +7 -0
  32. data/lib/tessitura_rest/security/security_user_groups.rb +8 -0
  33. data/lib/tessitura_rest/txn/orders.rb +23 -0
  34. data/lib/tessitura_rest/txn/package.rb +44 -0
  35. data/lib/tessitura_rest/txn/performance_extension.rb +44 -0
  36. data/lib/tessitura_rest/txn/performance_package_mode_of_sales.rb +8 -0
  37. data/lib/tessitura_rest/txn/price_types.rb +9 -0
  38. data/lib/tessitura_rest/txn/product_keywords.rb +9 -0
  39. data/lib/tessitura_rest/txn/production_extension.rb +14 -0
  40. data/lib/tessitura_rest/txn/production_season.rb +20 -0
  41. data/lib/tessitura_rest/txn/sub_line_items.rb +9 -0
  42. data/lib/tessitura_rest/txn/web_contents.rb +9 -0
  43. data/lib/tessitura_rest/version.rb +3 -0
  44. data/lib/tessitura_rest/web/cart.rb +293 -0
  45. data/lib/tessitura_rest/web/login.rb +55 -0
  46. data/lib/tessitura_rest/web/payment_plan_extension.rb +51 -0
  47. data/lib/tessitura_rest/web/session.rb +85 -0
  48. data/tessitura_rest.gemspec +29 -0
  49. metadata +189 -0
@@ -0,0 +1,29 @@
1
+ module Constituencies
2
+
3
+ def get_constituencies(id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("CRM/Constituencies?constituentId=#{id}"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+ def get_constituent_snapshot(id, options={})
10
+ options.merge!(basic_auth: @auth, headers: @headers)
11
+ response = self.class.get(base_api_endpoint("CRM/Constituents/#{id}/Snapshot"), options)
12
+ JSON.parse(response.body)
13
+ end
14
+
15
+ def create_constituencies(constituency, id, options={})
16
+ parameters =
17
+ {
18
+ 'ConstituencyType': {
19
+ 'Id': constituency
20
+ },
21
+ 'Constituent': {
22
+ 'Id': id
23
+ }
24
+ }
25
+ options.merge!(basic_auth: @auth, headers: @headers)
26
+ options.merge!(:body => parameters)
27
+ response = self.class.post(base_api_endpoint('CRM/Constituencies'), options)
28
+ end
29
+ end
@@ -0,0 +1,42 @@
1
+ module Issues
2
+
3
+ def get_issue(id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("CRM/Issues/#{id}"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+ def get_issues(constituent_id, start_date = Date.today, end_date = Date.today + 365, resolved = false, options={})
10
+ options.merge!(basic_auth: @auth, headers: @headers)
11
+ response = self.class.get(base_api_endpoint("CRM/Issues?constituentId=#{constituent_id}"), options)
12
+ JSON.parse(response.body)
13
+ end
14
+
15
+ def create_issue(activity_type, category_id, constituent_id, contact_type, notes, origin_id, options={})
16
+ parameters =
17
+ {
18
+ 'ActivityType': {
19
+ 'Id': activity_type,
20
+ 'Category': {
21
+ 'Id': category_id
22
+ }
23
+ },
24
+ 'ContactType': {
25
+ 'Id': contact_type
26
+ },
27
+ 'Constituent': {
28
+ 'Id': constituent_id
29
+ },
30
+ "Origin": {
31
+ "Id": origin_id
32
+ },
33
+ 'Notes': notes
34
+ }
35
+ parameters.delete(:Origin) unless origin_id.present?
36
+ options.merge!(basic_auth: @auth, headers: @headers)
37
+ options.merge!(:body => parameters)
38
+ response = self.class.post(base_api_endpoint('CRM/Issues'), options)
39
+ JSON.parse(response.body)
40
+ end
41
+
42
+ end
@@ -0,0 +1,41 @@
1
+ module Phones
2
+
3
+ def create_primary_phone(id, phone, options={})
4
+ parameters =
5
+ {
6
+ 'Constituent': {
7
+ 'Id': id
8
+ },
9
+ 'PhoneNumber': phone,
10
+ 'PhoneType': {
11
+ 'Description': 'Phone 1',
12
+ 'Id': 1,
13
+ 'Inactive': false
14
+ }
15
+ }
16
+ options.merge!(basic_auth: @auth, headers: @headers)
17
+ options.merge!(:body => parameters)
18
+ response = self.class.post(base_api_endpoint('CRM/Phones'), options)
19
+ JSON.parse(response.body)
20
+ end
21
+
22
+ def create_secondary_phone(id, phone, options={})
23
+ parameters =
24
+ {
25
+ 'Constituent': {
26
+ 'Id': id
27
+ },
28
+ 'PhoneNumber': phone,
29
+ 'PhoneType': {
30
+ 'Description': 'Phone 2',
31
+ 'Id': 2,
32
+ 'Inactive': false
33
+ }
34
+ }
35
+ options.merge!(basic_auth: @auth, headers: @headers)
36
+ options.merge!(:body => parameters)
37
+ response = self.class.post(base_api_endpoint('CRM/Phones'), options)
38
+ JSON.parse(response.body)
39
+ end
40
+
41
+ end
@@ -0,0 +1,8 @@
1
+ module WebLogins
2
+
3
+ def get_web_login(email, login_type, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("CRM/WebLogins/Search?emailAddress=#{email}&loginTypeId=#{login_type}"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+ end
@@ -0,0 +1,30 @@
1
+ module Email
2
+
3
+ def send_login_credentials(template_id, email, profile_id, params = '', options={})
4
+ login_id = get_web_login(email, 1)
5
+ return false if login_id.empty?
6
+ parameters =
7
+ {
8
+ 'TemplateId': template_id,
9
+ 'EmailAddress': email,
10
+ 'EmailProfileId': profile_id
11
+ }
12
+ options.merge!(basic_auth: @auth, headers: @headers)
13
+ options.merge!(:body => parameters.to_json, :headers => {'Content-Type' => 'application/json'})
14
+ post = self.class.post(base_api_endpoint("Emails/LoginCredentials/#{login_id.first['Id']}/Send"), options)
15
+ post.success?
16
+ end
17
+
18
+ def send_order_confirmation(template_id, email, profile_id, order_id, params = '', options={})
19
+ parameters =
20
+ {
21
+ 'TemplateId': template_id,
22
+ 'EmailAddress': email,
23
+ 'EmailProfileId': profile_id
24
+ }
25
+ options.merge!(basic_auth: @auth, headers: @headers)
26
+ options.merge!(:body => parameters.to_json, :headers => {'Content-Type' => 'application/json'})
27
+ post = self.class.post(base_api_endpoint("Emails/OrderConfirmation/#{order_id}/Send"), options)
28
+ post.success?
29
+ end
30
+ end
@@ -0,0 +1,35 @@
1
+ module LocalProcedure
2
+
3
+ def execute_local_procedure(id, params = "", options={})
4
+ parameters =
5
+ {
6
+ 'ProcedureId' => id.to_s,
7
+ 'Parameters' => params
8
+ }
9
+ options.merge!(basic_auth: @auth, headers: @headers)
10
+ options.merge!(:body => parameters.to_json, :headers => {'Content-Type' => 'application/json'})
11
+ self.class.post(base_api_endpoint('Custom/Execute'), options)
12
+ end
13
+
14
+ def execute_local_procedure_v2(id, params = [], options={})
15
+ parameters =
16
+ {
17
+ 'ProcedureId' => id.to_s,
18
+ 'ParameterValues' => params
19
+ }
20
+ options.merge!(basic_auth: @auth, headers: @headers)
21
+ options.merge!(:body => parameters.to_json, :headers => {'Content-Type' => 'application/json'})
22
+ self.class.post(base_api_endpoint('Custom/Execute'), options)
23
+ end
24
+
25
+ def execute_local_procedure_with_multiple_result_sets(id, parameter_values= [], options={})
26
+ parameters =
27
+ {
28
+ 'ProcedureId' => id.to_s,
29
+ 'ParameterValues' => parameter_values
30
+ }
31
+ options.merge!(basic_auth: @auth, headers: @headers)
32
+ options.merge!(:body => parameters.to_json, :headers => {'Content-Type' => 'application/json'})
33
+ self.class.post(base_api_endpoint('Custom/Execute/MultipleResultSets'), options)
34
+ end
35
+ end
@@ -0,0 +1,6 @@
1
+ module Diagnostics
2
+ def diagnostics_status(options={})
3
+ options.merge!(basic_auth: @auth, headers: @headers)
4
+ self.class.get(base_api_endpoint('Diagnostics/Status'), options)
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module Appeals
2
+
3
+ def get_appeal_info (appeal_id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("Finance/Appeals/#{appeal_id}"), options)
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module GiftCertificates
2
+
3
+ def get_gift_certificate_info (gift_certificate_number, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("Finance/GiftCertificates/#{gift_certificate_number}"), options)
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ module BillingSchedules
2
+ def get_billing_schedules(options = {})
3
+ options.merge!(basic_auth: @auth, headers: @headers)
4
+ self.class.get(base_api_endpoint('ReferenceData/BillingSchedules'), options)
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module Countries
2
+
3
+ def get_all_countries (options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("ReferenceData/Countries"), options)
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Sections
2
+
3
+ def get_section (id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("ReferenceData/Sections/#{id}"), options)
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module States
2
+
3
+ def get_all_states (options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("ReferenceData/States"), options)
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ module SecurityUserGroups
2
+
3
+ def security_user_groups(login, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("Security/UserGroups/Default?userName=#{login}"), options)
6
+ JSON.parse(response.body)["UserGroup"]
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ module Orders
2
+
3
+ def get_products_view(id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("TXN/Orders/#{id}/ProductsView"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+
10
+
11
+ def print_order_ticket_elements(order_id, ticket_design, reprint, new_ticket_no=false, options={})
12
+ parameters =
13
+ {
14
+ "IncludeReceipts": false,
15
+ "ReprintTickets": reprint,
16
+ "TicketDesignId": ticket_design,
17
+ "NewTicketNoForReprints": new_ticket_no
18
+ }
19
+ options.merge!(basic_auth: @auth, headers: @headers)
20
+ options.merge!(:body => parameters)
21
+ self.class.post(base_api_endpoint("/TXN/Orders/#{order_id}/PrintTicketElements"), options)
22
+ end
23
+ end
@@ -0,0 +1,44 @@
1
+ module Package
2
+
3
+ def get_package_by_id(id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("TXN/Packages/#{id}"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+ def packages_by_performance_date(start_date=nil, end_date=nil, options={})
10
+ parameters =
11
+ {
12
+ 'PerformanceStartDate': start_date,
13
+ 'PerformanceEndDate': end_date
14
+ }
15
+ options.merge!(basic_auth: @auth, headers: @headers)
16
+ options.merge!(:body => parameters)
17
+ response = self.class.post(base_api_endpoint('TXN/Packages/Search'), options)
18
+
19
+ end
20
+
21
+ def get_package_detail(id, mode_of_sale, options={})
22
+ options.merge!(basic_auth: @auth, headers: @headers)
23
+ response = self.class.get(base_api_endpoint("TXN/Packages/#{id}/Details?modeOfSaleId=#{mode_of_sale}"), options)
24
+ JSON.parse(response.body)
25
+ end
26
+
27
+ def get_package_prices(id, mode_of_sale, options={})
28
+ options.merge!(basic_auth: @auth, headers: @headers)
29
+ response = self.class.get(base_api_endpoint("TXN/Packages/#{id}/Prices?modeOfSaleId=#{mode_of_sale}"), options)
30
+ JSON.parse(response.body)
31
+ end
32
+
33
+ def get_package_performance_groups(id, mode_of_sale=nil, options={})
34
+ options.merge!(basic_auth: @auth, headers: @headers)
35
+ response = self.class.get(base_api_endpoint("TXN/Packages/#{id}/PerformanceGroups?modeOfSaleId=#{mode_of_sale}"), options)
36
+ JSON.parse(response.body)
37
+ end
38
+
39
+ def get_package_seats(id, mode_of_sale, constituent_id, section_id, options={})
40
+ options.merge!(basic_auth: @auth, headers: @headers)
41
+ response = self.class.get(base_api_endpoint("TXN/Packages/#{id}/Seats?modeOfSaleId=#{mode_of_sale}&constituentId=#{constituent_id}&sectionIds=#{section_id}"), options)
42
+ JSON.parse(response.body)
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ module PerformanceExtension
2
+
3
+ def get_performances_by_production(ids, mode_of_sale=nil, options={})
4
+ parameters =
5
+ {
6
+ 'ProductionSeasonIds': ids,
7
+ 'ModeOfSaleId': mode_of_sale
8
+ }
9
+ options.merge!(basic_auth: @auth, headers: @headers)
10
+ options.merge!(:body => parameters)
11
+ response = self.class.post(base_api_endpoint('TXN/Performances/Search'), options)
12
+ end
13
+
14
+ def get_performance_summaries(production_season_id, performance_ids=nil, season_ids=nil, options={})
15
+ options.merge!(basic_auth: @auth, headers: @headers)
16
+ response = self.class.get(base_api_endpoint("/TXN/Performances/Summary?performanceIds=#{performance_ids}&seasonIds=#{season_ids}&productionSeasonId=#{production_season_id}"), options)
17
+ JSON.parse(response.body)
18
+ end
19
+
20
+ def get_performance_detail(id, options={})
21
+ options.merge!(basic_auth: @auth, headers: @headers)
22
+ response = self.class.get(base_api_endpoint("TXN/Performances?performanceIds=#{id}"), options)
23
+ JSON.parse(response.body)
24
+ end
25
+
26
+ def get_performance_availability(ids, sections_ids=nil, options={})
27
+ options.merge!(basic_auth: @auth, headers: @headers)
28
+ response = self.class.get(base_api_endpoint("TXN/Performances/Zones?performanceIds=#{ids}&sectionIds=#{sections_ids}"), options)
29
+ JSON.parse(response.body)
30
+ end
31
+
32
+ def get_performance_seats(id, mode_of_sale, constituent_id, section_id, options={})
33
+ options.merge!(basic_auth: @auth, headers: @headers)
34
+ response = self.class.get(base_api_endpoint("TXN/Performances/#{id}/Seats?modeOfSaleId=#{mode_of_sale}&constituentId=#{constituent_id}&sectionIds=#{section_id}"), options)
35
+ JSON.parse(response.body)
36
+ end
37
+
38
+ def get_performance_seat_summaries(id, options={})
39
+ options.merge!(basic_auth: @auth, headers: @headers)
40
+ response = self.class.get(base_api_endpoint("TXN/Performances/#{id}/Seats/Summary"), options)
41
+ JSON.parse(response.body)
42
+ end
43
+
44
+ end
@@ -0,0 +1,8 @@
1
+ module PerformancePackageModeOfSales
2
+
3
+ def performance_package_mode_of_sales(mode_of_sale, ids, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ self.class.get(base_api_endpoint("TXN/PerformancePackageModeOfSales?modeOfSaleId=#{mode_of_sale}&performanceIds=#{ids}"), options)
6
+ end
7
+
8
+ end
@@ -0,0 +1,9 @@
1
+ module PriceTypes
2
+
3
+ def get_price_type(id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("TXN/PriceTypes/#{id}"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ module ProductKeywords
2
+
3
+ def get_keywords(ids, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("TXN/ProductKeywords?productionElementIds=#{ids}"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+ end
@@ -0,0 +1,14 @@
1
+ module ProductionExtension
2
+
3
+ def get_production(id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("TXN/Productions/#{id}"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+ def get_production_details(id, options={})
10
+ options.merge!(basic_auth: @auth, headers: @headers)
11
+ response = self.class.get(base_api_endpoint("TXN/Productions/#{id}"), options)
12
+ JSON.parse(response.body)
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ module ProductionSeason
2
+
3
+ def get_production_season(id, options={})
4
+ options.merge!(basic_auth: @auth, headers: @headers)
5
+ response = self.class.get(base_api_endpoint("TXN/ProductionSeasons/#{id}"), options)
6
+ JSON.parse(response.body)
7
+ end
8
+
9
+ def productions_by_performance_date(start_date=nil, end_date=nil, options={})
10
+ parameters =
11
+ {
12
+ 'PerformanceStartDate': start_date,
13
+ 'PerformanceEndDate': end_date
14
+ }
15
+ options.merge!(basic_auth: @auth, headers: @headers)
16
+ options.merge!(:body => parameters)
17
+ response = self.class.post(base_api_endpoint('TXN/ProductionSeasons/Search'), options)
18
+ end
19
+
20
+ end