ministryofjustice/atet — pull request #384 by threedaymonk (2014-11-18 16:52:56+00:00)
Title: Jadu API integration

Add an interface to Jadu's API. /cc @dan-palmer

Initialise the API:

```ruby
api = Jadu::API.new(
'https://etapi.nearlive.moj.fcos.jadu.net/api/1/'
verify_mode: OpenSSL::SSL::VERIFY_NONE, # skip verification in near-live
ssl_version: :TLSv1
)
```

Make a new claim request:

```ruby
response = api.new_claim(xml, 'example.pdf' => File.read('example.pdf'))

response.ok? # => true
response.to_hash # =>
# {
# 'feeGroupReference' => '991000185700',
# 'status' => 'ok'
# }
response['status'] # => 'ok'
response['feeGroupReference'] # => '991000185700'
```

Make an ET office request:

```ruby
response = api.fgr_et_office('B5 4UU')

response.ok? # => true
response.to_hash # =>
# {
# 'status' => 'ok',
# 'fgr' => '131000203700',
# 'ETOfficeCode' => 13,
# 'ETOfficeName' => 'Birmingham',
# 'ETOfficeAddress' => '...',
# 'ETOfficeTelephone' => '0121 000 0000'
# }
response['fgr'] # => '131000203700'
```