tessitura_rest 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +42 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.rubocop.yml +553 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +89 -0
- data/Rakefile +14 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/tessitura_rest.rb +52 -0
- data/lib/tessitura_rest/crm/accounts.rb +8 -0
- data/lib/tessitura_rest/crm/actions.rb +36 -0
- data/lib/tessitura_rest/crm/addresses.rb +122 -0
- data/lib/tessitura_rest/crm/attributes.rb +20 -0
- data/lib/tessitura_rest/crm/constituencies.rb +29 -0
- data/lib/tessitura_rest/crm/issues.rb +42 -0
- data/lib/tessitura_rest/crm/phones.rb +41 -0
- data/lib/tessitura_rest/crm/web_logins.rb +8 -0
- data/lib/tessitura_rest/custom/email.rb +30 -0
- data/lib/tessitura_rest/custom/local_procedure.rb +35 -0
- data/lib/tessitura_rest/diagnostics/diagnostics.rb +6 -0
- data/lib/tessitura_rest/finance/appeals.rb +7 -0
- data/lib/tessitura_rest/finance/gift_certificates.rb +7 -0
- data/lib/tessitura_rest/reference_data/billing_schedules.rb +6 -0
- data/lib/tessitura_rest/reference_data/countries.rb +7 -0
- data/lib/tessitura_rest/reference_data/sections.rb +7 -0
- data/lib/tessitura_rest/reference_data/states.rb +7 -0
- data/lib/tessitura_rest/security/security_user_groups.rb +8 -0
- data/lib/tessitura_rest/txn/orders.rb +23 -0
- data/lib/tessitura_rest/txn/package.rb +44 -0
- data/lib/tessitura_rest/txn/performance_extension.rb +44 -0
- data/lib/tessitura_rest/txn/performance_package_mode_of_sales.rb +8 -0
- data/lib/tessitura_rest/txn/price_types.rb +9 -0
- data/lib/tessitura_rest/txn/product_keywords.rb +9 -0
- data/lib/tessitura_rest/txn/production_extension.rb +14 -0
- data/lib/tessitura_rest/txn/production_season.rb +20 -0
- data/lib/tessitura_rest/txn/sub_line_items.rb +9 -0
- data/lib/tessitura_rest/txn/web_contents.rb +9 -0
- data/lib/tessitura_rest/version.rb +3 -0
- data/lib/tessitura_rest/web/cart.rb +293 -0
- data/lib/tessitura_rest/web/login.rb +55 -0
- data/lib/tessitura_rest/web/payment_plan_extension.rb +51 -0
- data/lib/tessitura_rest/web/session.rb +85 -0
- data/tessitura_rest.gemspec +29 -0
- metadata +189 -0
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at brittany.jill.martin@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 The Pittsburgh Cultural Trust
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# TessituraRest
|
2
|
+
|
3
|
+
A Ruby gem wrapper for the [TessituraRest Network's Rest API](https://www.tessituranetwork.com/) (version 14 and up).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'tessitura_rest'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
```
|
15
|
+
$ bundle
|
16
|
+
```
|
17
|
+
Or install it yourself as:
|
18
|
+
```
|
19
|
+
$ gem install tessitura_rest
|
20
|
+
```
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Create a .env file in the root of your directory. The following fields are required:
|
24
|
+
|
25
|
+
* TESSITURA_URL # the url to your Production TessituraRest REST instance
|
26
|
+
* TESSITURA_USERNAME # the username to authenticate to your TessituraRest REST instance
|
27
|
+
* TESSITURA_PASSWORD # the password to authenticate to your TessituraRest REST instance
|
28
|
+
|
29
|
+
To run the gem locally, use:
|
30
|
+
```
|
31
|
+
$ rake console
|
32
|
+
```
|
33
|
+
To connect to the TessituraRest Rest API, use:
|
34
|
+
```
|
35
|
+
TessituraRest.new
|
36
|
+
```
|
37
|
+
followed by the method and arguments you would like to use.
|
38
|
+
|
39
|
+
## Running the Test Suite
|
40
|
+
|
41
|
+
1. You will need to add valid environment variables to the gem to run the test suite.
|
42
|
+
2. Delete all of the pre-recorded cassettes tapes from spec/vcr_cassettes so they can be re-recorded with your instance's settings.
|
43
|
+
3. Create a .env file and set these values:
|
44
|
+
|
45
|
+
* TESSITURA_URL # the url to your Test/Staging TessituraRest REST instance
|
46
|
+
* TESSITURA_USERNAME # the username to authenticate to your TessituraRest REST instance
|
47
|
+
* TESSITURA_PASSWORD # the password to authenticate to your TessituraRest REST instance
|
48
|
+
* WEB_CART_TEXT # the ID to the pricing rule you have setup for Cart
|
49
|
+
* ORDER_CONFIRM_TEXT # the ID to the pricing rule you have setup for Order Confirmations
|
50
|
+
* SESSION_KEY # an existing session key in your TessituraRest instance
|
51
|
+
* EMAIL # an email tied to an existing web login in your TessituraRest instance
|
52
|
+
* CONSTITUENT_ID # an active constituent in your TessituraRest instance
|
53
|
+
* ATTRIBUTE_ID # an active Attribute in your TessituraRest instance
|
54
|
+
* SCALPER_ID # any active constituent in your TessituraRest instance
|
55
|
+
* CSI_ID # the id of an open customer service inquiry in your TessituraRest instance
|
56
|
+
* PATRON_ID # the patron ID of a user whom submits CSIs
|
57
|
+
* ACTION_ID # the id of an action made against a customer service inquiry in your TessituraRest instance
|
58
|
+
* ACTION_TYPE # a valid action type that can be attributed to an action on a customer service inquiry
|
59
|
+
* PROMO_CODE # a valid integer tied to an active promotion code
|
60
|
+
* PROMO_CODE_STRING # a valid string tied to an active promotion code
|
61
|
+
* FUND # an active fund to apply money to
|
62
|
+
* FUND2 # another active fund to apply money to
|
63
|
+
* MEMBER # an active membership level
|
64
|
+
* PAYMENT_ID # active payment auth ID
|
65
|
+
* GIFT_CARD_NO # a valid gift certificate number that has been purchased
|
66
|
+
* APPLIED_GC # a valid gift certificate number that can be used to purchase products
|
67
|
+
* RETURN_TICKET_KEY # a logged in session that contains a exchangeable ticket
|
68
|
+
* TEMPLATE_ID # a valid email template ID to send Forgot Password emails
|
69
|
+
* PROFILE_ID # a valid email template profile ID
|
70
|
+
|
71
|
+
To run the tests:
|
72
|
+
```
|
73
|
+
$ rake spec
|
74
|
+
```
|
75
|
+
WARNING: I advise you NOT to run the test suite against your Production TessituraRest API since it will make database alterations.
|
76
|
+
|
77
|
+
## Development
|
78
|
+
|
79
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
80
|
+
|
81
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
82
|
+
|
83
|
+
## Contributing
|
84
|
+
|
85
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pgharts/tessitura. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
86
|
+
|
87
|
+
## License
|
88
|
+
|
89
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "tessitura"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'require_all'
|
2
|
+
require_rel 'tessitura_rest'
|
3
|
+
require 'json'
|
4
|
+
require 'httparty'
|
5
|
+
|
6
|
+
class TessituraRest
|
7
|
+
include HTTParty
|
8
|
+
|
9
|
+
include Accounts
|
10
|
+
include Actions
|
11
|
+
include Addresses
|
12
|
+
include Attributes
|
13
|
+
include Appeals
|
14
|
+
include BillingSchedules
|
15
|
+
include Cart
|
16
|
+
include Constituencies
|
17
|
+
include Countries
|
18
|
+
include Diagnostics
|
19
|
+
include Email
|
20
|
+
include GiftCertificates
|
21
|
+
include Issues
|
22
|
+
include LocalProcedure
|
23
|
+
include Login
|
24
|
+
include Orders
|
25
|
+
include Package
|
26
|
+
include PaymentPlanExtension
|
27
|
+
include PerformanceExtension
|
28
|
+
include PerformancePackageModeOfSales
|
29
|
+
include Phones
|
30
|
+
include PriceTypes
|
31
|
+
include ProductionExtension
|
32
|
+
include ProductKeywords
|
33
|
+
include ProductionSeason
|
34
|
+
include Sections
|
35
|
+
include Session
|
36
|
+
include SecurityUserGroups
|
37
|
+
include States
|
38
|
+
include SubLineItems
|
39
|
+
include WebContents
|
40
|
+
include WebLogins
|
41
|
+
|
42
|
+
def initialize(options={})
|
43
|
+
@auth = { username: ENV['TESSITURA_USERNAME'],
|
44
|
+
password: ENV['TESSITURA_PASSWORD'] }
|
45
|
+
@headers = { 'Accept': 'application/json' }
|
46
|
+
end
|
47
|
+
|
48
|
+
def base_api_endpoint(end_point)
|
49
|
+
"#{ENV['TESSITURA_URL']}#{end_point}"
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module Accounts
|
2
|
+
|
3
|
+
def get_all_accounts(constituent_id, inactive=false, include_affiliate=false, options={})
|
4
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
5
|
+
response = self.class.get(base_api_endpoint("CRM/Accounts?constituentId=#{constituent_id}&includeInactive=#{inactive}&includeAffiliates=#{include_affiliate}"), options)
|
6
|
+
JSON.parse(response.body)
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Actions
|
2
|
+
|
3
|
+
def get_action(id, options={})
|
4
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
5
|
+
response = self.class.get(base_api_endpoint("CRM/Actions/#{id}"), options)
|
6
|
+
JSON.parse(response.body)
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_actions(constituent_id, issue_id, options={})
|
10
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
11
|
+
response = self.class.get(base_api_endpoint("CRM/Actions?constituentId=#{constituent_id}&issueId=#{issue_id}"), options)
|
12
|
+
JSON.parse(response.body)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_action(action_type, constituent_id, issue_id, notes = '', options={})
|
16
|
+
parameters =
|
17
|
+
{
|
18
|
+
'ActionType': {
|
19
|
+
'Id': action_type
|
20
|
+
},
|
21
|
+
'Issue': {
|
22
|
+
'Id': issue_id
|
23
|
+
},
|
24
|
+
'Constituent': {
|
25
|
+
'Id': constituent_id
|
26
|
+
},
|
27
|
+
'Notes': notes,
|
28
|
+
'Resolved': true,
|
29
|
+
}
|
30
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
31
|
+
options.merge!(:body => parameters)
|
32
|
+
response = self.class.post(base_api_endpoint('CRM/Actions'), options)
|
33
|
+
JSON.parse(response.body)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
module Addresses
|
2
|
+
|
3
|
+
def get_address(address_id, options={})
|
4
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
5
|
+
response = self.class.get(base_api_endpoint("CRM/Addresses/#{address_id}"), options)
|
6
|
+
JSON.parse(response.body)
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_all_addresses(constituent_id, options={})
|
10
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
11
|
+
response = self.class.get(base_api_endpoint("CRM/Addresses?constituentId=#{constituent_id}"), options)
|
12
|
+
JSON.parse(response.body)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_address(constituent, address_type, city, postal_code, state, country, street1, street2, primary, options={})
|
16
|
+
parameters =
|
17
|
+
{
|
18
|
+
'AddressType': {
|
19
|
+
'Id': address_type
|
20
|
+
},
|
21
|
+
'City': city,
|
22
|
+
'Constituent': {
|
23
|
+
'Id': constituent
|
24
|
+
},
|
25
|
+
'Inactive': false,
|
26
|
+
'Label': true,
|
27
|
+
'Months': 'YYYYYYYYYYYY',
|
28
|
+
'PostalCode': postal_code,
|
29
|
+
'PrimaryIndicator': primary,
|
30
|
+
'State': {
|
31
|
+
'Id': state,
|
32
|
+
'Country': {
|
33
|
+
'Id': country
|
34
|
+
}
|
35
|
+
},
|
36
|
+
'Street1': street1,
|
37
|
+
'Street2': street2,
|
38
|
+
'Country': {
|
39
|
+
'Id': country
|
40
|
+
}
|
41
|
+
}
|
42
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
43
|
+
options.merge!(:body => parameters)
|
44
|
+
response = self.class.post(base_api_endpoint("CRM/Addresses"), options)
|
45
|
+
JSON.parse(response.body)
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_address(id, address_type, city, postal_code, state, country, street1, street2, primary, options={})
|
49
|
+
current = get_address(id)
|
50
|
+
parameters =
|
51
|
+
{
|
52
|
+
'Id': id,
|
53
|
+
'UpdatedDateTime': current['UpdatedDateTime'],
|
54
|
+
'AddressType': {
|
55
|
+
'Id': address_type
|
56
|
+
},
|
57
|
+
'City': city,
|
58
|
+
'Constituent': {
|
59
|
+
'Id': current['Constituent']['Id']
|
60
|
+
},
|
61
|
+
'Inactive': false,
|
62
|
+
'Label': true,
|
63
|
+
'Months': 'YYYYYYYYYYYY',
|
64
|
+
'PostalCode': postal_code,
|
65
|
+
'PrimaryIndicator': primary,
|
66
|
+
'State': {
|
67
|
+
'Id': state,
|
68
|
+
'Country': {
|
69
|
+
'Id': country
|
70
|
+
}
|
71
|
+
},
|
72
|
+
'Street1': street1,
|
73
|
+
'Street2': street2,
|
74
|
+
'Country': {
|
75
|
+
'Id': country
|
76
|
+
}
|
77
|
+
}
|
78
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
79
|
+
options.merge!(:body => parameters)
|
80
|
+
response = self.class.put(base_api_endpoint("CRM/Addresses/#{id}"), options)
|
81
|
+
JSON.parse(response.body)
|
82
|
+
end
|
83
|
+
|
84
|
+
def deactivate_address(id, options={})
|
85
|
+
current = get_address(id)
|
86
|
+
parameters =
|
87
|
+
{
|
88
|
+
'Id': id,
|
89
|
+
'UpdatedDateTime': current['UpdatedDateTime'],
|
90
|
+
'AddressType': {
|
91
|
+
'Id': current['AddressType']['Id']
|
92
|
+
},
|
93
|
+
'City': current['City'],
|
94
|
+
'Constituent': {
|
95
|
+
'Id': current['Constituent']['Id']
|
96
|
+
},
|
97
|
+
'Inactive': true,
|
98
|
+
'Label': true,
|
99
|
+
'Months': 'YYYYYYYYYYYY',
|
100
|
+
'PostalCode': current['PostalCode'],
|
101
|
+
'State': {
|
102
|
+
'Id': current['State']['Id'],
|
103
|
+
'Country': {
|
104
|
+
'Id': current['Country']['Id']
|
105
|
+
}
|
106
|
+
},
|
107
|
+
'Street1': current['Street1'],
|
108
|
+
'Street2': current['Street2'],
|
109
|
+
'Country': {
|
110
|
+
'Id': current['Country']['Id']
|
111
|
+
}
|
112
|
+
}
|
113
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
114
|
+
options.merge!(:body => parameters)
|
115
|
+
self.class.put(base_api_endpoint("CRM/Addresses/#{id}"), options)
|
116
|
+
end
|
117
|
+
|
118
|
+
def delete_address(address_id, options={})
|
119
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
120
|
+
self.class.delete(base_api_endpoint("CRM/Addresses/#{address_id}"), options)
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Attributes
|
2
|
+
|
3
|
+
def add_attribute(constituent_id, attribute_id, value, options={})
|
4
|
+
parameters =
|
5
|
+
{
|
6
|
+
'Keyword' => {
|
7
|
+
'Id'=> attribute_id
|
8
|
+
},
|
9
|
+
'Constituent'=> {
|
10
|
+
'Id'=> constituent_id
|
11
|
+
},
|
12
|
+
'Value'=> value,
|
13
|
+
'UpdatedDateTime'=> DateTime.now.to_s
|
14
|
+
}
|
15
|
+
options.merge!(basic_auth: @auth, headers: @headers)
|
16
|
+
options.merge!(:body => parameters)
|
17
|
+
response = self.class.post(base_api_endpoint('CRM/Attributes'), options)
|
18
|
+
JSON.parse(response.body)
|
19
|
+
end
|
20
|
+
end
|