ruby-lokalise-api 9.2.1 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dec4243f98c519d1dfb8d66de1d6d7cb6794d97e6ed1f7e8962d72ad141af1f
4
- data.tar.gz: b2a1468269686f8e2fada398cbd19cb69e92e243aa968d5c70beec61fc43fb6f
3
+ metadata.gz: 629370ecc172cb152cfe2341dda5f25f671c6c7ee22694e85109817578bfb556
4
+ data.tar.gz: c7e63178a3e34f5fd4be71ce877d9f8e13060a2faa92fcce02e8863239297af0
5
5
  SHA512:
6
- metadata.gz: 4398fd7dfcde203df5e13af5c60fff8d22870c28b19bf97ffae1368123e531fbf4b843cbd8a67222de9ec37d507ff117bebb2c44004621102b85544884e1abcd
7
- data.tar.gz: bd21d0e1072fd0dbda803c0eb93040de9c3a5e4c30f7684b31146c7a412994eb86d877f3c85b83014ce85bc9a7e6ca79acec3e4a9cfb37889f0568149a9022f5
6
+ metadata.gz: 8abab50ba6b978a40a2e1f5797052b7cfeb9fb44ad4d4d5ca3265006d1388761a5f5b115d9bc5874a3b45f24117f75556999ce34c082a7789775c3a306cacb87
7
+ data.tar.gz: d1c6236778bd2fe7b82318f6d7fc886479e01d544dc415fad08fa7c06c8b6ee6bf928b56fbe4a103a3d649b87afa4ab7655099a363f3e326986b86f33b58468c
@@ -2,11 +2,11 @@
2
2
 
3
3
  module RubyLokaliseApi
4
4
  # This class contains the base client. Inherited by Client (regular API client)
5
- # and OAuth2Client (used for OAuth-2 based authentication)
5
+ # and OAuth2Client (used for OAuth2-based authentication)
6
6
  class BaseClient
7
7
  include RubyLokaliseApi::Rest
8
8
 
9
- attr_reader :token, :token_header
9
+ attr_reader :token, :token_header, :api_host
10
10
  attr_accessor :timeout, :open_timeout
11
11
 
12
12
  def initialize(token, params = {})
@@ -14,6 +14,7 @@ module RubyLokaliseApi
14
14
  @timeout = params.fetch(:timeout, nil)
15
15
  @open_timeout = params.fetch(:open_timeout, nil)
16
16
  @token_header = ''
17
+ @api_host = params.fetch(:api_host, nil)
17
18
  end
18
19
  end
19
20
  end
@@ -54,7 +54,7 @@ module RubyLokaliseApi
54
54
  accept: 'application/json',
55
55
  user_agent: "ruby-lokalise-api gem/#{RubyLokaliseApi::VERSION}"
56
56
  },
57
- url: endpoint.base_url
57
+ url: endpoint.client.api_host || endpoint.base_url
58
58
  }
59
59
  end
60
60
 
@@ -4,7 +4,7 @@ module RubyLokaliseApi
4
4
  module OAuth2
5
5
  # This class defines OAuth2 flow
6
6
  class Auth
7
- attr_reader :client_id, :client_secret, :timeout, :open_timeout
7
+ attr_reader :client_id, :client_secret, :timeout, :open_timeout, :api_host
8
8
 
9
9
  OAUTH2_ENDPOINT = RubyLokaliseApi::Endpoints::OAuth2::OAuth2Endpoint
10
10
 
@@ -13,6 +13,7 @@ module RubyLokaliseApi
13
13
  @client_secret = client_secret
14
14
  @timeout = params[:timeout]
15
15
  @open_timeout = params[:open_timeout]
16
+ @api_host = params[:api_host]
16
17
  end
17
18
 
18
19
  # Returns OAuth2 endpoint URI
@@ -36,6 +36,7 @@ module RubyLokaliseApi
36
36
  delegate_call :files
37
37
  delegate_call :upload_file
38
38
  delegate_call :download_files
39
+ delegate_call :download_files_async
39
40
  delegate_call :destroy_file
40
41
 
41
42
  delegate_call :create_jwt
@@ -50,6 +50,24 @@ module RubyLokaliseApi
50
50
  RubyLokaliseApi::Generics::DownloadBundle.new data.content
51
51
  end
52
52
 
53
+ # Downloads translation files from the project asynchronously
54
+ #
55
+ # @see https://developers.lokalise.com/reference/download-files-async
56
+ # @return [RubyLokaliseApi::Resources::QueuedProcess]
57
+ # @param project_id [String]
58
+ # @param req_params [Hash]
59
+ def download_files_async(project_id, req_params)
60
+ params = { query: [project_id, :'async-download'], req: req_params }
61
+
62
+ response = endpoint(name: 'Files', params: params).do_post
63
+
64
+ process_id = response.content['process_id']
65
+
66
+ response.patch_endpoint_with endpoint(name: 'QueuedProcesses', params: { query: [project_id, process_id] })
67
+
68
+ resource 'QueuedProcess', response
69
+ end
70
+
53
71
  # Deletes a single file from the project.
54
72
  # Only the "Documents" projects are supported
55
73
  #
@@ -6,10 +6,10 @@ module RubyLokaliseApi
6
6
  using RubyLokaliseApi::Utils::Strings
7
7
  using RubyLokaliseApi::Utils::Classes
8
8
 
9
- private
10
-
11
9
  UNIFIED_RESOURCES = %w[comment].freeze
12
10
 
11
+ private
12
+
13
13
  # Loads attributes for the given resource based on its name
14
14
  #
15
15
  # @return [Array<String>]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLokaliseApi
4
- VERSION = '9.2.1'
4
+ VERSION = '9.4.0'
5
5
  end
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency 'json', '~> 2'
28
28
  spec.add_dependency 'zeitwerk', '~> 2.4'
29
29
 
30
+ spec.add_development_dependency 'base64', '~> 0.2.0'
30
31
  spec.add_development_dependency 'dotenv', '~> 3.0'
31
32
  spec.add_development_dependency 'oj', '~> 3.10'
32
33
  spec.add_development_dependency 'rake', '~> 13.0'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lokalise-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.1
4
+ version: 9.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Krukowski
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-01 00:00:00.000000000 Z
10
+ date: 2025-02-17 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: addressable
@@ -86,6 +85,20 @@ dependencies:
86
85
  - - "~>"
87
86
  - !ruby/object:Gem::Version
88
87
  version: '2.4'
88
+ - !ruby/object:Gem::Dependency
89
+ name: base64
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: 0.2.0
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: 0.2.0
89
102
  - !ruby/object:Gem::Dependency
90
103
  name: dotenv
91
104
  requirement: !ruby/object:Gem::Requirement
@@ -392,7 +405,6 @@ licenses:
392
405
  - BSD-3-Clause
393
406
  metadata:
394
407
  rubygems_mfa_required: 'true'
395
- post_install_message:
396
408
  rdoc_options: []
397
409
  require_paths:
398
410
  - lib
@@ -407,8 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
419
  - !ruby/object:Gem::Version
408
420
  version: '0'
409
421
  requirements: []
410
- rubygems_version: 3.5.22
411
- signing_key:
422
+ rubygems_version: 3.6.3
412
423
  specification_version: 4
413
424
  summary: Ruby interface to the Lokalise API
414
425
  test_files: []