Class: Transit

Inherits:
Resource show all
Defined in:
lib/gatekeeper_api_client/resources/transit.rb

Instance Method Summary collapse

Methods inherited from Resource

#post

Constructor Details

#initialize(record, on_error: ErrorHandler) ⇒ Transit

Returns a new instance of Transit.



2
3
4
# File 'lib/gatekeeper_api_client/resources/transit.rb', line 2

def initialize(record, on_error: ErrorHandler)
  super(record, on_error: on_error)
end

Instance Method Details

#to_jsonObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/gatekeeper_api_client/resources/transit.rb', line 6

def to_json
  {"transit":
    {
      "occurred_at": UtcTime.parse(@record.date, @record.time),
      "badge_number": @record.badge_number,
      "sensor_code": @record.sensor_code,
      "authorized": @record.authorized == "1"
    }
  }
end