File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,15 +31,25 @@ class Orbility::ParkingRestAPI < PlaceOS::Driver
3131 macro check (response , klass )
3232 % response = {{ response }}
3333 raise " error: #{ % response.status} \n #{ % response.body} " unless % response.success?
34- % klass = {{klass}}.from_json(% response.body)
34+ % klass = begin
35+ {{klass}}.from_json(% response.body)
36+ rescue error
37+ logger.error { " error parsing response: #{ % response.body} " }
38+ raise error
39+ end
3540 raise " error: #{ % klass.to_pretty_json} " unless % klass.success?
3641 % klass
3742 end
3843
3944 macro basic_check (response )
4045 % response = {{ response }}
4146 raise " error: #{ % response.status} \n #{ % response.body} " unless % response.success?
42- % conf = Confirmation .from_json(% response.body)
47+ % conf = begin
48+ Confirmation .from_json(% response.body)
49+ rescue error
50+ logger.error { " error parsing response: #{ % response.body} " }
51+ raise error
52+ end
4353 if ! % conf.success?
4454 logger.info { " basic request failed with: #{ % conf.to_pretty_json} " }
4555 end
Original file line number Diff line number Diff line change @@ -54,12 +54,20 @@ module Orbility
5454
5555 module CreatedConverter
5656 FORMAT = " %Y-%m-%dT%H:%M:%S.%L"
57- FORMAT_ALT = " %Y-%m-%dT%H:%M:%S"
5857
5958 def self.from_json (value : JSON ::PullParser ) : Time
59+ str = value.read_string
60+
61+ # the milliseconds may not exist or are not padded
62+ result = str.split('.' , 2 )
63+ timemain = result[0 ]
64+ if result.size == 1
65+ split = " 000"
66+ else
67+ split = result[1 ].ljust(3 , '0' )
68+ end
69+ str = " #{ timemain } .#{ split } "
6070 Time .parse(value.read_string, FORMAT , Time ::Location ::UTC )
61- rescue Time ::Format ::Error
62- Time .parse(value.read_string, FORMAT_ALT , Time ::Location ::UTC )
6371 end
6472
6573 def self.to_json (value : Time , json : JSON ::Builder ) : Nil
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class Orbility::ParkingUserSync < PlaceOS::Driver
1010
1111 descriptive_name " Orbility User Sync"
1212 generic_name :OrbilityUserSync
13- description %( Grabs users from active directory, looks up swipe card numbers from gallagher and syncs these to orbility)
13+ description %( Grabs users from active directory, looks up swipe card numbers from gallagher and syncs these to orbility. )
1414
1515 default_settings({
1616 # Azure user group we want to sync
You can’t perform that action at this time.
0 commit comments