lokalise-api-next 0.0.2
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 +7 -0
- data/LICENSE +13 -0
- data/README.md +92 -0
- data/lib/lokalise_api_next/base_client.rb +32 -0
- data/lib/lokalise_api_next/client_vantage.rb +10 -0
- data/lib/lokalise_api_next/collections/base.rb +26 -0
- data/lib/lokalise_api_next/collections/vantage/content_units.rb +14 -0
- data/lib/lokalise_api_next/collections/vantage/exports.rb +14 -0
- data/lib/lokalise_api_next/collections/vantage/project_items.rb +14 -0
- data/lib/lokalise_api_next/collections/vantage/project_languages.rb +12 -0
- data/lib/lokalise_api_next/collections/vantage/projects.rb +14 -0
- data/lib/lokalise_api_next/collections/vantage/segments.rb +14 -0
- data/lib/lokalise_api_next/collections/vantage/tasks.rb +14 -0
- data/lib/lokalise_api_next/collections/vantage/uploads.rb +14 -0
- data/lib/lokalise_api_next/concerns/paginated.rb +24 -0
- data/lib/lokalise_api_next/connection.rb +59 -0
- data/lib/lokalise_api_next/endpoints/base.rb +27 -0
- data/lib/lokalise_api_next/endpoints/vantage/content_units.rb +18 -0
- data/lib/lokalise_api_next/endpoints/vantage/exports.rb +40 -0
- data/lib/lokalise_api_next/endpoints/vantage/imports.rb +18 -0
- data/lib/lokalise_api_next/endpoints/vantage/project_items.rb +18 -0
- data/lib/lokalise_api_next/endpoints/vantage/project_languages.rb +18 -0
- data/lib/lokalise_api_next/endpoints/vantage/projects.rb +23 -0
- data/lib/lokalise_api_next/endpoints/vantage/segments.rb +31 -0
- data/lib/lokalise_api_next/endpoints/vantage/tasks.rb +22 -0
- data/lib/lokalise_api_next/endpoints/vantage/translation_statuses.rb +22 -0
- data/lib/lokalise_api_next/endpoints/vantage/uploads.rb +27 -0
- data/lib/lokalise_api_next/error.rb +105 -0
- data/lib/lokalise_api_next/models/base.rb +34 -0
- data/lib/lokalise_api_next/models/vantage/content_unit.rb +19 -0
- data/lib/lokalise_api_next/models/vantage/export.rb +19 -0
- data/lib/lokalise_api_next/models/vantage/export_download_url.rb +12 -0
- data/lib/lokalise_api_next/models/vantage/import.rb +12 -0
- data/lib/lokalise_api_next/models/vantage/project.rb +23 -0
- data/lib/lokalise_api_next/models/vantage/project_item.rb +18 -0
- data/lib/lokalise_api_next/models/vantage/project_language.rb +17 -0
- data/lib/lokalise_api_next/models/vantage/segment.rb +24 -0
- data/lib/lokalise_api_next/models/vantage/task.rb +23 -0
- data/lib/lokalise_api_next/models/vantage/translation_status.rb +17 -0
- data/lib/lokalise_api_next/models/vantage/upload.rb +23 -0
- data/lib/lokalise_api_next/models/vantage/upload_batch.rb +15 -0
- data/lib/lokalise_api_next/request.rb +32 -0
- data/lib/lokalise_api_next/response.rb +34 -0
- data/lib/lokalise_api_next/rest/vantage/content_units.rb +19 -0
- data/lib/lokalise_api_next/rest/vantage/exports.rb +39 -0
- data/lib/lokalise_api_next/rest/vantage/imports.rb +19 -0
- data/lib/lokalise_api_next/rest/vantage/project_items.rb +19 -0
- data/lib/lokalise_api_next/rest/vantage/project_languages.rb +19 -0
- data/lib/lokalise_api_next/rest/vantage/projects.rb +26 -0
- data/lib/lokalise_api_next/rest/vantage/segments.rb +26 -0
- data/lib/lokalise_api_next/rest/vantage/tasks.rb +19 -0
- data/lib/lokalise_api_next/rest/vantage/translation_statuses.rb +19 -0
- data/lib/lokalise_api_next/rest/vantage/uploads.rb +33 -0
- data/lib/lokalise_api_next/rest_vantage.rb +20 -0
- data/lib/lokalise_api_next/version.rb +5 -0
- data/lib/lokalise_api_next.rb +16 -0
- data/lokalise-api-next.gemspec +31 -0
- metadata +156 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 88d19476ec7711330333098331e5bbd057920c239025dc9b45b923afb52c8cef
|
|
4
|
+
data.tar.gz: c84aecdefed351e4765c94fede0643d3d4544b00233d31a29e4546c5c26e2b1c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 271601532dc476a927aa53a50b57f7d41680910fb7d5c1fa999218ecc46413560357348f63d66193a024d574eb82d333477d592d1dff7cca35a18af58e9f211e
|
|
7
|
+
data.tar.gz: 3ca355127c47a4cb54e83781fc069b6996ce5febb5d05cf3896bc607140b79042b90fc63b81c16682a94f5065af5cb578c47ac7f6b329f11fa69828817fc6e37
|
data/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
BSD 3 Clause
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Lokalise Group, Elijah S. Krukowski
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
8
|
+
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
10
|
+
|
|
11
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Ruby SDK for Lokalise API
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
[](https://qlty.sh/gh/lokalise/projects/ruby-lokalise-api-next)
|
|
6
|
+
[](https://qlty.sh/gh/lokalise/projects/ruby-lokalise-api-next)
|
|
7
|
+
|
|
8
|
+
Opinionated Ruby SDK for the [Lokalise Vantage API](https://developers.lokalise.com/reference/lokalise-vantage-api-introduction).
|
|
9
|
+
|
|
10
|
+
The `lokalise-api-next` gem provides a Ruby interface for working with Lokalise Vantage resources. It handles authentication, HTTP requests, response parsing, and API errors, and returns Ruby models and collections.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- Ruby 3.4 or newer
|
|
15
|
+
- A Lokalise API token with access to Vantage
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Add the gem to your Gemfile:
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
gem 'lokalise-api-next'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then run:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
bundle install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Create a client using your Lokalise API token:
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
require 'lokalise_api_next'
|
|
37
|
+
|
|
38
|
+
client_vantage = LokaliseApiNext.client_vantage(
|
|
39
|
+
ENV.fetch('LOKALISE_VANTAGE_TOKEN')
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For example, retrieve a project:
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
project = client_vantage.project('project-id')
|
|
47
|
+
|
|
48
|
+
puts project.name
|
|
49
|
+
puts project.description
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or list projects belonging to a team:
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
projects = client_vantage.projects('team-id', limit: 20)
|
|
56
|
+
|
|
57
|
+
projects.each do |project|
|
|
58
|
+
puts "#{project.project_id}: #{project.name}"
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The SDK also supports configurable timeouts, automatic retries, proxies, and persistent HTTP connections.
|
|
63
|
+
|
|
64
|
+
## Documentation
|
|
65
|
+
|
|
66
|
+
See the **[GitHub Wiki](../../wiki)** for usage examples, client configuration, pagination, and available API operations.
|
|
67
|
+
|
|
68
|
+
## Development and testing
|
|
69
|
+
|
|
70
|
+
Clone the repository and install dependencies:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
bundle install
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Run the test suite:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
bundle exec rspec
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Run RuboCop:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
bundle exec rubocop
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The tests use RSpec and WebMock to simulate API responses, so a real API token is not required.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
(c) 2026 Lokalise group, Elijah S. Krukowski, BSD 3 Clause license.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
# Base client with shared HTTP configuration.
|
|
5
|
+
class BaseClient
|
|
6
|
+
attr_reader :token, :token_header, :api_host, :base_path,
|
|
7
|
+
:timeout, :open_timeout, :persistent, :proxy
|
|
8
|
+
|
|
9
|
+
def initialize(token, params = {})
|
|
10
|
+
@token = token.dup.freeze
|
|
11
|
+
|
|
12
|
+
configure_api(params)
|
|
13
|
+
configure_transport(params)
|
|
14
|
+
initialize_connection
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def configure_api(params)
|
|
20
|
+
@token_header = params.fetch(:token_header, 'x-api-token').dup.freeze
|
|
21
|
+
@api_host = params.fetch(:api_host, 'https://api.lokalise.com').dup.freeze
|
|
22
|
+
@base_path = params.fetch(:base_path, self.class::BASE_PATH).dup.freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def configure_transport(params)
|
|
26
|
+
@timeout = params[:timeout]
|
|
27
|
+
@open_timeout = params[:open_timeout]
|
|
28
|
+
@persistent = params.fetch(:persistent, false)
|
|
29
|
+
@proxy = params[:proxy]&.dup&.freeze
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'forwardable'
|
|
4
|
+
|
|
5
|
+
module LokaliseApiNext
|
|
6
|
+
module Collections
|
|
7
|
+
# Base class for API resource collections.
|
|
8
|
+
class Base
|
|
9
|
+
include Enumerable
|
|
10
|
+
extend Forwardable
|
|
11
|
+
|
|
12
|
+
attr_reader :items
|
|
13
|
+
|
|
14
|
+
def_delegators :items, :[], :last, :each, :size, :empty?
|
|
15
|
+
|
|
16
|
+
def self.from_response(response)
|
|
17
|
+
new(response.fetch('data'), response.fetch('meta', nil))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def initialize(json_items, _meta = nil)
|
|
21
|
+
model_klass = self.class::MODEL
|
|
22
|
+
@items = json_items.map { |json_item| model_klass.new(json_item) }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Collections
|
|
5
|
+
module Vantage
|
|
6
|
+
# Paginated collection of Vantage content units.
|
|
7
|
+
class ContentUnits < Base
|
|
8
|
+
include Concerns::Paginated
|
|
9
|
+
|
|
10
|
+
MODEL = Models::Vantage::ContentUnit
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Collections
|
|
5
|
+
module Vantage
|
|
6
|
+
# Paginated collection of Vantage exports.
|
|
7
|
+
class Exports < Base
|
|
8
|
+
include Concerns::Paginated
|
|
9
|
+
|
|
10
|
+
MODEL = Models::Vantage::Export
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Collections
|
|
5
|
+
module Vantage
|
|
6
|
+
# Paginated collection of Vantage project items.
|
|
7
|
+
class ProjectItems < Base
|
|
8
|
+
include Concerns::Paginated
|
|
9
|
+
|
|
10
|
+
MODEL = Models::Vantage::ProjectItem
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Collections
|
|
5
|
+
module Vantage
|
|
6
|
+
# Represents a collection of Vantage projects.
|
|
7
|
+
class Projects < Base
|
|
8
|
+
include LokaliseApiNext::Concerns::Paginated
|
|
9
|
+
|
|
10
|
+
MODEL = Models::Vantage::Project
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Collections
|
|
5
|
+
module Vantage
|
|
6
|
+
# Paginated collection of Vantage segments.
|
|
7
|
+
class Segments < Base
|
|
8
|
+
include Concerns::Paginated
|
|
9
|
+
|
|
10
|
+
MODEL = Models::Vantage::Segment
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Collections
|
|
5
|
+
module Vantage
|
|
6
|
+
# Paginated collection of Vantage uploads.
|
|
7
|
+
class Uploads < Base
|
|
8
|
+
include Concerns::Paginated
|
|
9
|
+
|
|
10
|
+
MODEL = Models::Vantage::Upload
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Concerns
|
|
5
|
+
# Adds pagination metadata to API collections.
|
|
6
|
+
module Paginated
|
|
7
|
+
attr_reader :page_count, :cursor
|
|
8
|
+
|
|
9
|
+
def initialize(json_items, meta = nil)
|
|
10
|
+
super
|
|
11
|
+
|
|
12
|
+
raise ArgumentError, 'Pagination metadata is missing' unless meta.is_a?(Hash)
|
|
13
|
+
|
|
14
|
+
@page_count = meta.fetch('count')
|
|
15
|
+
@cursor = meta['cursor']
|
|
16
|
+
@has_more = meta.fetch('hasMore')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def more?
|
|
20
|
+
@has_more
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'httpx'
|
|
4
|
+
|
|
5
|
+
module LokaliseApiNext
|
|
6
|
+
# Configures HTTP connections to the Vantage API.
|
|
7
|
+
module Connection
|
|
8
|
+
def close
|
|
9
|
+
connection.close
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
attr_reader :connection
|
|
15
|
+
|
|
16
|
+
def initialize_connection
|
|
17
|
+
options = {
|
|
18
|
+
origin: api_host,
|
|
19
|
+
base_path: base_path,
|
|
20
|
+
headers: connection_headers
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
timeouts = connection_timeouts
|
|
24
|
+
options[:timeout] = timeouts unless timeouts.empty?
|
|
25
|
+
|
|
26
|
+
session = connection_plugins.reduce(HTTPX) do |httpx, plugin|
|
|
27
|
+
httpx.plugin(plugin)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
session = session.with(**options)
|
|
31
|
+
session = session.with_proxy(uri: proxy) if proxy
|
|
32
|
+
|
|
33
|
+
@connection = session
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def connection_plugins
|
|
37
|
+
plugins = [:retries]
|
|
38
|
+
plugins << :persistent if persistent
|
|
39
|
+
plugins << :proxy if proxy
|
|
40
|
+
|
|
41
|
+
plugins
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def connection_headers
|
|
45
|
+
{
|
|
46
|
+
'Accept' => 'application/json',
|
|
47
|
+
'User-Agent' => "ruby-lokalise-api-next/#{LokaliseApiNext::VERSION}",
|
|
48
|
+
token_header => token
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def connection_timeouts
|
|
53
|
+
{
|
|
54
|
+
connect_timeout: open_timeout,
|
|
55
|
+
request_timeout: timeout
|
|
56
|
+
}.compact
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'addressable/template'
|
|
4
|
+
|
|
5
|
+
module LokaliseApiNext
|
|
6
|
+
module Endpoints
|
|
7
|
+
# Base class for building API endpoint paths.
|
|
8
|
+
class Base
|
|
9
|
+
class << self
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def build_path(pattern, **params)
|
|
13
|
+
template = Addressable::Template.new(pattern)
|
|
14
|
+
values = params.transform_keys(&:to_s)
|
|
15
|
+
|
|
16
|
+
missing = template.variables.select do |name|
|
|
17
|
+
values[name].to_s.strip.empty?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
raise ArgumentError, "Missing required path parameters: #{missing.join(', ')}" unless missing.empty?
|
|
21
|
+
|
|
22
|
+
template.expand(values).to_s
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for project languages operations.
|
|
7
|
+
class ContentUnits < Base
|
|
8
|
+
COLLECTION_PATH = '/projects/{project_id}/items/{item_id}/content-units'
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def list(project_id:, item_id:)
|
|
12
|
+
build_path(COLLECTION_PATH, project_id: project_id, item_id: item_id)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for export operations.
|
|
7
|
+
class Exports < Base
|
|
8
|
+
COLLECTION_PATH = '/projects/{project_id}/exports'
|
|
9
|
+
MEMBER_PATH = '/projects/{project_id}/exports/{export_id}'
|
|
10
|
+
DOWNLOAD_URL_PATH = '/projects/{project_id}/exports/{export_id}/download-url'
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
def list(project_id:)
|
|
14
|
+
build_path(COLLECTION_PATH, project_id: project_id)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def fetch(project_id:, export_id:)
|
|
18
|
+
build_path(
|
|
19
|
+
MEMBER_PATH,
|
|
20
|
+
project_id: project_id,
|
|
21
|
+
export_id: export_id
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create(project_id:)
|
|
26
|
+
build_path(COLLECTION_PATH, project_id: project_id)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def download_url(project_id:, export_id:)
|
|
30
|
+
build_path(
|
|
31
|
+
DOWNLOAD_URL_PATH,
|
|
32
|
+
project_id: project_id,
|
|
33
|
+
export_id: export_id
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for project import operations.
|
|
7
|
+
class Imports < Base
|
|
8
|
+
COLLECTION_PATH = '/projects/{project_id}/imports'
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def create(project_id:)
|
|
12
|
+
build_path(COLLECTION_PATH, project_id: project_id)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for project languages operations.
|
|
7
|
+
class ProjectItems < Base
|
|
8
|
+
COLLECTION_PATH = '/projects/{project_id}/items'
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def list(project_id:)
|
|
12
|
+
build_path(COLLECTION_PATH, project_id: project_id)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for project languages operations.
|
|
7
|
+
class ProjectLanguages < Base
|
|
8
|
+
COLLECTION_PATH = '/projects/{project_id}/languages'
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def list(project_id:)
|
|
12
|
+
build_path(COLLECTION_PATH, project_id: project_id)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for project operations.
|
|
7
|
+
class Projects < Base
|
|
8
|
+
COLLECTION_PATH = '/teams/{team_id}/projects'
|
|
9
|
+
MEMBER_PATH = '/projects/{project_id}'
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def list(team_id:)
|
|
13
|
+
build_path(COLLECTION_PATH, team_id: team_id)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def fetch(project_id:)
|
|
17
|
+
build_path(MEMBER_PATH, project_id: project_id)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for segment operations.
|
|
7
|
+
class Segments < Base
|
|
8
|
+
COLLECTION_PATH = '/projects/{project_id}/content-units/{content_unit_id}/segments'
|
|
9
|
+
MEMBER_PATH = '/projects/{project_id}/segments/{segment_id}'
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def list(project_id:, content_unit_id:)
|
|
13
|
+
build_path(
|
|
14
|
+
COLLECTION_PATH,
|
|
15
|
+
project_id: project_id,
|
|
16
|
+
content_unit_id: content_unit_id
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def update(project_id:, segment_id:)
|
|
21
|
+
build_path(
|
|
22
|
+
MEMBER_PATH,
|
|
23
|
+
project_id: project_id,
|
|
24
|
+
segment_id: segment_id
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for task operations.
|
|
7
|
+
class Tasks < Base
|
|
8
|
+
COLLECTION_PATH = '/teams/{team_id}/projects/{project_id}/tasks'
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def list(team_id:, project_id:)
|
|
12
|
+
build_path(
|
|
13
|
+
COLLECTION_PATH,
|
|
14
|
+
team_id: team_id,
|
|
15
|
+
project_id: project_id
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for translation status operations.
|
|
7
|
+
class TranslationStatuses < Base
|
|
8
|
+
MEMBER_PATH = '/projects/{project_id}/translation-statuses/{import_id}'
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def fetch(project_id:, import_id:)
|
|
12
|
+
build_path(
|
|
13
|
+
MEMBER_PATH,
|
|
14
|
+
project_id: project_id,
|
|
15
|
+
import_id: import_id
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LokaliseApiNext
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Vantage
|
|
6
|
+
# Builds paths for project upload operations.
|
|
7
|
+
class Uploads < Base
|
|
8
|
+
COLLECTION_PATH = '/projects/{project_id}/uploads'
|
|
9
|
+
COMPLETE_PATH = '/projects/{project_id}/uploads/actions/complete'
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def list(project_id:)
|
|
13
|
+
build_path(COLLECTION_PATH, project_id: project_id)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def stage(project_id:)
|
|
17
|
+
build_path(COLLECTION_PATH, project_id: project_id)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def complete(project_id:)
|
|
21
|
+
build_path(COMPLETE_PATH, project_id: project_id)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|