crowdin-api 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ec79bf0a2483fca9502087888c52323ebe12c0c755897f0c71759722f74fd89
|
4
|
+
data.tar.gz: b38ea8b69348734224f7631403f2ac0c6b33496c9098556688c4e648c85cbb6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aea9c98831b8abfacb4fe670d4d9025cee21cf33334083645ad9f4767f5d375249a9d2fde8ab7739fec3ca61f1ade03496f23b12377414ce18f62eea2819f453
|
7
|
+
data.tar.gz: 5e69bf63d256bb96faaa11d749635253ad4625b6741d3d312cd7b61af127bd09d494ee87350b7b589e9c8c78de807bccba25286480627aa0e80153554e81fd1f
|
data/README.md
CHANGED
@@ -121,8 +121,8 @@ storage = crowdin.add_storage(File.open('YourFilename.extension', 'r'))
|
|
121
121
|
storage = crowdin.add_storage('YourFilename.extension')
|
122
122
|
|
123
123
|
# Download file
|
124
|
-
filename = crowdin.download_file(
|
125
|
-
# your_destination - filename or full path to file
|
124
|
+
filename = crowdin.download_file(your_file_id, your_destination, your_project_id)
|
125
|
+
# your_destination - filename or full path to file, default - saving to currect directory with default filename
|
126
126
|
# project_id is optional, as it can be initialized with a Crowdin Client
|
127
127
|
|
128
128
|
# File revisions
|
@@ -233,7 +233,7 @@ module Crowdin
|
|
233
233
|
request.perform
|
234
234
|
end
|
235
235
|
|
236
|
-
def download_file(
|
236
|
+
def download_file(file_id = nil, destination = nil, project_id = config.project_id)
|
237
237
|
destination || raise_parameter_is_required_error(:destination)
|
238
238
|
file_id || raise_parameter_is_required_error(:file_id)
|
239
239
|
project_id || raise_project_id_is_required_error
|
@@ -100,7 +100,7 @@ module Crowdin
|
|
100
100
|
request.perform
|
101
101
|
end
|
102
102
|
|
103
|
-
def download_project_translations(
|
103
|
+
def download_project_translations(build_id = nil, destination = nil, project_id = config.project_id)
|
104
104
|
destination || raise_parameter_is_required_error(:destination)
|
105
105
|
build_id || raise_parameter_is_required_error(:build_id)
|
106
106
|
project_id || raise_project_id_is_required_error
|
@@ -143,14 +143,16 @@ module Crowdin
|
|
143
143
|
request.perform
|
144
144
|
end
|
145
145
|
|
146
|
-
def export_project_translation(query = {}, project_id = config.project_id)
|
146
|
+
def export_project_translation(query = {}, destination = nil, project_id = config.project_id)
|
147
147
|
project_id || raise_project_id_is_required_error
|
148
148
|
|
149
149
|
request = Web::Request.new(
|
150
150
|
self,
|
151
151
|
:post,
|
152
152
|
"/projects/#{project_id}/translations/exports",
|
153
|
-
query
|
153
|
+
query,
|
154
|
+
{},
|
155
|
+
destination
|
154
156
|
)
|
155
157
|
|
156
158
|
request.perform
|
@@ -69,9 +69,12 @@ module Crowdin
|
|
69
69
|
|
70
70
|
def download_file(url)
|
71
71
|
download = URI.parse(url).open
|
72
|
-
|
72
|
+
destination = @destination || download.meta['content-disposition']
|
73
|
+
.match(/filename=("?)(.+)\1/)[2]
|
73
74
|
|
74
|
-
|
75
|
+
IO.copy_stream(download, destination)
|
76
|
+
|
77
|
+
destination
|
75
78
|
rescue StandardError => error
|
76
79
|
client.log! error
|
77
80
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowdin-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crowdin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open-uri
|