Class: Samsara::Tachograph::DriverClient
- Inherits:
-
Object
- Object
- Samsara::Tachograph::DriverClient
- 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::DriverClient constructor
Constructor Details
#initialize(request_client:) ⇒ Samsara::Tachograph::DriverClient
18 19 20 |
# File 'lib/samsara_api/tachograph/driver/client.rb', line 18 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Samsara::RequestClient (readonly)
13 14 15 |
# File 'lib/samsara_api/tachograph/driver/client.rb', line 13 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")
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/samsara_api/tachograph/driver/client.rb', line 59 def activity(after: nil, start_time:, end_time:, driver_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) 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 |
#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")
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/samsara_api/tachograph/driver/client.rb', line 116 def files(after: nil, start_time:, end_time:, driver_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) 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 |