Skip to content

Commit 27a1bfd

Browse files
committed
hardcode /v2/ for api endpoint in HOME/.plotly/.config
1 parent 9c2131d commit 27a1bfd

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Plotly.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ type CurrentPlot
1111
url::String
1212
end
1313

14+
api_version = "v2"
15+
1416
default_options = {"filename"=>"Plot from Julia API",
1517
"world_readable"=> true,
1618
"layout"=>{""=>""}}
@@ -36,8 +38,11 @@ end
3638

3739
function get_content_endpoint(file_id::String, owner::String)
3840
config = get_config()
39-
content_endpoint = "files/$owner:$file_id/content"
40-
return joinpath(config.plotly_api_domain, content_endpoint)
41+
api_endpoint = "$(config.plotly_api_domain)/$api_version/files"
42+
detail = "$owner:$file_id"
43+
custom_action = "content"
44+
content_endpoint = "$api_endpoint/$detail/$custom_action"
45+
return content_endpoint
4146
end
4247

4348
function plot(data::Array,options=Dict())

test/tests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using Base.Test
44

55
# just check that http://plot.ly/clientresp behaves as expected -- nothing to see here
66

7-
Plotly.signin("unittest","tfzz811f5n")
7+
Plotly.signin("unittest","tfzz811f5n", {"plotly_domain"=>"https://plot.ly","plotly_api_domain"=>"https://api.plot.ly"})
88

99
(x0,y0) = [1,2,3], [4,5,6]
1010
(x1,y1) = [1,2,3], [2,10,12]
@@ -50,4 +50,4 @@ Plotly.signin("test_username", "test_api_key", endpoints)
5050
fid = "123_fake"
5151
owner = "test_owner"
5252
content_endpoint = Plotly.get_content_endpoint(fid, owner)
53-
@test content_endpoint == "my_plotly_api_domain/files/test_owner:123_fake/content"
53+
@test content_endpoint == "my_plotly_api_domain/v2/files/test_owner:123_fake/content"

0 commit comments

Comments
 (0)