TessituraRest
A Ruby gem wrapper for the TessituraRest Network's Rest API (version 14 and up).
Installation
Add this line to your application's Gemfile:
gem 'tessitura_rest'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tessitura_rest
Usage
Create a .env file in the root of your directory. The following fields are required:
- TESSITURA_v16_URL # the url to your Production TessituraRest REST instance
- TESSITURA_USERNAME # the username to authenticate to your TessituraRest REST instance
- TESSITURA_PASSWORD # the password to authenticate to your TessituraRest REST instance
To run the gem locally, use:
$ rake console
To connect to the TessituraRest Rest API, use:
TessituraRest.new
followed by the method and arguments you would like to use.
Running the Test Suite
- You will need to add valid environment variables to the gem to run the test suite.
- Delete all of the pre-recorded cassette tapes from spec/vcr_cassettes so they can be re-recorded with your instance's settings.
- Create a .env file and set these values:
| Section | Variable | Description |
|---|---|---|
| Authentication | TESSITURA_v16_URL | The url to your Test/Staging TessituraRest REST instance |
| TESSITURA_USERNAME | The username to authenticate to your TessituraRest REST instance | |
| TESSITURA_PASSWORD | The password to authenticate to your TessituraRest REST instance | |
| Web sessions | SESSION_KEY | An existing session key in your TessituraRest instance |
| LOGGED_IN | A session key whose constituent has been logged in via login_using_email | |
| RETURN_TICKET_KEY | A logged in session that contains a exchangeable ticket | |
| WEB_LOGIN | An email address tied to a usable web login on the test instance | |
| LOGIN_PASSWORD | The password for WEB_LOGIN | |
| An email tied to an existing web login in your instance | ||
| Constituents | CONSTITUENT_ID | An active constituent in your instance |
| HOUSEHOLD_ID | An active household constituent (constituent_type = 9) with at least two affiliates | |
| SCALPER_ID | Any active constituent that has constituencies attached | |
| PHONE_ID | The ID of an existing phone record on a constituent | |
| ATTRIBUTE_ID | An active attribute (TR_KEYWORDS) whose data type accepts the test value | |
| CSI_ID | The ID of an open customer service inquiry in your instance | |
| PATRON_ID | The patron ID of a user whom submits CSIs | |
| ACTION_ID | The ID of an action made against a customer service inquiry in your instance | |
| ACTION_TYPE | A valid action type that can be attributed to an action on a customer service inquiry | |
| CREDIT_CARD_ACCOUNT_ID | An existing stored credit-card account ID (safe to delete in test) | |
| APPEAL_ID | An active appeal Id | |
| Productions and pricing | PRODUCTION_ID | An active production season Id with at least one performance |
| PERFORMANCE_ID | An active performance ID under that production season | |
| PRICE_TYPE_ID | An active price type ID | |
| SEASON_ID | An active season Id used by Web/Session order search | |
| WEB_CART_TEXT | the ID to the pricing rule you have setup for Cart | |
| PROMO_CODE | A valid integer tied to an active promotion code | |
| PROMO_CODE_STRING | The matching string for that promotion code | |
| Payments and funds | FUND | An active fund to apply contributions to |
| FUND2 | A second active fund (used by add_membership_by_amount) | |
| MEMBER | An active membership level | |
| CURRENT_USER | Constituent Id with an on-account balance (typically same as CONSTITUENT_ID) | |
| ON_ACCOUNT | The PaymentMethodId used to filter on-account balances | |
| PAYMENT_ID | An active payment auth ID allowing on-account contributions in cart | |
| GIFT_CARD_NO | A valid gift certificate number that has been purchased | |
| APPLIED_GC | A valid gift certificate number that can be applied to a cart | |
| Orders & email templates | ORDER_ID | An existing Order Id (used by Orders and order-confirmation email specs) |
| PROFILE_ID | A valid email template profile ID used when sending mail | |
| TEMPLATE_ID | Email template ID to send Forgot Password emails | |
| ORDER_CONFIRMATION_TEMPLATE_ID | Email template ID for order confirmation emails |
To run the tests:
$ rake spec
WARNING: I advise you NOT to run the test suite against your Production TessituraRest API since it will make database alterations.
Updating CircleCI's Environment Variables
- Go to the CircleCI dashboard for the tessitura gem.
- Click on the gear icon in the upper right corner.
- Click on the tessitura gem project.
- Click on Environment Variables.
- Encode your .env with
base64 -i .env -o .env_encand add the encoded string to the ENV_ENC variable.
Development
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.
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.
Contributing
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 code of conduct.
License
The gem is available as open source under the terms of the MIT License.
