class StaffAPI
- StaffAPI
- DriverSpecs::MockDriver
- Reference
- Object
Defined in:
place/auto_release_spec.crplace/survey_mailer_spec.cr
place/template_mailer_spec.cr
Constant Summary
-
BOOKINGS =
[{id: 1, user_id: "user-wfh", user_email: "user_one@example.com", user_name: "User One", asset_id: "desk_001", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc + 1.hour).to_unix, booking_end: (Time.utc + 2.hours).to_unix, timezone: "Australia/Darwin", title: "ignore", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfh", booked_by_email: "user_one@example.com", booked_by_name: "User One", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 2, user_id: "user-wfh", user_email: "user_one@example.com", user_name: "User One", asset_id: "desk_002", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc + 5.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "notify", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfh", booked_by_email: "user_one@example.com", booked_by_name: "User One", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 3, user_id: "user-wfh", user_email: "user_one@example.com", user_name: "User One", asset_id: "desk_003", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc - 11.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "reject", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfh", booked_by_email: "user_one@example.com", booked_by_name: "User One", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 4, user_id: "user-wfh", user_email: "user_one@example.com", user_name: "User One", asset_id: "desk_004", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc + 5.hours).to_unix, booking_end: (Time.utc + 6.hours).to_unix, timezone: "Australia/Darwin", title: "ignore_after_hours", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfh", booked_by_email: "user_one@example.com", booked_by_name: "User One", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 5, user_id: "user-wfo", user_email: "user_two@example.com", user_name: "User Two", asset_id: "desk_005", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc - 11.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "ignore_wfo", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfo", booked_by_email: "user_two@example.com", booked_by_name: "User Two", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 6, user_id: "user-wfh", user_email: "user_one@example.com", user_name: "User One", asset_id: "desk_006", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc - 11.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "ignore_last_minute_checkin", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfh", booked_by_email: "user_one@example.com", booked_by_name: "User One", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 7, user_id: "user-wfh", user_email: "user_one@example.com", user_name: "User One", asset_id: "desk_007", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc - 11.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "ignore_last_minute_schedule_change", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfh", booked_by_email: "user_one@example.com", booked_by_name: "User One", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 8, user_id: "user-wfh", user_email: "user_one@example.com", user_name: "User One", asset_id: "desk_008", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc - 2.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "reject_on_start", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfh", booked_by_email: "user_one@example.com", booked_by_name: "User One", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 9, user_id: "user-aol", user_email: "user_three@example.com", user_name: "User Three", asset_id: "desk_009", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc - 11.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "release_override_aol", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-aol", booked_by_email: "user_three@example.com", booked_by_name: "User Three", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 10, user_id: "user-wfh-override", user_email: "user_four@example.com", user_name: "User Four", asset_id: "desk_010", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc - 11.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "ignore_override", description: "", checked_in: false, rejected: false, approved: true, booked_by_id: "user-wfo-override", booked_by_email: "user_four@example.com", booked_by_name: "User Four", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}, {id: 11, user_id: "user-wfh", user_email: "user_one@example.com", user_name: "User One", asset_id: "desk_003", zones: ["zone-1234"], booking_type: "desk", booking_start: (Time.utc - 11.minutes).to_unix, booking_end: (Time.utc + 1.hour).to_unix, timezone: "Australia/Darwin", title: "ignore_checked_in", description: "", checked_in: true, rejected: false, approved: true, booked_by_id: "user-wfh", booked_by_email: "user_one@example.com", booked_by_name: "User One", process_state: "approved", last_changed: Time.utc.to_unix, created: Time.utc.to_unix}]
-
Using a constant for bookings to ensure the times don't change during tests
-
DATE =
NOW.to_s(format: "%F")
-
DAY_OF_WEEK =
NOW.day_of_week.value == 0 ? 7 : NOW.day_of_week.value
-
NOW =
Time.local(location: Time::Location.load("Australia/Sydney"))
-
ZONES =
[{created_at: 1660537814, updated_at: 1681800971, id: "zone-org-1234", name: "Test Org Zone", display_name: "Test Org Zone", location: "", description: "", code: "", type: "", count: 0, capacity: 0, map_id: "", tags: ["org"], triggers: [] of String, parent_id: "zone-0000", timezone: "Australia/Sydney"}, {created_at: 1660537814, updated_at: 1681800971, id: "zone-bld-1234", name: "Test Building Zone", display_name: "Test Building Zone", location: "", description: "", code: "", type: "", count: 0, capacity: 0, map_id: "", tags: ["building"], triggers: [] of String, parent_id: "zone-0000", timezone: "Australia/Sydney"}]
Class Method Summary
Instance Method Summary
-
#__executor(json : String) : BaseExecutor
:nodoc:
-
#__init__ : Nil
:nodoc:
- #get_booking(booking_id : String | Int64)
- #get_survey_invites(survey_id : Int64 | Nil = nil, sent : Bool | Nil = nil)
-
#on_load
:nodoc:
- #query_bookings(type : String | Nil = nil, period_start : Int64 | Nil = nil, period_end : Int64 | Nil = nil, zones : Array(String) = [] of String, user : String | Nil = nil, email : String | Nil = nil, state : String | Nil = nil, created_before : Int64 | Nil = nil, created_after : Int64 | Nil = nil, approved : Bool | Nil = nil, rejected : Bool | Nil = nil, checked_in : Bool | Nil = nil)
- #reject(booking_id : String | Int64, utm_source : String | Nil = nil)
- #update_survey_invite(token : String, email : String | Nil = nil, sent : Bool | Nil = nil)
- #user(id : String)
- #zones(q : String | Nil = nil, limit : Int32 = 1000, offset : Int32 = 0, parent : String | Nil = nil, tags : Array(String) | String | Nil = nil)
- #zones(q : String | Nil = nil, limit : Int32 = 1000, offset : Int32 = 0, parent : String | Nil = nil, tags : Array(String) | String | Nil = nil)
Class Method Detail
Instance Method Detail
def __executor(json : String) : BaseExecutor
#
Description copied from class DriverSpecs::MockDriver
:nodoc:
def query_bookings(type : String | Nil = nil, period_start : Int64 | Nil = nil, period_end : Int64 | Nil = nil, zones : Array(String) = [] of String, user : String | Nil = nil, email : String | Nil = nil, state : String | Nil = nil, created_before : Int64 | Nil = nil, created_after : Int64 | Nil = nil, approved : Bool | Nil = nil, rejected : Bool | Nil = nil, checked_in : Bool | Nil = nil)
#
def zones(q : String | Nil = nil, limit : Int32 = 1000, offset : Int32 = 0, parent : String | Nil = nil, tags : Array(String) | String | Nil = nil)
#
def zones(q : String | Nil = nil, limit : Int32 = 1000, offset : Int32 = 0, parent : String | Nil = nil, tags : Array(String) | String | Nil = nil)
#