Giter Club home page Giter Club logo

ministryofjustice.glimr-api-client's Introduction

Build Status

GlimrApiClient

A simple client to integrate with the GLiMR case management system in use in various UK tribunals.

Usage

Configuration

The gem expects a GLIMR_API_URL environment variable, providing the endpoint at which the API can be found. This will be something like; https://glimr-api.taxtribunals.dsd.io

This URL must be accessible from wherever your code is running.

If you need to set the api timeout, use the GLIMR_API_TIMEOUT_SECONDS environment variable. This defaults to 5 seconds.

The call to register new cases can take a long time. It has its own timeout as a result: 32 seconds. Use the GLIMR_REGISTER_NEW_CASE_TIMEOUT_SECONDS environment variable to override this.

Check Availablity

GlimrApiClient::Available.call.available?

Check if the GLiMR API is available. Raises GlimrApiClient::Unavailable if anything other than a positive response is received; this includes network errors and timeouts.

Register a New Case

GlimrApiClient::RegisterNewCase.call(<case parameters>)

Accepts the following parameters:

  jurisdictionId: 8,
  onlineMappingCode: 'something',
  contactPhone: '1234',
  contactFax: '5678',
  contactEmail: 'foo_at_bar.com',
  contactPreference: 'Email',
  contactFirstName: 'Alice',
  contactLastName: 'Caroll',
  contactStreet1: '5_Wonderstreet',
  contactStreet2: 'contact_street_2',
  contactStreet3: 'contact_street_3',
  contactStreet4: 'contact_street_4',
  contactCity: 'London',
  documentsURL: 'http...google.com',
  repPhone: '7890',
  repFax: '6789',
  repEmail: 'bar_at_baz.com',
  repPreference: 'Fax',
  repReference: 'MYREF',
  repIsAuthorised: 'Yes',
  repOrganisationName: 'Acme._Ltd.',
  repFAO: 'Bob_Hope',
  repStreet1: '5_Repstreet',
  repStreet2: 'Repton',
  repStreet3: 'Repshire',
  repStreet4: 'Rep_st._4',
  repCity: 'City_of_reps'

Currently only jurisdictionId and onlineMappingCode are mandatory.

Deprecated Calls

Pending a Ministerial review of fees in tribunals, the four method related to managing payment were deprecated in late April, 2017.

In the event that these methods are required at a later date, the code can be re-vivfied in the repo. See the following commit for details of files removed:

02fe1117956089a4b2e62f2e93540165443de06e

The specs may require some adaption.

Examples

See the dummy Rails app in /spec/dummy for examples of how the gem might be used in a production environment.

Installation

Add this line to your application’s Gemfile:

gem 'glimr-api-client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install glimr-api-client

Testing

Run bundle rake in the gem source directory for a full set of specs, mutation tests and rubocop checks.

In an application

Examples of how this gem might be used can be found in the specs. There is also a set of RSpec shared examples that can be copied and modified. These can be found in spec/suppport/shared_examples_for_govpay.rb.

Contributing

Fork, then clone the repo:

git clone [email protected]:your-username/glimr-api-client.git

Make sure the tests pass:

bundle
bundle db:setup
bundle exec rake

Make your change. Add specs for your change. Make the specs pass:

bundle exec rake

Push to your fork and submit a pull request.

Some things that will increase the chance that your pull request is accepted:

  • Write specs.
  • Make sure you don’t have any mutants (part of total test suite).
  • Write a good commit message.

License

Released under the MIT License. Copyright (c) 2015-2016 Ministry of Justice.

ministryofjustice.glimr-api-client's People

Contributors

tatyree avatar digitalronin avatar zaparka avatar dependabot[bot] avatar leoapost avatar dependabot-preview[bot] avatar csutter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.