nomis-api-client 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/bin/generate_bearer_token +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0565b63217b1a92ea23783172392d8772411ddb3
|
4
|
+
data.tar.gz: 5b0b83b7a490c3b8cca1710293a8fb8fc7e2238c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a53ce9deb16a935ce3291ec3c892d161791a32c5c559dc16f432ae8c54c20a77057ff93debe94d8de6b2c8fd2cf8ce4b25d3fc780a2d94868c2e07953b257414
|
7
|
+
data.tar.gz: 9e84e9f0689b97ab9179787d8acb411863a5dac82c35300ad713569447629c2a2f5b13d7bf6b66e1335097e0ad7a4423568397eea4f7b413afd22641daf89466
|
data/README.md
CHANGED
@@ -5,6 +5,18 @@ A minimal client for the [NOMIS API](http://ministryofjustice.github.io/nomis-ap
|
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
+
### Without bundler
|
9
|
+
|
10
|
+
Pre-requisites:
|
11
|
+
- ruby
|
12
|
+
- rubygems
|
13
|
+
|
14
|
+
```bash
|
15
|
+
gem install nomis-api-client
|
16
|
+
```
|
17
|
+
|
18
|
+
### With bundler
|
19
|
+
|
8
20
|
1. In your Gemfile, add:
|
9
21
|
```ruby
|
10
22
|
gem 'nomis-api-client'
|
@@ -63,6 +75,13 @@ You can generate a bearer token without making a request as follows:
|
|
63
75
|
```ruby
|
64
76
|
# Manually generating a bearer token
|
65
77
|
NOMIS::API::AuthToken.new(client_key: 'your client key', client_token: 'your client token').bearer_token
|
78
|
+
```
|
79
|
+
|
80
|
+
There is also a command-line executable:
|
81
|
+
|
82
|
+
```bash
|
83
|
+
generate_bearer_token /path/to/your.token /path/to/your.key
|
84
|
+
```
|
66
85
|
|
67
86
|
### Environment (preprod/prod)
|
68
87
|
|
data/bin/generate_bearer_token
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
3
|
# Usage:
|
4
|
-
# generate_bearer_token client_key_file
|
4
|
+
# generate_bearer_token client_token_file client_key_file
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'nomis_api_client_ruby'
|
@@ -9,7 +9,7 @@ require 'nomis_api_client_ruby'
|
|
9
9
|
def usage
|
10
10
|
output = <<-END
|
11
11
|
Usage:
|
12
|
-
generate_bearer_token client_key_file
|
12
|
+
generate_bearer_token client_token_file client_key_file
|
13
13
|
|
14
14
|
Useful environment variables:
|
15
15
|
|
@@ -21,14 +21,14 @@ def usage
|
|
21
21
|
'iat skew too large', you can provide this to bring your system
|
22
22
|
time within +/-10s of the API gateway.
|
23
23
|
e.g.
|
24
|
-
NOMIS_API_IAT_FUDGE_FACTOR=-5 generate_bearer_token
|
24
|
+
NOMIS_API_IAT_FUDGE_FACTOR=-5 generate_bearer_token /path/to/my.token /path/to/my.key
|
25
25
|
|
26
26
|
END
|
27
27
|
end
|
28
28
|
|
29
|
-
raise usage unless
|
29
|
+
raise usage unless ARGV.size == 2
|
30
30
|
|
31
|
-
token = NOMIS::API::AuthToken.new(
|
31
|
+
token = NOMIS::API::AuthToken.new(client_token_file: $1, client_key_file: $2).bearer_token
|
32
32
|
puts token
|
33
33
|
|
34
34
|
|