crowdin-api 1.5.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/build-and-publish.yml +11 -7
- data/.github/workflows/dependency-analysis.yml +15 -0
- data/.github/workflows/docs.yml +12 -9
- data/.github/workflows/lint-pr-title.yml +18 -0
- data/.github/workflows/release.yml +29 -0
- data/.github/workflows/test-and-lint.yml +6 -3
- data/.gitignore +0 -1
- data/.release-it.json +31 -0
- data/.rubocop.yml +3 -0
- data/CONTRIBUTING.md +6 -1
- data/Gemfile.lock +109 -0
- data/README.md +10 -28
- data/crowdin-api.gemspec +1 -1
- data/lib/crowdin-api/api_resources/applications.rb +81 -0
- data/lib/crowdin-api/api_resources/bundles.rb +49 -0
- data/lib/crowdin-api/api_resources/glossaries.rb +16 -0
- data/lib/crowdin-api/api_resources/notifications.rb +53 -0
- data/lib/crowdin-api/api_resources/storages.rb +1 -1
- data/lib/crowdin-api/api_resources/string_translations.rb +16 -0
- data/lib/crowdin-api/api_resources/translation_memory.rb +16 -0
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api.rb +2 -1
- data/spec/api_resources/applications_spec.rb +47 -0
- data/spec/api_resources/bundles_spec.rb +31 -0
- data/spec/api_resources/glossaries_spec.rb +170 -149
- data/spec/api_resources/notifications_spec.rb +64 -0
- data/spec/api_resources/string_translations_spec.rb +19 -0
- data/spec/api_resources/translation_memory_spec.rb +21 -0
- data/spec/unit/client_spec.rb +6 -0
- metadata +15 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48893708d5c6c19787dec33d3e7f19c87809e6ab33e17d6b54821483cae925d0
|
4
|
+
data.tar.gz: 4b43a6b919c72b31da170f6d30e771faa07e85e7ebc7845d732a528262e8271d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b99fa959c8338fb9c5557eab55e1dd76964d139eb5e4e411fee8d7cb2b352b559beec71974202c76b0e84995042152fbfe244ef1c56a4618081faa4e03c20c4f
|
7
|
+
data.tar.gz: 90f971f1453892aa47fb7a1ac25bcd8a91a92273b32022b41b647a54a762f180f68d45562f8d009a8a6cd512f217cb25ebedd98927c9f714501c8a229ff1c870
|
@@ -1,9 +1,10 @@
|
|
1
1
|
name: Build and Publish
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
release:
|
5
|
+
types: [published]
|
6
|
+
repository_dispatch:
|
7
|
+
types: [publish]
|
7
8
|
|
8
9
|
jobs:
|
9
10
|
build-and-publish:
|
@@ -12,12 +13,15 @@ jobs:
|
|
12
13
|
packages: write
|
13
14
|
contents: read
|
14
15
|
steps:
|
15
|
-
- uses: actions/checkout@
|
16
|
-
|
17
|
-
|
16
|
+
- uses: actions/checkout@v4
|
17
|
+
|
18
|
+
- name: Set up Ruby 3.0
|
19
|
+
uses: ruby/setup-ruby@v1
|
18
20
|
with:
|
19
|
-
ruby-version:
|
21
|
+
ruby-version: 3.0
|
22
|
+
|
20
23
|
- run: bundle install
|
24
|
+
|
21
25
|
- name: Publish to RubyGems
|
22
26
|
run: |
|
23
27
|
mkdir -p $HOME/.gem
|
@@ -0,0 +1,15 @@
|
|
1
|
+
name: Dependency Analysis
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
schedule:
|
8
|
+
- cron: '0 0 * * MON'
|
9
|
+
workflow_dispatch:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
dependency-analysis:
|
13
|
+
uses: crowdin/.github/.github/workflows/dependency-analysis.yml@main
|
14
|
+
secrets:
|
15
|
+
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
|
data/.github/workflows/docs.yml
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
name: Docs
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
release:
|
5
|
+
types: [published]
|
6
|
+
repository_dispatch:
|
7
|
+
types: [publish]
|
7
8
|
|
8
9
|
jobs:
|
9
10
|
docs:
|
10
11
|
runs-on: ubuntu-latest
|
11
12
|
steps:
|
12
|
-
- uses: actions/checkout@
|
13
|
-
|
14
|
-
|
13
|
+
- uses: actions/checkout@v4
|
14
|
+
|
15
|
+
- name: Set up Ruby 3.0
|
16
|
+
uses: ruby/setup-ruby@v1
|
15
17
|
with:
|
16
|
-
ruby-version:
|
18
|
+
ruby-version: 3.0
|
19
|
+
|
17
20
|
- run: bundle install
|
18
21
|
|
19
22
|
- name: Cleanup the Readme
|
@@ -25,7 +28,7 @@ jobs:
|
|
25
28
|
run: yardoc lib/crowdin-api/api_resources/*.rb
|
26
29
|
|
27
30
|
- name: Deploy 🚀
|
28
|
-
uses: JamesIves/github-pages-deploy-action@v4
|
31
|
+
uses: JamesIves/github-pages-deploy-action@v4
|
29
32
|
with:
|
30
33
|
branch: gh-pages
|
31
|
-
folder: doc
|
34
|
+
folder: doc
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Lint PR Title
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request_target:
|
5
|
+
types:
|
6
|
+
- opened
|
7
|
+
- reopened
|
8
|
+
- edited
|
9
|
+
- synchronize
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
main:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: amannn/action-semantic-pull-request@v5
|
17
|
+
env:
|
18
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Release
|
2
|
+
run-name: Release ${{ github.event.inputs.version }} version
|
3
|
+
|
4
|
+
on:
|
5
|
+
workflow_dispatch:
|
6
|
+
inputs:
|
7
|
+
version:
|
8
|
+
type: choice
|
9
|
+
description: Version
|
10
|
+
options:
|
11
|
+
- patch
|
12
|
+
- minor
|
13
|
+
- major
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
version:
|
17
|
+
permissions:
|
18
|
+
contents: write
|
19
|
+
uses: crowdin/.github/.github/workflows/bump-version.yml@main
|
20
|
+
|
21
|
+
publish:
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
needs: version
|
24
|
+
permissions:
|
25
|
+
contents: write
|
26
|
+
steps:
|
27
|
+
- uses: peter-evans/repository-dispatch@v2
|
28
|
+
with:
|
29
|
+
event-type: publish
|
@@ -12,20 +12,23 @@ jobs:
|
|
12
12
|
runs-on: ubuntu-latest
|
13
13
|
strategy:
|
14
14
|
matrix:
|
15
|
-
ruby-version: [ '
|
15
|
+
ruby-version: [ '3.0', '3.1', '3.2', '3.3' ]
|
16
16
|
steps:
|
17
17
|
- name: Checkout code
|
18
|
-
uses: actions/checkout@
|
18
|
+
uses: actions/checkout@v4
|
19
|
+
|
19
20
|
- name: Set up Ruby
|
20
21
|
uses: ruby/setup-ruby@v1
|
21
22
|
with:
|
22
23
|
ruby-version: ${{ matrix.ruby-version }}
|
23
24
|
bundler-cache: true
|
25
|
+
|
24
26
|
- name: Run tests and linter
|
25
27
|
run: |
|
26
28
|
bundle exec rubocop
|
27
29
|
bundle exec rake
|
30
|
+
|
28
31
|
- name: Publish code coverage report
|
29
|
-
uses: codecov/codecov-action@
|
32
|
+
uses: codecov/codecov-action@v3
|
30
33
|
with:
|
31
34
|
token: ${{ secrets.CODECOV_TOKEN }}
|
data/.gitignore
CHANGED
data/.release-it.json
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"git": {
|
3
|
+
"push": true,
|
4
|
+
"commit": true,
|
5
|
+
"commitMessage": "chore: version ${version} [skip ci]",
|
6
|
+
"requireBranch": "main",
|
7
|
+
"tag": true
|
8
|
+
},
|
9
|
+
"github": {
|
10
|
+
"release": true,
|
11
|
+
"autoGenerate": true,
|
12
|
+
"releaseName": "${version}"
|
13
|
+
},
|
14
|
+
"plugins": {
|
15
|
+
"@j-ulrich/release-it-regex-bumper": {
|
16
|
+
"in": "lib/crowdin-api/client/version.rb",
|
17
|
+
"out": [
|
18
|
+
{
|
19
|
+
"file": "README.md",
|
20
|
+
"search": "gem 'crowdin-api', '~> \\d+\\.\\d+\\.\\d+'",
|
21
|
+
"replace": "gem 'crowdin-api', '~> {{versionWithoutPrerelease}}'"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"file": "lib/crowdin-api/client/version.rb",
|
25
|
+
"search": "VERSION = '\\d+\\.\\d+\\.\\d+'",
|
26
|
+
"replace": "VERSION = '{{versionWithoutPrerelease}}'"
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
data/.rubocop.yml
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
:tada: First off, thanks for taking the time to contribute! :tada:
|
4
4
|
|
5
|
+
The Crowdin API client provides methods that essentially call Crowdin's APIs. This makes it much easier for other developers to make calls to Crowdin's APIs, as the client abstracts a lot of the work required. In short, the API client provides a lightweight interface for making API requests to Crowdin.
|
6
|
+
|
5
7
|
The following is a set of guidelines for contributing to Crowdin Ruby Client. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
6
8
|
|
7
9
|
This project and everyone participating in it are governed by the [Code of Conduct](/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
@@ -59,12 +61,15 @@ Unsure where to begin contributing to Crowdin Ruby Client? You can start by look
|
|
59
61
|
|
60
62
|
Before sending your pull requests, make sure you followed the list below:
|
61
63
|
|
62
|
-
- Read
|
64
|
+
- Read these guidelines.
|
63
65
|
- Read [Code of Conduct](/CODE_OF_CONDUCT.md).
|
64
66
|
- Ensure that your code adheres to standard conventions, as used in the rest of the project.
|
65
67
|
- Ensure that there are unit tests for your code.
|
66
68
|
- Run unit tests.
|
67
69
|
|
70
|
+
> **Note**
|
71
|
+
> This project uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for commit messages and PR titles.
|
72
|
+
|
68
73
|
#### Philosophy of code contribution
|
69
74
|
|
70
75
|
- Include unit tests when you contribute new features, as they help to a) prove that your code works correctly, and b) guard against future breaking changes to lower the maintenance cost.
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
crowdin-api (1.7.0)
|
5
|
+
open-uri (>= 0.1.0, < 0.2.0)
|
6
|
+
rest-client (>= 2.0.0, < 2.2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.8.6)
|
12
|
+
public_suffix (>= 2.0.2, < 6.0)
|
13
|
+
ast (2.4.2)
|
14
|
+
codecov (0.6.0)
|
15
|
+
simplecov (>= 0.15, < 0.22)
|
16
|
+
coderay (1.1.3)
|
17
|
+
crack (0.4.5)
|
18
|
+
rexml
|
19
|
+
diff-lcs (1.5.0)
|
20
|
+
docile (1.4.0)
|
21
|
+
domain_name (0.5.20190701)
|
22
|
+
unf (>= 0.0.5, < 1.0.0)
|
23
|
+
hashdiff (1.1.0)
|
24
|
+
http-accept (1.7.0)
|
25
|
+
http-cookie (1.0.5)
|
26
|
+
domain_name (~> 0.5)
|
27
|
+
json (2.7.1)
|
28
|
+
method_source (1.0.0)
|
29
|
+
mime-types (3.5.2)
|
30
|
+
mime-types-data (~> 3.2015)
|
31
|
+
mime-types-data (3.2023.1205)
|
32
|
+
netrc (0.11.0)
|
33
|
+
open-uri (0.1.0)
|
34
|
+
parallel (1.24.0)
|
35
|
+
parser (3.2.2.4)
|
36
|
+
ast (~> 2.4.1)
|
37
|
+
racc
|
38
|
+
pry (0.14.2)
|
39
|
+
coderay (~> 1.1)
|
40
|
+
method_source (~> 1.0)
|
41
|
+
public_suffix (5.0.4)
|
42
|
+
racc (1.7.3)
|
43
|
+
rainbow (3.1.1)
|
44
|
+
rake (13.1.0)
|
45
|
+
regexp_parser (2.8.3)
|
46
|
+
rest-client (2.1.0)
|
47
|
+
http-accept (>= 1.7.0, < 2.0)
|
48
|
+
http-cookie (>= 1.0.2, < 2.0)
|
49
|
+
mime-types (>= 1.16, < 4.0)
|
50
|
+
netrc (~> 0.8)
|
51
|
+
rexml (3.2.6)
|
52
|
+
rspec (3.12.0)
|
53
|
+
rspec-core (~> 3.12.0)
|
54
|
+
rspec-expectations (~> 3.12.0)
|
55
|
+
rspec-mocks (~> 3.12.0)
|
56
|
+
rspec-core (3.12.2)
|
57
|
+
rspec-support (~> 3.12.0)
|
58
|
+
rspec-expectations (3.12.3)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.12.0)
|
61
|
+
rspec-mocks (3.12.6)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.12.0)
|
64
|
+
rspec-support (3.12.1)
|
65
|
+
rubocop (1.50.2)
|
66
|
+
json (~> 2.3)
|
67
|
+
parallel (~> 1.10)
|
68
|
+
parser (>= 3.2.0.0)
|
69
|
+
rainbow (>= 2.2.2, < 4.0)
|
70
|
+
regexp_parser (>= 1.8, < 3.0)
|
71
|
+
rexml (>= 3.2.5, < 4.0)
|
72
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
73
|
+
ruby-progressbar (~> 1.7)
|
74
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
75
|
+
rubocop-ast (1.30.0)
|
76
|
+
parser (>= 3.2.1.0)
|
77
|
+
ruby-progressbar (1.13.0)
|
78
|
+
simplecov (0.21.2)
|
79
|
+
docile (~> 1.1)
|
80
|
+
simplecov-html (~> 0.11)
|
81
|
+
simplecov_json_formatter (~> 0.1)
|
82
|
+
simplecov-html (0.12.3)
|
83
|
+
simplecov_json_formatter (0.1.4)
|
84
|
+
unf (0.1.4)
|
85
|
+
unf_ext
|
86
|
+
unf_ext (0.0.9.1)
|
87
|
+
unicode-display_width (2.5.0)
|
88
|
+
webmock (3.19.1)
|
89
|
+
addressable (>= 2.8.0)
|
90
|
+
crack (>= 0.3.2)
|
91
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
92
|
+
yard (0.9.34)
|
93
|
+
|
94
|
+
PLATFORMS
|
95
|
+
x86_64-linux
|
96
|
+
|
97
|
+
DEPENDENCIES
|
98
|
+
bundler (~> 2.2, >= 2.2.32)
|
99
|
+
codecov (~> 0.6.0)
|
100
|
+
crowdin-api!
|
101
|
+
pry (~> 0.14.1)
|
102
|
+
rake (~> 13.0, >= 13.0.6)
|
103
|
+
rspec (~> 3.10)
|
104
|
+
rubocop (~> 1.23)
|
105
|
+
webmock (~> 3.14)
|
106
|
+
yard (~> 0.9.28)
|
107
|
+
|
108
|
+
BUNDLED WITH
|
109
|
+
2.4.22
|
data/README.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
-
|
1
|
+
<p align="center">
|
2
|
+
<picture>
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cWhite.png">
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png">
|
5
|
+
<img width="150" height="150" src="https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png">
|
6
|
+
</picture>
|
7
|
+
</p>
|
2
8
|
|
3
9
|
# Crowdin Ruby client
|
4
10
|
|
5
|
-
The Crowdin Ruby client is a lightweight interface to the Crowdin API
|
11
|
+
The Crowdin Ruby client is a lightweight interface to the Crowdin API. It provides common services for making API requests.
|
6
12
|
|
7
13
|
Crowdin API is a full-featured RESTful API that helps you to integrate localization into your development process. The endpoints that we use allow you to easily make calls to retrieve information and to execute actions needed.
|
8
14
|
|
@@ -15,26 +21,12 @@ Crowdin API is a full-featured RESTful API that helps you to integrate localizat
|
|
15
21
|
[![Gem](https://img.shields.io/gem/v/crowdin-api?logo=ruby&cacheSeconds=1800)](https://rubygems.org/gems/crowdin-api)
|
16
22
|
[![Gem](https://img.shields.io/gem/dt/crowdin-api?cacheSeconds=1800)](https://rubygems.org/gems/crowdin-api)
|
17
23
|
[![Gem](https://img.shields.io/gem/dtv/crowdin-api?cacheSeconds=1800)](https://rubygems.org/gems/crowdin-api)
|
18
|
-
|
19
24
|
[![Test and Lint](https://github.com/crowdin/crowdin-api-client-ruby/actions/workflows/test-and-lint.yml/badge.svg)](https://github.com/crowdin/crowdin-api-client-ruby/actions/workflows/test-and-lint.yml)
|
20
25
|
[![codecov](https://codecov.io/gh/crowdin/crowdin-api-client-ruby/branch/main/graph/badge.svg?token=OJsyJwQbFM)](https://codecov.io/gh/crowdin/crowdin-api-client-ruby)
|
21
|
-
[![GitHub issues](https://img.shields.io/github/issues/crowdin/crowdin-api-client-ruby?cacheSeconds=1800)](https://github.com/crowdin/crowdin-api-client-ruby/issues)
|
22
26
|
[![GitHub](https://img.shields.io/github/license/crowdin/crowdin-api-client-ruby?cacheSeconds=1800)](https://github.com/crowdin/crowdin-api-client-ruby/blob/main/LICENSE)
|
23
27
|
|
24
28
|
</div>
|
25
29
|
|
26
|
-
## Table of Contents
|
27
|
-
* [Requirements](#requirements)
|
28
|
-
* [Installation](#installation)
|
29
|
-
* [Quick Start](#quick-start)
|
30
|
-
* [Initialization](#initialization)
|
31
|
-
* [Usage](#usage)
|
32
|
-
* [Fetch all records](#fetch-all-records)
|
33
|
-
* [Command-Line Client](#command-line-client)
|
34
|
-
* [Seeking Assistance](#seeking-assistance)
|
35
|
-
* [Contributing](#contributing)
|
36
|
-
* [License](#license)
|
37
|
-
|
38
30
|
## Requirements
|
39
31
|
* Ruby >= 2.4
|
40
32
|
|
@@ -43,7 +35,7 @@ Crowdin API is a full-featured RESTful API that helps you to integrate localizat
|
|
43
35
|
Add this line to your application's Gemfile:
|
44
36
|
|
45
37
|
```gemfile
|
46
|
-
gem 'crowdin-api', '~> 1.
|
38
|
+
gem 'crowdin-api', '~> 1.7.0'
|
47
39
|
```
|
48
40
|
|
49
41
|
And then execute:
|
@@ -58,14 +50,6 @@ Or install it yourself as:
|
|
58
50
|
gem install crowdin-api
|
59
51
|
```
|
60
52
|
|
61
|
-
---
|
62
|
-
|
63
|
-
:bookmark_tabs: For versions *0.6.0* and lower see the [branch api/v1](https://github.com/crowdin/crowdin-api-client-ruby/tree/api/v1). Please note that these versions are no longer supported.
|
64
|
-
|
65
|
-
:exclamation: Migration from version *0.6.0* to *1.x.x* requires changes in your code.
|
66
|
-
|
67
|
-
---
|
68
|
-
|
69
53
|
## Quick start
|
70
54
|
|
71
55
|
### Initialization
|
@@ -201,11 +185,9 @@ When execute you'll have IRB console with configured *@crowdin* instance
|
|
201
185
|
|
202
186
|
If you find any problems or would like to suggest a feature, please read the [How can I contribute](/CONTRIBUTING.md#how-can-i-contribute) section in our contributing guidelines.
|
203
187
|
|
204
|
-
Need help working with Crowdin Ruby client or have any questions? [Contact](https://crowdin.com/contacts) Customer Success Service.
|
205
|
-
|
206
188
|
## Contributing
|
207
189
|
|
208
|
-
If you
|
190
|
+
If you would like to contribute please read the [Contributing](/CONTRIBUTING.md) guidelines.
|
209
191
|
|
210
192
|
## License
|
211
193
|
|
data/crowdin-api.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.required_ruby_version = '>= 2.4'
|
21
21
|
|
22
22
|
gem.add_runtime_dependency 'open-uri', '>= 0.1.0', '< 0.2.0'
|
23
|
-
gem.add_runtime_dependency 'rest-client', '>= 2.0.0', '< 2.
|
23
|
+
gem.add_runtime_dependency 'rest-client', '>= 2.0.0', '< 2.2.0'
|
24
24
|
|
25
25
|
gem.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.32'
|
26
26
|
gem.add_development_dependency 'codecov', '~> 0.6.0'
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module Applications
|
6
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.applications.api.get API Documentation}
|
7
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.applications.api.get API Documentation}
|
8
|
+
def get_application_data(application_identifier = nil, path = nil)
|
9
|
+
application_identifier || raise_parameter_is_required_error(:application_identifier)
|
10
|
+
application_identifier || raise_parameter_is_required_error(:path)
|
11
|
+
|
12
|
+
request = Web::Request.new(
|
13
|
+
connection,
|
14
|
+
:get,
|
15
|
+
"#{config.target_api_url}/applications/#{application_identifier}/api/#{path}"
|
16
|
+
)
|
17
|
+
Web::SendRequest.new(request).perform
|
18
|
+
end
|
19
|
+
|
20
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.applications.api.put API Documentation}
|
21
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.applications.api.put API Documentation}
|
22
|
+
def update_or_restore_application_data(query = {}, application_identifier = nil, path = nil)
|
23
|
+
application_identifier || raise_parameter_is_required_error(:application_identifier)
|
24
|
+
application_identifier || raise_parameter_is_required_error(:path)
|
25
|
+
|
26
|
+
request = Web::Request.new(
|
27
|
+
connection,
|
28
|
+
:put,
|
29
|
+
"#{config.target_api_url}/applications/#{application_identifier}/api/#{path}",
|
30
|
+
{ params: query }
|
31
|
+
)
|
32
|
+
Web::SendRequest.new(request).perform
|
33
|
+
end
|
34
|
+
|
35
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.applications.api.put API Documentation}
|
36
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.applications.api.put API Documentation}
|
37
|
+
def add_application_data(query = {}, application_identifier = nil, path = nil)
|
38
|
+
application_identifier || raise_parameter_is_required_error(:application_identifier)
|
39
|
+
application_identifier || raise_parameter_is_required_error(:path)
|
40
|
+
|
41
|
+
request = Web::Request.new(
|
42
|
+
connection,
|
43
|
+
:post,
|
44
|
+
"#{config.target_api_url}/applications/#{application_identifier}/api/#{path}",
|
45
|
+
{ params: query }
|
46
|
+
)
|
47
|
+
Web::SendRequest.new(request).perform
|
48
|
+
end
|
49
|
+
|
50
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.applications.api.delete API Documentation}
|
51
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.applications.api.delete API Documentation}
|
52
|
+
def delete_application_data(query = {}, application_identifier = nil, path = nil)
|
53
|
+
application_identifier || raise_parameter_is_required_error(:application_identifier)
|
54
|
+
application_identifier || raise_parameter_is_required_error(:path)
|
55
|
+
|
56
|
+
request = Web::Request.new(
|
57
|
+
connection,
|
58
|
+
:delete,
|
59
|
+
"#{config.target_api_url}/applications/#{application_identifier}/api/#{path}",
|
60
|
+
{ params: query }
|
61
|
+
)
|
62
|
+
Web::SendRequest.new(request).perform
|
63
|
+
end
|
64
|
+
|
65
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.applications.api.patch API Documentation}
|
66
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.applications.api.patch API Documentation}
|
67
|
+
def edit_application_data(query = {}, application_identifier = nil, path = nil)
|
68
|
+
application_identifier || raise_parameter_is_required_error(:application_identifier)
|
69
|
+
application_identifier || raise_parameter_is_required_error(:path)
|
70
|
+
|
71
|
+
request = Web::Request.new(
|
72
|
+
connection,
|
73
|
+
:patch,
|
74
|
+
"#{config.target_api_url}/applications/#{application_identifier}/api/#{path}",
|
75
|
+
{ params: query }
|
76
|
+
)
|
77
|
+
Web::SendRequest.new(request).perform
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -36,6 +36,55 @@ module Crowdin
|
|
36
36
|
Web::SendRequest.new(request).perform
|
37
37
|
end
|
38
38
|
|
39
|
+
# @param bundle_id [Integer] Bundle ID
|
40
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.exports.post API Documentation}
|
41
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.exports.post Enterprise API Documentation}
|
42
|
+
def export_bundle(bundle_id, project_id = config.project_id)
|
43
|
+
bundle_id || raise_parameter_is_required_error(:bundle_id)
|
44
|
+
project_id || raise_project_id_is_required_error
|
45
|
+
|
46
|
+
request = Web::Request.new(
|
47
|
+
connection,
|
48
|
+
:post,
|
49
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/exports"
|
50
|
+
)
|
51
|
+
Web::SendRequest.new(request).perform
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param bundle_id [Integer] Bundle ID
|
55
|
+
# @param export_id [String] Export ID
|
56
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.exports.get API Documentation}
|
57
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.exports.get Enterprise API Documentation}
|
58
|
+
def check_bundle_export_status(bundle_id, export_id, project_id = config.project_id)
|
59
|
+
bundle_id || raise_parameter_is_required_error(:bundle_id)
|
60
|
+
export_id || raise_parameter_is_required_error(:export_id)
|
61
|
+
project_id || raise_project_id_is_required_error
|
62
|
+
|
63
|
+
request = Web::Request.new(
|
64
|
+
connection,
|
65
|
+
:get,
|
66
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/exports/#{export_id}"
|
67
|
+
)
|
68
|
+
Web::SendRequest.new(request).perform
|
69
|
+
end
|
70
|
+
|
71
|
+
# @param bundle_id [Integer] Bundle ID
|
72
|
+
# @param export_id [String] Export ID
|
73
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.exports.download.get API Documentation}
|
74
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.exports.download.get Enterprise API Documentation}
|
75
|
+
def download_bundle(bundle_id, export_id, project_id = config.project_id)
|
76
|
+
bundle_id || raise_parameter_is_required_error(:bundle_id)
|
77
|
+
export_id || raise_parameter_is_required_error(:export_id)
|
78
|
+
project_id || raise_project_id_is_required_error
|
79
|
+
|
80
|
+
request = Web::Request.new(
|
81
|
+
connection,
|
82
|
+
:get,
|
83
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/exports/#{export_id}/download"
|
84
|
+
)
|
85
|
+
Web::SendRequest.new(request).perform
|
86
|
+
end
|
87
|
+
|
39
88
|
# @param bundle_id [Integer] Bundle ID
|
40
89
|
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.get API Documentation}
|
41
90
|
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.get Enterprise API Documentation}
|
@@ -243,6 +243,22 @@ module Crowdin
|
|
243
243
|
)
|
244
244
|
Web::SendRequest.new(request).perform
|
245
245
|
end
|
246
|
+
|
247
|
+
def search_glossaries_concordance(project_id = nil, query = {})
|
248
|
+
project_id || raise_project_id_is_required_error
|
249
|
+
|
250
|
+
%i[source_language_id target_language_id expression].each do |param|
|
251
|
+
query[param] || raise_parameter_is_required_error(param)
|
252
|
+
end
|
253
|
+
|
254
|
+
request = Web::Request.new(
|
255
|
+
connection,
|
256
|
+
:post,
|
257
|
+
"#{config.target_api_url}/projects/#{project_id}/glossaries/concordance",
|
258
|
+
{ params: query }
|
259
|
+
)
|
260
|
+
Web::SendRequest.new(request).perform
|
261
|
+
end
|
246
262
|
end
|
247
263
|
end
|
248
264
|
end
|