Class: Radar::Geofence

Inherits:
API::Resource show all
Defined in:
lib/radar/geofence.rb

Constant Summary collapse

RESOURCE_NAME =
{ singular: 'geofence', plural: 'geofences' }.freeze

Class Method Summary collapse

Methods inherited from API::Resource

api_client, class_name, descendants, #initialize, resource_base_path, #to_h

Constructor Details

This class inherits a constructor from Radar::API::Resource

Class Method Details

.allObject



5
6
7
8
9
# File 'lib/radar/geofence.rb', line 5

def self.all
  path = resource_base_path
  response = api_client.get(path, params: nil)
  api_client.parsed_response(response, object_class: self)
end

.delete(id:) ⇒ Object



23
24
25
26
# File 'lib/radar/geofence.rb', line 23

def self.delete(id:)
  path = [resource_base_path, id].join('/')
  api_client.delete(path)
end

.delete_by(tag:, external_id:) ⇒ Object



28
29
30
31
# File 'lib/radar/geofence.rb', line 28

def self.delete_by(tag:, external_id:)
  path = [resource_base_path, tag, external_id].join('/')
  api_client.delete(path)
end

.find(id:) ⇒ Object



11
12
13
14
15
# File 'lib/radar/geofence.rb', line 11

def self.find(id:)
  path = [resource_base_path, id].join('/')
  response = api_client.get(path, params: nil)
  api_client.parsed_response(response, object_class: self)
end

.upsert(tag:, external_id:, params:) ⇒ Object



17
18
19
20
21
# File 'lib/radar/geofence.rb', line 17

def self.upsert(tag:, external_id:, params:)
  path = [resource_base_path, tag, external_id].join('/')
  response = api_client.put(path, params: params)
  api_client.parsed_response(response, object_class: self)
end

.users(tag:, external_id:, params:) ⇒ Object



33
34
35
36
37
# File 'lib/radar/geofence.rb', line 33

def self.users(tag:, external_id:, params:)
  path = [resource_base_path, tag, external_id, 'users'].join('/')
  response = api_client.get(path, params: params)
  api_client.parsed_response(response, object_class: self)
end