-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ahtung/feature/screenshot
Feature/screenshot
- Loading branch information
Showing
7 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "", | ||
"headers": [], | ||
"method": "post", | ||
"options": [], | ||
"request_body": "", | ||
"url": "https://platform.api.onesky.io/1/projects/314254/screenshots?api_key=.*×tamp=.*&dev_hash=.*" | ||
}, | ||
"response": { | ||
"binary": false, | ||
"body": "", | ||
"headers": { | ||
"Access-Control-Allow-Headers": "Authorization, X-Authorization, Origin, Accept, Content-Type, X-Requested-With, X-HTTP-Method-Override", | ||
"Access-Control-Allow-Methods": "PUT, GET, POST, DELETE, OPTIONS", | ||
"Access-Control-Allow-Origin": "*", | ||
"Cache-Control": "no-store, no-cache, must-revalidate, post-check=0, pre-check=0", | ||
"Content-Type": "application/json", | ||
"Date": "Wed, 21 Nov 2018 21:05:08 GMT", | ||
"Expires": "Thu, 19 Nov 1981 08:52:00 GMT", | ||
"Pragma": "no-cache", | ||
"Server": "Apache", | ||
"Set-Cookie": "PHPSESSID=un76cfch89c2b9kou1717arou3; path=/", | ||
"Content-Length": "83", | ||
"Connection": "keep-alive" | ||
}, | ||
"status_code": 201, | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule Onesky.Screenshot do | ||
@moduledoc """ | ||
[Screenshot](https://github.com/onesky/api-documentation-platform/blob/master/resources/screenshot.md) | ||
""" | ||
|
||
@doc """ | ||
UPLOAD screenshots | ||
""" | ||
def upload_screenshots(client, project_id, screenshots) do | ||
Tesla.post(client, "projects/#{project_id}/screenshots", screenshots) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
defmodule ScreenshotTest do | ||
use ExUnit.Case, async: true | ||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney | ||
|
||
doctest Onesky.Screenshot | ||
|
||
test "upload_screenshots" do | ||
use_cassette "screenshots#upload" do | ||
image = "fixture/screenshots/screenshot.png" |> File.read! |> Base.encode64() | ||
screenshots = [ | ||
%{ | ||
"name" => "screenshot.png", | ||
"image" => image, | ||
"tags" => [ | ||
%{ | ||
"key" => "common.nav.product.smartphone", | ||
"x" => 460, | ||
"y" => 30, | ||
"width" => 150, | ||
"height" => 50, | ||
"file" => "string.po" | ||
} | ||
] | ||
} | ||
] | ||
{:ok, %Tesla.Env{} = env} = Onesky.client() |> Onesky.Screenshot.upload_screenshots(314254, screenshots) | ||
|
||
assert env.status == 201 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters