class Gallagher::RestAPI

Included Modules

Defined in:

gallagher/rest_api.cr

Class Method Summary

Macro Summary

Instance Method Summary

Class Method Detail

def self.driver_interface : String #

Macro Detail

macro get_results(klass, response) #

[View source]

Instance Method Detail

def cardholder_exists?(filter : String) #

[View source]
def connected #

[View source]
def create_cardholder(first_name : String, last_name : String, description : String = "a cardholder", authorised : Bool = true, pdfs : Hash(String, String) | Nil = nil, cards : Array(Card) | Nil = nil, access_groups : Array(CardholderAccessGroup) | Nil = nil, short_name : String | Nil = nil, division_href : String | Nil = nil) #

Create a new cardholder. @param first_name [String] The first name of the new cardholder. Either this or last name is required (but we should assume both are for most instances). @param last_name [String] The last name of the new cardholder. Either this or first name is required (but we should assume both are for most instances). @option options [String] :division The division to add the cardholder to. This is required when making the request to create the cardholder but if none is passed the default_division is used. @option options [Hash] :pdfs A hash containing all PDFs to add to the user in the form { some_pdf_name: some_pdf_value, another_pdf_name: another_pdf_value }. @option options [Array] :cards An array of cards to be added to this cardholder which can include both virtual and physical cards. @option options [Array] :access_groups An array of access groups to add this cardholder to. These may include from and until fields to dictate temporary access. @option options [Array] :competencies An array of competencies to add this cardholder to. @return [Hash] The cardholder that was created.


[View source]
def delete_card(href : String) #

[View source]
def delete_href(href : String) #

[View source]
def disable_card(href : String) #

[View source]
def door_list : Array(Door) #

[View source]
def doors #

[View source]
def free_zone(zone_id : String | Int32) : Bool | Nil #

forces a zone to be free, that is doors are unlocked


[View source]
def get_access_group(id : String) #

[View source]
def get_access_group_members(id : String) #

[View source]
def get_access_groups(name : String | Nil = nil, exact_match : Bool = true) #

[View source]
def get_base64_pdf(user_id : String, pdf_id : String | UInt64) #

[View source]
def get_card_type(id : String | Int32 | Nil = nil) #

[View source]
def get_cardholder(id : String) #

[View source]
def get_division(id : String) #

[View source]
def get_divisions(name : String | Nil = nil, exact_match : Bool = true) #

[View source]
def get_event_groups #

[View source]
def get_events #

[View source]
def get_href(href : String) #

[View source]
def get_pdf(user_id : String, pdf_id : String | UInt64) #

[View source]
def get_pdfs(name : String | Nil = nil, exact_match : Bool = true) #

Personal Data Fields (PDFs) are custom fields that Gallagher allows definintions of on a site-by-site basis. They will usually be for things like email address, employee ID or some other field specific to whoever is hosting the Gallagher instance. Allows retrieval of the PDFs used in the Gallagher instance, primarily so we can get the PDF's ID and use that to filter cardholders based on that PDF.

@param name [String] The name of the PDF which we want to retrieve. This will only return one result (as the PDF names are unique). @return [Hash] A list of PDF results and a next link for pagination (we will generally have less than 100 PDFs so 'next' link will mostly be unused): @example An example response: { "results": [ { "name": "email", "id": "5516", "href": "https://localhost:8904/api/personal_data_fields/5516" }, { "name": "cellphone", "id": "9998", "href": "https://localhost:8904/api/personal_data_fields/9998", "serverDisplayName": "Site B" } ], "next": { "href": "https://localhost:8904/api/personal_data_fields?pos=900&sort=id" } }


[View source]
def get_zones(name : String | Nil = nil, exact_match : Bool = true) #

[View source]
def on_load #

[View source]
def on_unload #

[View source]
def on_update #

[View source]
def query_card_types #

[View source]
def query_cardholders(filter : String, pdf_name : String | Nil = nil, exact_match : Bool = true) #

[View source]
def query_endpoints #

[View source]
def remove_cardholder_access(id : String | Nil = nil, href : String | Nil = nil) #

[View source]
def reset_zone(zone_id : String | Int32) : Bool | Nil #

returns the zone to it's default scheduled state, removing any overrides


[View source]
def secure_zone(zone_id : String | Int32) : Bool | Nil #

forces a zone to be secure and require a swipe card to access


[View source]
def unlock(door_id : String) : Bool | Nil #
Description copied from module PlaceOS::Driver::Interface::DoorSecurity

true for success, false for failed, nil for not supported


[View source]
def update_cardholder(id : String | Nil = nil, href : String | Nil = nil, first_name : String | Nil = nil, last_name : String | Nil = nil, description : String | Nil = nil, authorised : Bool = true, pdfs : Hash(String, String) | Nil = nil, cards : Array(Card) | Nil = nil, remove_cards : Array(Card) | Nil = nil, update_cards : Array(Card) | Nil = nil, access_groups : Array(CardholderAccessGroup) | Nil = nil, remove_access_groups : Array(CardholderAccessGroup) | Nil = nil, update_access_groups : Array(CardholderAccessGroup) | Nil = nil, short_name : String | Nil = nil, division_href : String | Nil = nil) #

[View source]