Class: Samsara::Tachograph::AsyncVehiclesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/tachograph/vehicles/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ Samsara::Tachograph::AsyncVehiclesClient

Parameters:



84
85
86
# File 'lib/samsara_api/tachograph/vehicles/client.rb', line 84

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientSamsara::AsyncRequestClient (readonly)



79
80
81
# File 'lib/samsara_api/tachograph/vehicles/client.rb', line 79

def request_client
  @request_client
end

Instance Method Details

#files(after: nil, start_time:, end_time:, vehicle_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil) ⇒ Object

api.tachograph.vehicles.files(start_time: “startTime”, end_time: “endTime”)



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/samsara_api/tachograph/vehicles/client.rb', line 127

def files(after: nil, start_time:, end_time:, vehicle_ids: nil, parent_tag_ids: nil, tag_ids: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do | req |
  unless request_options&.timeout_in_seconds.nil?
    req.options.timeout = request_options.timeout_in_seconds
  end
  unless request_options&.token.nil?
    req.headers["Authorization"] = request_options.token
  end
  req.headers = { **(req.headers || {}), **@request_client.get_headers, **(request_options&.additional_headers || {}) }.compact
  req.params = { **(request_options&.additional_query_parameters || {}), "after": after, "startTime": start_time, "endTime": end_time, "vehicleIds": vehicle_ids, "parentTagIds": parent_tag_ids, "tagIds": tag_ids }.compact
  unless request_options.nil? || request_options&.additional_body_parameters.nil?
    req.body = { **(request_options&.additional_body_parameters || {}) }.compact
  end
  req.url "#{@request_client.get_url(request_options: request_options)}/fleet/vehicles/tachograph-files/history"
end
    Samsara::Types::TachographVehicleFilesResponse.from_json(json_object: response.body)
  end
end