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: cc71aeec74dd34cef85bb90b9accdd273d18ce3fd8ba9888eb3ce6a073e6aff0
4
- data.tar.gz: 39e8290a34930ad659e1ad5879f4f91283f82f88f2316c7f64f03ef524de35cc
3
+ metadata.gz: 4ec79bf0a2483fca9502087888c52323ebe12c0c755897f0c71759722f74fd89
4
+ data.tar.gz: b38ea8b69348734224f7631403f2ac0c6b33496c9098556688c4e648c85cbb6c
5
5
  SHA512:
6
- metadata.gz: d95cbb784a0148eab14bce79dff1dd70735e60aecad95f3be2402ac525581bae5c42dfce8f888ab7255fa3096f7153201a3256d3a6f41821a35f9eaec215abab
7
- data.tar.gz: 4b9604fa346136d64a69beb7643beff66433cbbc9102242f56bac6b3f9ebd23e29cc70339e63b9c1a754ce77cf71a6c624d1b97120a5b7f82fb3dbdcb3b23054
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(your_destination, your_file_id, your_project_id)
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(destination = nil, file_id = nil, project_id = config.project_id)
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(destination = nil, build_id = nil, project_id = config.project_id)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Crowdin
4
4
  class Client
5
- VERSION = '1.1.0'
5
+ VERSION = '1.1.1'
6
6
  end
7
7
  end
@@ -69,9 +69,12 @@ module Crowdin
69
69
 
70
70
  def download_file(url)
71
71
  download = URI.parse(url).open
72
- IO.copy_stream(download, @destination)
72
+ destination = @destination || download.meta['content-disposition']
73
+ .match(/filename=("?)(.+)\1/)[2]
73
74
 
74
- @destination
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.0
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: 2021-12-14 00:00:00.000000000 Z
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open-uri