Class: Radar::Trip
Constant Summary
collapse
- RESOURCE_NAME =
{ singular: 'trip', plural: 'trips' }.freeze
Class Method Summary
collapse
api_client, class_name, descendants, #initialize, resource_base_path, #to_h
Class Method Details
.all(params: nil) ⇒ Object
5
6
7
8
9
|
# File 'lib/radar/trip.rb', line 5
def self.all(params: nil)
path = resource_base_path
response = api_client.get(path, params: params)
api_client.parsed_response(response, object_class: self)
end
|
.restart(id:) ⇒ Object
15
16
17
18
19
|
# File 'lib/radar/trip.rb', line 15
def self.restart(id:)
path = [resource_base_path, id].join('/')
response = api_client.patch(path, params: { status: 'started' })
api_client.parsed_response(response, object_class: self)
end
|
.start(params:) ⇒ Object
11
12
13
|
# File 'lib/radar/trip.rb', line 11
def self.start(params:)
Radar::Track.create(params: params)
end
|
.stop(id:) ⇒ Object
21
22
23
24
25
|
# File 'lib/radar/trip.rb', line 21
def self.stop(id:)
path = [resource_base_path, id].join('/')
response = api_client.patch(path, params: { status: 'canceled' })
api_client.parsed_response(response, object_class: self)
end
|