Skip to content

Commit

Permalink
Merge ca9efe8 into 405d16f
Browse files Browse the repository at this point in the history
  • Loading branch information
dunyakirkali committed Jan 1, 2020
2 parents 405d16f + ca9efe8 commit 82f7299
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ config :onesky,
- ~~UPLOAD a file~~
- ~~DELETE a file~~
- **Translation**
- EXPORT translations in files
- export translations in MULTILINGUAL files
- ~~EXPORT translations in files~~
- ~~export translations in MULTILINGUAL files~~
- ~~export translations of APP STORE Description~~
- ~~GET translation status~~
- **Import Task**
Expand Down
32 changes: 32 additions & 0 deletions fixture/vcr_cassettes/translation#export_files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"request": {
"body": "",
"headers": [],
"method": "get",
"options": [],
"request_body": "",
"url": "https://platform.api.onesky.io/1/projects/322974/translations?api_key=.*&timestamp=.*&dev_hash=.*"
},
"response": {
"binary": true,
"body": "g20AAAJeH4sIADuBBVIAA41UQa/TMAy+71eYcgFpXfeAB1PXViBA4gIc4MIxa9zVWpOUJO02offfcdu9ruXtQCu1jh1//mzHSZ5Jk/tzjVB6VWWL5PGHQmYL4Cfx5CvMPp+EqiuET0YJ0kk0aBfDFoVeQF4K69CnQeOLcBNAlE2Mpfd1iL8batPgo9EetQ+7sAHkwyoNPJ581IXfjlC3kLRQmAYt4bE21k/8jyR9mUpsKcewXyyBNHkSVehyUWF6d4Vy/szJdAwugXPngsG2M/IMf3qxX4r8sLem0TLMTWVsDM+LNb+vtuMWJeyedAzrq6oWUpLez3QFMw0Loag6xxB8r1HDD6FdsITgC1YtesoFfMMGWTMqlvDBcgZLcLw1dGipuCL2wkP/ldROSPfpx/B2va5PT3neowLReHOD7v3M4VbuxST+zliJNrRCUuNiuEO1nVAScUX6sOR/S448ygnBR7jXmzebzQSx60UoMTdWeDLMVRuNU9D3CiUJeKHEKbxk+a7L8uW0ZfMO/k8mD6M0L+SkmPOKzfp+w/ZPadZz61jvsWRXEsM3ifojmnXyIomGeVwkXWo8nkzycpDLuyejyarBVmc/S3Igez2whM6LXUWu5F54AzuExrFYGAtUVY3zXdVbBBwQHc8Pe+eN4gFzK/hlGs753DmBZ+Th4F3Q9dXrSL40jYfaEiPnhktBuu8n8Fq4A6feB63RKnKODaskqkfWCd8XFos06G6NOIqOx+OKhBYrY/fREM9Fl2hB9tVY5PCMp/oYqxWDiawHTKK+Ukl0qVs0XG9/AQiVqov2BAAA",
"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": "text/plain; charset=UTF-8",
"Date": "Thu, 22 Nov 2018 19:47:58 GMT",
"Expires": "Thu, 19 Nov 1981 08:52:00 GMT",
"Pragma": "no-cache",
"Server": "Apache",
"Set-Cookie": "PHPSESSID=5nlveu1qbnm1ktv7jid2jfbte2; path=/",
"Content-Length": "161126",
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
}
}
]
32 changes: 32 additions & 0 deletions fixture/vcr_cassettes/translation#export_multilingual_files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"request": {
"body": "",
"headers": [],
"method": "get",
"options": [],
"request_body": "",
"url": "https://platform.api.onesky.io/1/projects/322974/translations/multilingual?api_key=.*&timestamp=.*&dev_hash=.*"
},
"response": {
"binary": true,
"body": "g20AAAJeH4sIADuBBVIAA41UQa/TMAy+71eYcgFpXfeAB1PXViBA4gIc4MIxa9zVWpOUJO02offfcdu9ruXtQCu1jh1//mzHSZ5Jk/tzjVB6VWWL5PGHQmYL4Cfx5CvMPp+EqiuET0YJ0kk0aBfDFoVeQF4K69CnQeOLcBNAlE2Mpfd1iL8batPgo9EetQ+7sAHkwyoNPJ581IXfjlC3kLRQmAYt4bE21k/8jyR9mUpsKcewXyyBNHkSVehyUWF6d4Vy/szJdAwugXPngsG2M/IMf3qxX4r8sLem0TLMTWVsDM+LNb+vtuMWJeyedAzrq6oWUpLez3QFMw0Loag6xxB8r1HDD6FdsITgC1YtesoFfMMGWTMqlvDBcgZLcLw1dGipuCL2wkP/ldROSPfpx/B2va5PT3neowLReHOD7v3M4VbuxST+zliJNrRCUuNiuEO1nVAScUX6sOR/S448ygnBR7jXmzebzQSx60UoMTdWeDLMVRuNU9D3CiUJeKHEKbxk+a7L8uW0ZfMO/k8mD6M0L+SkmPOKzfp+w/ZPadZz61jvsWRXEsM3ifojmnXyIomGeVwkXWo8nkzycpDLuyejyarBVmc/S3Igez2whM6LXUWu5F54AzuExrFYGAtUVY3zXdVbBBwQHc8Pe+eN4gFzK/hlGs753DmBZ+Th4F3Q9dXrSL40jYfaEiPnhktBuu8n8Fq4A6feB63RKnKODaskqkfWCd8XFos06G6NOIqOx+OKhBYrY/fREM9Fl2hB9tVY5PCMp/oYqxWDiawHTKK+Ukl0qVs0XG9/AQiVqov2BAAA",
"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": "text/plain; charset=UTF-8",
"Date": "Thu, 22 Nov 2018 19:47:58 GMT",
"Expires": "Thu, 19 Nov 1981 08:52:00 GMT",
"Pragma": "no-cache",
"Server": "Apache",
"Set-Cookie": "PHPSESSID=5nlveu1qbnm1ktv7jid2jfbte2; path=/",
"Content-Length": "161126",
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
}
}
]
14 changes: 14 additions & 0 deletions lib/onesky/resources/translation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ defmodule Onesky.Translation do
[Translation](https://github.com/onesky/api-documentation-platform/blob/master/resources/translation.md)
"""

@doc """
EXPORT translations in files
"""
def export_files(client, project_id, params) do
Tesla.get(client, "/projects/#{project_id}/translations", query: params)
end

@doc """
export translations in MULTILINGUAL files
"""
def export_multilingual_files(client, project_id, params) do
Tesla.get(client, "/projects/#{project_id}/translations/multilingual", query: params)
end

@doc """
LIST uploaded files
"""
Expand Down
18 changes: 18 additions & 0 deletions test/onesky/resources/translation_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ defmodule TranslationTest do

doctest Onesky.Translation

test "export_files" do
use_cassette "translation#export_files" do
params = [locale: "zh-TW", source_file_name: "string.po"]
{:ok, %Tesla.Env{} = env} = Onesky.client() |> Onesky.Translation.export_files(322_974, params)

assert env.status == 200
end
end

test "export_multilingual_files" do
use_cassette "translation#export_multilingual_files" do
params = [source_file_name: "app.json"]
{:ok, %Tesla.Env{} = env} = Onesky.client() |> Onesky.Translation.export_multilingual_files(322_974, params)

assert env.status == 200
end
end

test "get_appstore_description" do
use_cassette "translation#app_store" do
locale = %{"locale" => "en"}
Expand Down

0 comments on commit 82f7299

Please sign in to comment.