Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/tesla_api/vehicle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,17 @@ def media_volume_down
command("media_volume_down")["response"]
end

# Sends a location for the car to start navigation
def share_location(address, locale: "us-US")
params = {
type: "share_ext_content_raw",
locale: locale,
timestamp_ms: Time.now.to_i,
value: {"android.intent.extra.TEXT" => address}
}
command("share", body: params)["response"]
end

private

def data_request(name)
Expand Down
117 changes: 117 additions & 0 deletions spec/cassettes/vehicle-share_location.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions spec/lib/tesla_api/vehicle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,12 @@
end
end
end

context "sharing" do
describe "#share_location", vcr: {cassette_name: "vehicle-share_location"} do
it "shares a location with car GPS" do
expect(vehicle.share_location("Tesla HQ, Deer Creek Road, Palo Alto, CA, USA")["result"]).to eq(true)
end
end
end
end