class Updox::Models::Location

Constants

LIST_ENDPOINT
LIST_NAME
LIST_TYPE
SYNC_ENDPOINT
SYNC_LIST_TYPE

Public Class Methods

find(location_id, account_id: , cached_query: nil) click to toggle source
# File lib/updox/models/location.rb, line 44
def self.find(location_id, account_id: , cached_query: nil)
  obj = cached_query || self.query(account_id: account_id)

  obj.locations.find {|location| location_id.to_s == location.external_id.to_s }
end
query(account_id: , active_only: false) click to toggle source
# File lib/updox/models/location.rb, line 50
def self.query(account_id: , active_only: false)
  request(endpoint: LIST_ENDPOINT, body: { activeOnly: active_only }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
end

Public Instance Methods

save(account_id: ) click to toggle source
# File lib/updox/models/location.rb, line 40
def save(account_id: )
  self.class.sync([self], account_id: account_id)
end