gatekeeper_api_client 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/continuous-integration.yml +0 -1
- data/.gitignore +4 -1
- data/GEM_VERSION +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +13 -18
- data/lib/gatekeeper_api_client/client_error.rb +3 -0
- data/lib/gatekeeper_api_client/gateway.rb +1 -1
- data/lib/gatekeeper_api_client/resources/transit.rb +1 -1
- data/lib/gatekeeper_api_client/retrying_gateway.rb +1 -0
- data/lib/gatekeeper_api_client.rb +0 -1
- metadata +1 -2
- data/lib/gatekeeper_api_client/utc_time.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d9b20bd2b992c579069eb699d9d7c40a83799c9739e912e9f43055a78c0e67a
|
4
|
+
data.tar.gz: 2ddf2106753c80d179f485272410975df40b902b6cd2bf75a78a47f2c9c9fb0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2816c70a73798ce585ce70de29f7ad31f069f8a6eaccbef60a1183d0eff2693834a9e3aa085efeee772bbabe21c85d4a2d6a240194292c65428e104f653b1167
|
7
|
+
data.tar.gz: 909b70b4b0ba0551ca8c39aae6e941ab8b3ba5405e392ba56876772d8b1b7deda780ecd189dde1d2505c17d0fc15125adc338c68ca0772a85dde7775cb8f96b2
|
data/.gitignore
CHANGED
data/GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,17 +3,13 @@ Common logic for consuming the GateKeeper API.
|
|
3
3
|
|
4
4
|
## Installation
|
5
5
|
Add this line to your application's Gemfile:
|
6
|
-
```
|
7
|
-
source "https://rubygems.pkg.github.com/inforlife" do
|
8
|
-
gem "gatekeeper_api_client", "1.0.0"
|
9
|
-
end
|
6
|
+
```gem "gatekeeper_api_client", "1.1.0"
|
10
7
|
```
|
11
8
|
|
12
9
|
## Usage
|
13
|
-
The application using this gem must have defined the following
|
14
|
-
- `GATEKEEPER_API_KEY
|
15
|
-
- `
|
16
|
-
- `GATEKEEPER_URL`
|
10
|
+
The application using this gem must have defined the following environment variables:
|
11
|
+
- `GATEKEEPER_API_KEY`: The authentication key.
|
12
|
+
- `GATEKEEPER_URL`: The URL to post data.
|
17
13
|
|
18
14
|
### Transit
|
19
15
|
To post a `transit`, build an object with a record and send the `post` message to it.
|
@@ -23,12 +19,11 @@ Transit.new(record).post
|
|
23
19
|
```
|
24
20
|
|
25
21
|
The record must respond to:
|
26
|
-
- `authorized`
|
27
|
-
- `badge_number`
|
28
|
-
- `
|
29
|
-
- `
|
30
|
-
- `
|
31
|
-
- `valid?`
|
22
|
+
- `authorized` returns a string.
|
23
|
+
- `badge_number` returns a string.
|
24
|
+
- `sensor_code` returns a string.
|
25
|
+
- `time` returns a Time (with Timezone) object.
|
26
|
+
- `valid?` returns a boolean,
|
32
27
|
|
33
28
|
### Employee
|
34
29
|
To post an `employee`, build an object with a record and send the `post` message to it.
|
@@ -38,7 +33,7 @@ Employee.new(record).post
|
|
38
33
|
```
|
39
34
|
|
40
35
|
The record must respond to:
|
41
|
-
- `employee_name`
|
42
|
-
- `badge_number`
|
43
|
-
- `department_name`
|
44
|
-
- `valid?`
|
36
|
+
- `employee_name` returns a string.
|
37
|
+
- `badge_number` returns a string.
|
38
|
+
- `department_name` returns a string.
|
39
|
+
- `valid?` returns a boolean.
|
@@ -6,7 +6,7 @@ class Transit < Resource
|
|
6
6
|
def to_json
|
7
7
|
{"transit":
|
8
8
|
{
|
9
|
-
"occurred_at":
|
9
|
+
"occurred_at": @record.time.utc,
|
10
10
|
"badge_number": @record.badge_number,
|
11
11
|
"sensor_code": @record.sensor_code,
|
12
12
|
"authorized": @record.authorized == "1"
|
@@ -7,7 +7,6 @@ require "gatekeeper_api_client/client_error"
|
|
7
7
|
require "gatekeeper_api_client/error_handler"
|
8
8
|
require "gatekeeper_api_client/gateway"
|
9
9
|
require "gatekeeper_api_client/retrying_gateway"
|
10
|
-
require "gatekeeper_api_client/utc_time"
|
11
10
|
|
12
11
|
require "gatekeeper_api_client/resources/resource"
|
13
12
|
require "gatekeeper_api_client/resources/employee"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gatekeeper_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sigfrid Dusci
|
@@ -119,7 +119,6 @@ files:
|
|
119
119
|
- lib/gatekeeper_api_client/resources/resource.rb
|
120
120
|
- lib/gatekeeper_api_client/resources/transit.rb
|
121
121
|
- lib/gatekeeper_api_client/retrying_gateway.rb
|
122
|
-
- lib/gatekeeper_api_client/utc_time.rb
|
123
122
|
homepage: https://github.com/inforlife/gatekeeper-api-client
|
124
123
|
licenses:
|
125
124
|
- MIT
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class UtcTime
|
2
|
-
def self.parse(record_date, record_time)
|
3
|
-
date = record_date.tr('.', '-')
|
4
|
-
time = record_time.tr('.', ':')
|
5
|
-
|
6
|
-
timezone.local_to_utc(Time.parse([date, time].join(" ")))
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.timezone
|
10
|
-
TZInfo::Timezone.get(ENV["GATEKEEPER_TIMEZONE"])
|
11
|
-
end
|
12
|
-
end
|