[![Test Coverage](https://api.codeclimate.com/v1/badges/7e9be54ce754061ff52a/test_coverage)](https://codeclimate.com/repos/5a8308622f7e3e028700068f/test_coverage) [![Maintainability](https://api.codeclimate.com/v1/badges/7e9be54ce754061ff52a/maintainability)](https://codeclimate.com/repos/5a8308622f7e3e028700068f/maintainability) # TessituraRest A Ruby gem wrapper for the [TessituraRest Network's Rest API](https://www.tessituranetwork.com/) (version 14 and up). ## Installation Add this line to your application's Gemfile: ```ruby 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 1. You will need to add valid environment variables to the gem to run the test suite. 2. Delete all of the pre-recorded cassettes tapes from spec/vcr_cassettes so they can be re-recorded with your instance's settings. 3. Create a .env file and set these values: * TESSITURA_URL # the url to your Test/Staging TessituraRest REST instance * USERNAME # the username to authenticate to your TessituraRest REST instance * PASSWORD # the password to authenticate to your TessituraRest REST instance * WEB_CART_TEXT # the ID to the pricing rule you have setup for Cart * SESSION_KEY # an existing session key in your TessituraRest instance * EMAIL # an email tied to an existing web login in your TessituraRest instance * CONSTITUENT_ID # an active constituent in your TessituraRest instance * ATTRIBUTE_ID # an active Attribute in your TessituraRest instance * SCALPER_ID # any active constituent in your TessituraRest instance * CSI_ID # the id of an open customer service inquiry in your TessituraRest 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 TessituraRest instance * ACTION_TYPE # a valid action type that can be attributed to an action on a customer service inquiry * PROMO_CODE # a valid integer tied to an active promotion code * PROMO_CODE_STRING # a valid string tied to an active promotion code * FUND # an active fund to apply money to * FUND2 # another active fund to apply money to * MEMBER # an active membership level * PAYMENT_ID # active payment auth ID * GIFT_CARD_NO # a valid gift certificate number that has been purchased * APPLIED_GC # a valid gift certificate number that can be used to purchase products * RETURN_TICKET_KEY # a logged in session that contains a exchangeable ticket * TEMPLATE_ID # a valid email template ID to send Forgot Password emails * PROFILE_ID # a valid email template profile ID 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 1. Go to the CircleCI dashboard for the tessitura gem. 2. Click on the gear icon in the upper right corner. 3. Click on the tessitura gem project. 4. Click on Environment Variables. 5. Encode your .env with ```base64 -i .env -o .env_enc``` and 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](https://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](http://contributor-covenant.org) code of conduct. ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).