Class: Samsara::Tachograph::AsyncDriverClient
- Inherits:
-
Object
- Object
- Samsara::Tachograph::AsyncDriverClient
- Defined in:
- lib/samsara_api/tachograph/driver/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#activity(after: nil, start_time:, end_time:, driver_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) ⇒ Object
api.tachograph.driver.activity(start_time: “startTime”, end_time: “endTime”).
-
#files(after: nil, start_time:, end_time:, driver_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) ⇒ Object
api.tachograph.driver.files(start_time: “startTime”, end_time: “endTime”).
- #initialize(request_client:) ⇒ Samsara::Tachograph::AsyncDriverClient constructor
Constructor Details
#initialize(request_client:) ⇒ Samsara::Tachograph::AsyncDriverClient
141 142 143 |
# File 'lib/samsara_api/tachograph/driver/client.rb', line 141 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Samsara::AsyncRequestClient (readonly)
136 137 138 |
# File 'lib/samsara_api/tachograph/driver/client.rb', line 136 def request_client @request_client end |
Instance Method Details
#activity(after: nil, start_time:, end_time:, driver_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) ⇒ Object
api.tachograph.driver.activity(start_time: “startTime”, end_time: “endTime”)
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/samsara_api/tachograph/driver/client.rb', line 182 def activity(after: nil, start_time:, end_time:, driver_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) Async do response = @request_client.conn.get do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "after": after, "startTime": start_time, "endTime": end_time, "driverIds": driver_ids, "parentTagIds": parent_tag_ids, "tagIds": tag_ids }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/fleet/drivers/tachograph-activity/history" end Samsara::Types::DriverTachographActivityResponse.from_json(json_object: response.body) end end |
#files(after: nil, start_time:, end_time:, driver_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) ⇒ Object
api.tachograph.driver.files(start_time: “startTime”, end_time: “endTime”)
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/samsara_api/tachograph/driver/client.rb', line 241 def files(after: nil, start_time:, end_time:, driver_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) Async do response = @request_client.conn.get do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "after": after, "startTime": start_time, "endTime": end_time, "driverIds": driver_ids, "parentTagIds": parent_tag_ids, "tagIds": tag_ids }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/fleet/drivers/tachograph-files/history" end Samsara::Types::TachographDriverFilesResponse.from_json(json_object: response.body) end end |