Add initializer and default models

This will install a configuration file in config/initializers/bookingsync_portal.rb as well as creating default models:

rails g bookingsync_portal:install

Assets

You will need to install the assets for each namespace:

in /app/assets/javascripts/admin/application.js:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require bookingsync_portal/admin/application
//= require_tree .

in /app/assets/javascripts/admin/application.css.scss:

/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require bookingsync_portal/admin/application
*= require_self
*/

Note: When saving new token, this gem uses a separate thread with new db connection to ensure token save (in case of a rollback in the main transaction). To make room for the new connections, it is recommended to increase db pool size by 2-3.

Configuration

The engine is configured by the following ENV variables:

BOOKINGSYNC_URL - the url of the website, should be https://www.bookingsync.com

BOOKINGSYNC_APP_ID - BookingSync Application's Client ID

BOOKINGSYNC_APP_SECRET - BookingSync Application's Client Secret

BOOKINGSYNC_VERIFY_SSL - Verify SSL (available only in development or test). Default to false

BOOKINGSYNC_SCOPE - Space separated list of required scopes. Defaults to nil, which means the public scope.

You might want to use dotenv-rails
to make ENV variables management easy.

Rack::Lock is not recommended with message_bus gem, causing deadlock problems. You might want to add this line to your app development.rb file:

config.middleware.deleteRack::Lock

Testing

RSpec

We do provide some helper for RSpec users, you can include them in your spec/rails_helper.rb (before spec/support inclusion):

require'bookingsync_application/spec_helper'

VCR

We recommend a VCR setup inspired from the following configuration. It will mask authorization tokens from your fixtures:

require'vcr'VCR.configuredo|config|config.cassette_library_dir='spec/fixtures/cassettes'config.hook_into:webmockconfig.configure_rspec_metadata!config.filter_sensitive_data('BOOKINGSYNC_OAUTH_ACCESS_TOKEN')doENV['BOOKINGSYNC_OAUTH_ACCESS_TOKEN']end# Uncomment if using codeclimate
# config.ignore_hosts 'codeclimate.com'
end