crowdin-api 1.3.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/docs.yml +31 -0
- data/.rubocop_todo.yml +55 -61
- data/Gemfile +3 -0
- data/README.md +37 -6
- data/lib/crowdin-api/api_resources/bundles.rb +104 -0
- data/lib/crowdin-api/api_resources/glossaries.rb +49 -0
- data/lib/crowdin-api/api_resources/projects.rb +27 -0
- data/lib/crowdin-api/api_resources/reports.rb +64 -0
- data/lib/crowdin-api/api_resources/source_files.rb +64 -0
- data/lib/crowdin-api/api_resources/storages.rb +12 -0
- data/lib/crowdin-api/api_resources/string_translations.rb +1 -1
- data/lib/crowdin-api/client/client.rb +86 -0
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/errors.rb +1 -0
- data/lib/crowdin-api/core/fetch_all_extensions.rb +9 -0
- data/lib/crowdin-api/core/request.rb +7 -12
- data/lib/crowdin-api.rb +2 -1
- data/spec/api_resources/bundles_spec.rb +61 -0
- data/spec/api_resources/glossaries_spec.rb +43 -0
- data/spec/api_resources/reports_spec.rb +50 -0
- data/spec/api_resources/source_files_spec.rb +171 -0
- data/spec/api_resources/storages_spec.rb +28 -0
- data/spec/api_resources/string_comments_spec.rb +38 -0
- data/spec/api_resources/string_translations_spec.rb +128 -0
- data/spec/api_resources/teams_spec.rb +87 -0
- data/spec/api_resources/translation_memory_spec.rb +101 -0
- data/spec/api_resources/translation_status_spec.rb +46 -0
- data/spec/spec_helper.rb +5 -2
- data/spec/unit/client_spec.rb +6 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92b7e78f934fe0170055ff679da134b9b4444caba51677c19ba8903a1eaf55ec
|
4
|
+
data.tar.gz: 22ebff0813e0d4d1c0217a3c9163e738f3b58fa6124d09f5cfff4cf3ddb3330c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0705ea1264b498c2a8080445ab79ccc353347e65f928acd68008ea96a1a8a97c0c947b332d88fb9171ba1d02001e231498cc34102d2c8dd6967d1b858204f7a
|
7
|
+
data.tar.gz: 81c748f6b6cf1090bb218d486548634c37c2a10594d937745abdd07e2cea097a8e9dd64617a85e85c06cc35b97b7ac4a5f4ffa3bc7846970efa860ef99fe3522
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: Docs
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- '*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
docs:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- name: Set up Ruby 2.6
|
14
|
+
uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
15
|
+
with:
|
16
|
+
ruby-version: 2.6
|
17
|
+
- run: bundle install
|
18
|
+
|
19
|
+
- name: Cleanup the Readme
|
20
|
+
run: |
|
21
|
+
sed -i /\<div/d README.md
|
22
|
+
sed -i /\<\\/div/d README.md
|
23
|
+
|
24
|
+
- name: Generate Docs
|
25
|
+
run: yardoc lib/crowdin-api/api_resources/*.rb
|
26
|
+
|
27
|
+
- name: Deploy 🚀
|
28
|
+
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
29
|
+
with:
|
30
|
+
branch: gh-pages
|
31
|
+
folder: doc
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2022-
|
3
|
+
# on 2022-08-12 15:14:54 UTC using RuboCop version 1.26.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -21,16 +21,21 @@ Gemspec/RequiredRubyVersion:
|
|
21
21
|
Exclude:
|
22
22
|
- 'crowdin-api.gemspec'
|
23
23
|
|
24
|
-
# Offense count:
|
24
|
+
# Offense count: 2
|
25
25
|
# This cop supports safe auto-correction (--auto-correct).
|
26
|
-
# Configuration parameters:
|
27
|
-
|
26
|
+
# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
|
27
|
+
# SupportedStyles: case, end
|
28
|
+
Layout/CaseIndentation:
|
28
29
|
Exclude:
|
29
|
-
- 'lib/crowdin-api/
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
- 'lib/crowdin-api/client/client.rb'
|
31
|
+
|
32
|
+
# Offense count: 1
|
33
|
+
# This cop supports safe auto-correction (--auto-correct).
|
34
|
+
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
35
|
+
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
36
|
+
Layout/EndAlignment:
|
37
|
+
Exclude:
|
38
|
+
- 'lib/crowdin-api/client/client.rb'
|
34
39
|
|
35
40
|
# Offense count: 4
|
36
41
|
# This cop supports safe auto-correction (--auto-correct).
|
@@ -42,7 +47,7 @@ Layout/HashAlignment:
|
|
42
47
|
Exclude:
|
43
48
|
- 'lib/crowdin-api/client/configuration.rb'
|
44
49
|
|
45
|
-
# Offense count:
|
50
|
+
# Offense count: 14
|
46
51
|
# This cop supports safe auto-correction (--auto-correct).
|
47
52
|
# Configuration parameters: EnforcedStyle.
|
48
53
|
# SupportedStyles: normal, indented_internal_methods
|
@@ -52,7 +57,7 @@ Layout/IndentationConsistency:
|
|
52
57
|
- 'lib/crowdin-api/core/request.rb'
|
53
58
|
- 'lib/crowdin-api/core/send_request.rb'
|
54
59
|
|
55
|
-
# Offense count:
|
60
|
+
# Offense count: 14
|
56
61
|
# This cop supports safe auto-correction (--auto-correct).
|
57
62
|
# Configuration parameters: Width, IgnoredPatterns.
|
58
63
|
Layout/IndentationWidth:
|
@@ -61,59 +66,60 @@ Layout/IndentationWidth:
|
|
61
66
|
- 'lib/crowdin-api/core/request.rb'
|
62
67
|
- 'lib/crowdin-api/core/send_request.rb'
|
63
68
|
|
64
|
-
# Offense count:
|
69
|
+
# Offense count: 4
|
65
70
|
# This cop supports safe auto-correction (--auto-correct).
|
66
71
|
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
67
72
|
# SupportedStylesForExponentOperator: space, no_space
|
68
73
|
Layout/SpaceAroundOperators:
|
69
74
|
Exclude:
|
70
75
|
- 'crowdin-api.gemspec'
|
71
|
-
- 'lib/crowdin-api/api_resources/machine_translation_engines.rb'
|
72
|
-
- 'lib/crowdin-api/api_resources/reports.rb'
|
73
|
-
- 'lib/crowdin-api/api_resources/teams.rb'
|
74
|
-
- 'lib/crowdin-api/api_resources/users.rb'
|
75
|
-
- 'lib/crowdin-api/api_resources/workflows.rb'
|
76
76
|
- 'spec/api_resources/projects_spec.rb'
|
77
77
|
|
78
|
-
# Offense count:
|
79
|
-
# This cop supports safe auto-correction (--auto-correct).
|
80
|
-
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
81
|
-
Lint/UnusedMethodArgument:
|
82
|
-
Exclude:
|
83
|
-
- 'lib/crowdin-api/core/send_request.rb'
|
84
|
-
|
85
|
-
# Offense count: 2
|
78
|
+
# Offense count: 3
|
86
79
|
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
87
80
|
Metrics/AbcSize:
|
88
|
-
Max:
|
81
|
+
Max: 42
|
89
82
|
|
90
|
-
# Offense count:
|
83
|
+
# Offense count: 46
|
91
84
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
92
85
|
# IgnoredMethods: refine
|
93
86
|
Metrics/BlockLength:
|
94
87
|
Max: 171
|
95
88
|
|
96
|
-
# Offense count:
|
89
|
+
# Offense count: 1
|
90
|
+
# Configuration parameters: CountComments, CountAsOne.
|
91
|
+
Metrics/ClassLength:
|
92
|
+
Max: 101
|
93
|
+
|
94
|
+
# Offense count: 1
|
95
|
+
# Configuration parameters: IgnoredMethods.
|
96
|
+
Metrics/CyclomaticComplexity:
|
97
|
+
Max: 18
|
98
|
+
|
99
|
+
# Offense count: 6
|
97
100
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
98
101
|
Metrics/MethodLength:
|
99
|
-
Max:
|
102
|
+
Max: 41
|
100
103
|
|
101
|
-
# Offense count:
|
104
|
+
# Offense count: 8
|
102
105
|
# Configuration parameters: CountComments, CountAsOne.
|
103
106
|
Metrics/ModuleLength:
|
104
|
-
Max:
|
107
|
+
Max: 256
|
105
108
|
|
106
|
-
# Offense count:
|
107
|
-
# Configuration parameters: CountKeywordArgs.
|
109
|
+
# Offense count: 2
|
110
|
+
# Configuration parameters: Max, CountKeywordArgs.
|
108
111
|
Metrics/ParameterLists:
|
109
112
|
MaxOptionalParameters: 4
|
110
|
-
Max: 6
|
111
113
|
|
112
|
-
# Offense count:
|
114
|
+
# Offense count: 1
|
115
|
+
# Configuration parameters: IgnoredMethods.
|
116
|
+
Metrics/PerceivedComplexity:
|
117
|
+
Max: 19
|
118
|
+
|
119
|
+
# Offense count: 1
|
113
120
|
Naming/AccessorMethodName:
|
114
121
|
Exclude:
|
115
122
|
- 'lib/crowdin-api/api_resources/users.rb'
|
116
|
-
- 'lib/crowdin-api/core/send_request.rb'
|
117
123
|
|
118
124
|
# Offense count: 1
|
119
125
|
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
@@ -130,13 +136,6 @@ Naming/MemoizedInstanceVariableName:
|
|
130
136
|
Exclude:
|
131
137
|
- 'lib/crowdin-api/client/client.rb'
|
132
138
|
|
133
|
-
# Offense count: 6
|
134
|
-
# This cop supports safe auto-correction (--auto-correct).
|
135
|
-
# Configuration parameters: PreferredName.
|
136
|
-
Naming/RescuedExceptionsVariableName:
|
137
|
-
Exclude:
|
138
|
-
- 'lib/crowdin-api/core/send_request.rb'
|
139
|
-
|
140
139
|
# Offense count: 7
|
141
140
|
# This cop supports safe auto-correction (--auto-correct).
|
142
141
|
# Configuration parameters: EnforcedStyle.
|
@@ -146,14 +145,13 @@ Style/AccessorGrouping:
|
|
146
145
|
- 'lib/crowdin-api/client/configuration.rb'
|
147
146
|
- 'lib/crowdin-api/core/request.rb'
|
148
147
|
|
149
|
-
# Offense count:
|
148
|
+
# Offense count: 2
|
150
149
|
# This cop supports unsafe auto-correction (--auto-correct-all).
|
151
150
|
Style/CollectionCompact:
|
152
151
|
Exclude:
|
153
152
|
- 'lib/crowdin-api/core/request.rb'
|
154
|
-
- 'lib/crowdin-api/core/send_request.rb'
|
155
153
|
|
156
|
-
# Offense count:
|
154
|
+
# Offense count: 27
|
157
155
|
# Configuration parameters: AllowedConstants.
|
158
156
|
Style/Documentation:
|
159
157
|
Enabled: false
|
@@ -175,25 +173,21 @@ Style/FrozenStringLiteralComment:
|
|
175
173
|
- 'bin/crowdin-console'
|
176
174
|
|
177
175
|
# Offense count: 1
|
178
|
-
|
176
|
+
# Configuration parameters: MinBodyLength.
|
177
|
+
Style/GuardClause:
|
179
178
|
Exclude:
|
180
|
-
- '
|
179
|
+
- 'lib/crowdin-api/client/client.rb'
|
181
180
|
|
182
|
-
# Offense count:
|
183
|
-
|
184
|
-
# Configuration parameters: EnforcedStyle.
|
185
|
-
# SupportedStyles: implicit, explicit
|
186
|
-
Style/RescueStandardError:
|
181
|
+
# Offense count: 1
|
182
|
+
Style/MixinUsage:
|
187
183
|
Exclude:
|
188
|
-
- '
|
189
|
-
- 'lib/crowdin-api/api_resources/string_translations.rb'
|
184
|
+
- 'bin/crowdin-console'
|
190
185
|
|
191
186
|
# Offense count: 1
|
192
|
-
# This cop supports
|
193
|
-
|
194
|
-
Style/StringConcatenation:
|
187
|
+
# This cop supports safe auto-correction (--auto-correct).
|
188
|
+
Style/RedundantFreeze:
|
195
189
|
Exclude:
|
196
|
-
- 'lib/crowdin-api/
|
190
|
+
- 'lib/crowdin-api/core/fetch_all_extensions.rb'
|
197
191
|
|
198
192
|
# Offense count: 8
|
199
193
|
# This cop supports safe auto-correction (--auto-correct).
|
@@ -203,9 +197,9 @@ Style/StringLiterals:
|
|
203
197
|
Exclude:
|
204
198
|
- 'spec/api_resources/projects_spec.rb'
|
205
199
|
|
206
|
-
# Offense count:
|
200
|
+
# Offense count: 2
|
207
201
|
# This cop supports safe auto-correction (--auto-correct).
|
208
202
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
209
203
|
# URISchemes: http, https
|
210
204
|
Layout/LineLength:
|
211
|
-
Max:
|
205
|
+
Max: 122
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[<p align='center'><img src='https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png' data-canonical-src='https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png' width='
|
1
|
+
[<p align='center'><img src='https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png' data-canonical-src='https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png' width='150' height='150' align='center'/></p>](https://crowdin.com)
|
2
2
|
|
3
3
|
# Crowdin Ruby client
|
4
4
|
|
@@ -6,11 +6,11 @@ The Crowdin Ruby client is a lightweight interface to the Crowdin API v2. It pro
|
|
6
6
|
|
7
7
|
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
8
|
|
9
|
-
|
10
|
-
- [Crowdin](https://support.crowdin.com/api/v2/)
|
11
|
-
- [Crowdin Enterprise](https://support.crowdin.com/enterprise/api/)
|
9
|
+
<div align="center">
|
12
10
|
|
13
|
-
|
11
|
+
[**`API Client Docs`**](http://crowdin.github.io/crowdin-api-client-ruby/) |
|
12
|
+
[**`Crowdin API`**](https://developer.crowdin.com/api/v2/) |
|
13
|
+
[**`Crowdin Enterprise API`**](https://developer.crowdin.com/enterprise/api/v2/)
|
14
14
|
|
15
15
|
[![Gem](https://img.shields.io/gem/v/crowdin-api?logo=ruby&cacheSeconds=1800)](https://rubygems.org/gems/crowdin-api)
|
16
16
|
[![Gem](https://img.shields.io/gem/dt/crowdin-api?cacheSeconds=1800)](https://rubygems.org/gems/crowdin-api)
|
@@ -21,12 +21,15 @@ For more about Crowdin API v2 see the documentation:
|
|
21
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
22
|
[![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
23
|
|
24
|
+
</div>
|
25
|
+
|
24
26
|
## Table of Contents
|
25
27
|
* [Requirements](#requirements)
|
26
28
|
* [Installation](#installation)
|
27
29
|
* [Quick Start](#quick-start)
|
28
30
|
* [Initialization](#initialization)
|
29
31
|
* [Usage](#usage)
|
32
|
+
* [Fetch all records](#fetch-all-records)
|
30
33
|
* [Command-Line Client](#command-line-client)
|
31
34
|
* [Seeking Assistance](#seeking-assistance)
|
32
35
|
* [Contributing](#contributing)
|
@@ -40,7 +43,7 @@ For more about Crowdin API v2 see the documentation:
|
|
40
43
|
Add this line to your application's Gemfile:
|
41
44
|
|
42
45
|
```gemfile
|
43
|
-
gem 'crowdin-api', '~> 1.
|
46
|
+
gem 'crowdin-api', '~> 1.5.0'
|
44
47
|
```
|
45
48
|
|
46
49
|
And then execute:
|
@@ -66,6 +69,7 @@ gem install crowdin-api
|
|
66
69
|
## Quick start
|
67
70
|
|
68
71
|
### Initialization
|
72
|
+
|
69
73
|
```ruby
|
70
74
|
require 'crowdin-api'
|
71
75
|
|
@@ -145,6 +149,33 @@ file_revisions = crowdin.list_file_revisions(your_file_id, { limit: 10 }, your_p
|
|
145
149
|
# Note: more examples you can find in spec folder
|
146
150
|
```
|
147
151
|
|
152
|
+
### Fetch all records
|
153
|
+
|
154
|
+
There is a possibility to fetch all records from paginatable methods using `fetch_all` method.
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
# FetchAll options:
|
158
|
+
# * limit, Integer, default: 500 | How many records need to load per one request
|
159
|
+
# * offset, Integer, default: 0
|
160
|
+
# * request_delay, Integer (seconds), default: 0 | Delay between requests. To specify a delay in milliseconds use float values like 0.100
|
161
|
+
|
162
|
+
# Examples:
|
163
|
+
|
164
|
+
@crowdin.fetch_all(:list_projects)
|
165
|
+
|
166
|
+
# with options
|
167
|
+
@crowdin.fetch_all(:list_projects, { limit: 10, request_delay: 1 })
|
168
|
+
|
169
|
+
# playing with response per fetch
|
170
|
+
# Note: the block actually don't make any effect to finite result
|
171
|
+
@crowdin.fetch_all(:list_projects, { limit: 10, request_delay: 1 }) { |response| puts response['data'] }
|
172
|
+
|
173
|
+
# also, you could specify a retry configuration to handle some exceptions
|
174
|
+
# fetch all execution will be terminated if response status code is the same as one of the error_messages array value
|
175
|
+
# otherwise, the request will be retried so many times, as indicated at retries_count
|
176
|
+
@crowdin.fetch_all(:list_projects, {}, { request_delay: 2, retries_count: 3, error_messages: ['401'] })
|
177
|
+
```
|
178
|
+
|
148
179
|
### Command-Line Client
|
149
180
|
|
150
181
|
The Crowdin Ruby client support crowdin-console, where you can test endpoints easier
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crowdin
|
4
|
+
module ApiResources
|
5
|
+
module Bundles
|
6
|
+
# @param query [Hash] Request Body
|
7
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.getMany API Documentation}
|
8
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.getMany Enterprise API Documentation}
|
9
|
+
def list_bundles(query = {}, project_id = config.project_id)
|
10
|
+
project_id || raise_project_id_is_required_error
|
11
|
+
|
12
|
+
request = Web::Request.new(
|
13
|
+
connection,
|
14
|
+
:get,
|
15
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles",
|
16
|
+
{ params: query }
|
17
|
+
)
|
18
|
+
Web::SendRequest.new(request).perform
|
19
|
+
end
|
20
|
+
|
21
|
+
# @param query [Hash] Request Body
|
22
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.post API Documentation}
|
23
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.post Enterprise API Documentation}
|
24
|
+
def add_bundle(query = {}, project_id = config.project_id)
|
25
|
+
project_id || raise_project_id_is_required_error
|
26
|
+
%i[name format sourcePatterns exportPattern].each do |param|
|
27
|
+
query[param] || raise_parameter_is_required_error(param)
|
28
|
+
end
|
29
|
+
|
30
|
+
request = Web::Request.new(
|
31
|
+
connection,
|
32
|
+
:post,
|
33
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles",
|
34
|
+
{ params: query }
|
35
|
+
)
|
36
|
+
Web::SendRequest.new(request).perform
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param bundle_id [Integer] Bundle ID
|
40
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.get API Documentation}
|
41
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.get Enterprise API Documentation}
|
42
|
+
def get_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
|
+
:get,
|
49
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}"
|
50
|
+
)
|
51
|
+
Web::SendRequest.new(request).perform
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param bundle_id [Integer] Bundle ID
|
55
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.delete API Documentation}
|
56
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.delete Enterprise API Documentation}
|
57
|
+
def delete_bundle(bundle_id, project_id = config.project_id)
|
58
|
+
bundle_id || raise_parameter_is_required_error(:bundle_id)
|
59
|
+
project_id || raise_project_id_is_required_error
|
60
|
+
|
61
|
+
request = Web::Request.new(
|
62
|
+
connection,
|
63
|
+
:delete,
|
64
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}"
|
65
|
+
)
|
66
|
+
Web::SendRequest.new(request).perform
|
67
|
+
end
|
68
|
+
|
69
|
+
# @param bundle_id [Integer] Bundle ID
|
70
|
+
# @param query [Hash] Request Body
|
71
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.patch API Documentation}
|
72
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.patch Enterprise API Documentation}
|
73
|
+
def edit_bundle(bundle_id, query = {}, project_id = config.project_id)
|
74
|
+
bundle_id || raise_parameter_is_required_error(:bundle_id)
|
75
|
+
project_id || raise_project_id_is_required_error
|
76
|
+
|
77
|
+
request = Web::Request.new(
|
78
|
+
connection,
|
79
|
+
:patch,
|
80
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}",
|
81
|
+
{ params: query }
|
82
|
+
)
|
83
|
+
Web::SendRequest.new(request).perform
|
84
|
+
end
|
85
|
+
|
86
|
+
# @param bundle_id [Integer] Bundle ID
|
87
|
+
# @param query [Hash] Request Body
|
88
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.files.getMany API Documentation}
|
89
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.files.getMany Enterprise API Documentation}
|
90
|
+
def bundle_list_files(bundle_id, query = {}, project_id = config.project_id)
|
91
|
+
bundle_id || raise_parameter_is_required_error(:bundle_id)
|
92
|
+
project_id || raise_project_id_is_required_error
|
93
|
+
|
94
|
+
request = Web::Request.new(
|
95
|
+
connection,
|
96
|
+
:get,
|
97
|
+
"#{config.target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/files",
|
98
|
+
{ params: query }
|
99
|
+
)
|
100
|
+
Web::SendRequest.new(request).perform
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -194,6 +194,55 @@ module Crowdin
|
|
194
194
|
)
|
195
195
|
Web::SendRequest.new(request).perform
|
196
196
|
end
|
197
|
+
|
198
|
+
def list_concepts(glossary_id = nil, query = {})
|
199
|
+
glossary_id || raise_parameter_is_required_error(:glossary_id)
|
200
|
+
|
201
|
+
request = Web::Request.new(
|
202
|
+
connection,
|
203
|
+
:get,
|
204
|
+
"#{config.target_api_url}/glossaries/#{glossary_id}/concepts",
|
205
|
+
{ params: query }
|
206
|
+
)
|
207
|
+
Web::SendRequest.new(request).perform
|
208
|
+
end
|
209
|
+
|
210
|
+
def get_concept(glossary_id = nil, concept_id = nil)
|
211
|
+
glossary_id || raise_parameter_is_required_error(:glossary_id)
|
212
|
+
concept_id || raise_parameter_is_required_error(:concept_id)
|
213
|
+
|
214
|
+
request = Web::Request.new(
|
215
|
+
connection,
|
216
|
+
:get,
|
217
|
+
"#{config.target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}"
|
218
|
+
)
|
219
|
+
Web::SendRequest.new(request).perform
|
220
|
+
end
|
221
|
+
|
222
|
+
def update_concept(glossary_id = nil, concept_id = nil, query = {})
|
223
|
+
glossary_id || raise_parameter_is_required_error(:glossary_id)
|
224
|
+
concept_id || raise_parameter_is_required_error(:concept_id)
|
225
|
+
|
226
|
+
request = Web::Request.new(
|
227
|
+
connection,
|
228
|
+
:put,
|
229
|
+
"#{config.target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}",
|
230
|
+
{ params: query }
|
231
|
+
)
|
232
|
+
Web::SendRequest.new(request).perform
|
233
|
+
end
|
234
|
+
|
235
|
+
def delete_concept(glossary_id = nil, concept_id = nil)
|
236
|
+
glossary_id || raise_parameter_is_required_error(:glossary_id)
|
237
|
+
concept_id || raise_parameter_is_required_error(:concept_id)
|
238
|
+
|
239
|
+
request = Web::Request.new(
|
240
|
+
connection,
|
241
|
+
:delete,
|
242
|
+
"#{config.target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}"
|
243
|
+
)
|
244
|
+
Web::SendRequest.new(request).perform
|
245
|
+
end
|
197
246
|
end
|
198
247
|
end
|
199
248
|
end
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module Crowdin
|
4
4
|
module ApiResources
|
5
5
|
module Projects
|
6
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.getMany API Documentation}
|
7
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.getMany Enterprise API Documentation}
|
8
|
+
# @param query [Hash] Request Body
|
6
9
|
def list_projects(query = {})
|
7
10
|
request = Web::Request.new(
|
8
11
|
connection,
|
@@ -13,6 +16,9 @@ module Crowdin
|
|
13
16
|
Web::SendRequest.new(request).perform
|
14
17
|
end
|
15
18
|
|
19
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.post API Documentation}
|
20
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.post Enterprise API Documentation}
|
21
|
+
# @param query [Hash] Request Body
|
16
22
|
def add_project(query = {})
|
17
23
|
request = Web::Request.new(
|
18
24
|
connection,
|
@@ -23,6 +29,9 @@ module Crowdin
|
|
23
29
|
Web::SendRequest.new(request).perform
|
24
30
|
end
|
25
31
|
|
32
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.get API Documentation}
|
33
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.get Enterprise API Documentation}
|
34
|
+
# @param project_id [Integer] Project ID
|
26
35
|
def get_project(project_id = nil)
|
27
36
|
project_id || raise_parameter_is_required_error(:project_id)
|
28
37
|
|
@@ -34,6 +43,9 @@ module Crowdin
|
|
34
43
|
Web::SendRequest.new(request).perform
|
35
44
|
end
|
36
45
|
|
46
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.delete API Documentation}
|
47
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.delete Enterprise API Documentation}
|
48
|
+
# @param project_id [Integer] Project ID
|
37
49
|
def delete_project(project_id = nil)
|
38
50
|
project_id || raise_parameter_is_required_error(:project_id)
|
39
51
|
|
@@ -45,6 +57,10 @@ module Crowdin
|
|
45
57
|
Web::SendRequest.new(request).perform
|
46
58
|
end
|
47
59
|
|
60
|
+
# @param project_id [Integer] Project ID
|
61
|
+
# @param query [Hash] Request Body
|
62
|
+
# * {https://developer.crowdin.com/api/v2/#operation/api.projects.patch API Documentation}
|
63
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.patch Enterprise API Documentation}
|
48
64
|
def edit_project(project_id = nil, query = {})
|
49
65
|
project_id || raise_parameter_is_required_error(:project_id)
|
50
66
|
|
@@ -59,6 +75,8 @@ module Crowdin
|
|
59
75
|
|
60
76
|
# -- For Enterprise mode only --
|
61
77
|
|
78
|
+
# @param query [Hash] Request Body
|
79
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.getMany Enterprise API Documentation}
|
62
80
|
def list_groups(query = {})
|
63
81
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
64
82
|
|
@@ -71,6 +89,8 @@ module Crowdin
|
|
71
89
|
Web::SendRequest.new(request).perform
|
72
90
|
end
|
73
91
|
|
92
|
+
# @param query [Hash] Request Body
|
93
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.post Enterprise API Documentation}
|
74
94
|
def add_group(query = {})
|
75
95
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
76
96
|
|
@@ -83,6 +103,8 @@ module Crowdin
|
|
83
103
|
Web::SendRequest.new(request).perform
|
84
104
|
end
|
85
105
|
|
106
|
+
# @param group_id [Integer] Group ID
|
107
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.get Enterprise API Documentation}
|
86
108
|
def get_group(group_id = nil)
|
87
109
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
88
110
|
group_id || raise_parameter_is_required_error(:group_id)
|
@@ -95,6 +117,8 @@ module Crowdin
|
|
95
117
|
Web::SendRequest.new(request).perform
|
96
118
|
end
|
97
119
|
|
120
|
+
# @param group_id [Integer] Group ID
|
121
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.delete Enterprise API Documentation}
|
98
122
|
def delete_group(group_id = nil)
|
99
123
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
100
124
|
group_id || raise_parameter_is_required_error(:group_id)
|
@@ -107,6 +131,9 @@ module Crowdin
|
|
107
131
|
Web::SendRequest.new(request).perform
|
108
132
|
end
|
109
133
|
|
134
|
+
# @param group_id [Integer] Group ID
|
135
|
+
# @param query [Hash] Request Body
|
136
|
+
# * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.patch Enterprise API Documentation}
|
110
137
|
def edit_group(group_id = nil, query = {})
|
111
138
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
112
139
|
group_id || raise_parameter_is_required_error(:group_id)
|