Library to interface InterExchange with the CampMinder ClientLink API.
Add this line to your application's Gemfile:
gem 'CampMinder'And then execute:
$ bundle
Or install it yourself as:
$ gem install CampMinder
Environment variables are used to configure your CampMinder credentials.
CAMPMINDER_BUSINESS_PARTNER_ID:
The integer ID of your company in CampMinder's system.
CAMPMINDER_SECRET_CODE:
The secret code of your company in CampMinder's system.
CAMPMINDER_WEB_SERVICE_URL:
A URL on CampMinder’s system to which you will send all
outgoing requests.
CAMPMINDER_REDIRECTION_URL:
A URL on CampMinder’s system to which you will redirect control as
the last step of the Connection Establishment procedure.
CAMPMINDER_PROXY_URL:
Optional. If set, any communications with CampMinder's system will
be sent through a proxy.
For local gem testing there is a .env file in this respository with
sample settings.
To enable logging is as simple as setting the logger on CampMinder:
CampMinder.logger = Rails.logger
An initializer is a good place to do this when using the gem in a Rails project.
Set up the route to your CampMinder endpoint in config/routes.rb
post "camp_minder_handler", to: "camp_minder_handler#create"
Set up your app/controllers/camp_minder_handler_controller.rb
class CampMinderHandlerController < ActionController::Base
include ::CampMinder::HandlerController
end
For the ClientLinkRequest, your controller will need to implement three methods.
valid_username_password? takes username and password as parameters and should
return true or false depending on whether or not the user exists in your application.
def valid_username_password?(username, password)
@user = ::User.find_by_email(username)
@user.present? && @user.valid_password?(password)
end
partner_client_id should return your application's ID for the user's employer.
def partner_client_id
@user.employer.id
end
store_partner_client takes partner_client_id, , client_id, person_id, token, and connection_status
as arguments, and should store these in some form in your database. Returns true on success.
def store_partner_client(partner_client_id, client_id, person_id, token, connection_status)
CampMinderPartnerClientConnection.create(
partner_client_id: partner_client_id,
client_id: client_id,
person_id: person_id,
token: token,
connection_status: connection_status
).valid?
end
POST https://partner.eg/camp_minder_handler CONTENT-TYPE ?multipart/form-data?
All Classes are namespaced within CampMinder, we're using example documentation
provided to us by CampMinder to build the domain tests.
InterExchange is the partner, we're the system which is going to connect to CampMinder
A Camp is the Client, this is the place where the Staff are going to be working
A Camp's Contact is going to be a Person who authorizes the link between the Client and us, the Partner
As a staffing partner we use the API to send Staff for the client.
$ rake
There is a dummy rails app at spec/dummy, the gems spec suite should be used to execute these tests, eg:
rspec spec/dummy/spec/
- Fork it ( https://github.com/interexchange/campminder-rb/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
LICENSE.txt