crowdin-api 1.4.0 → 1.6.0

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: 283ff1afb3a211be3a2c06c0417decc9b6ff3fcca1e8c61c78523708c428d286
4
- data.tar.gz: e6f02c86c39702e00eacc0908c6dec0a93783a7a4038e2eddbc634ca2d4887d3
3
+ metadata.gz: c30c686d6eb10b527235cfbb182aad55d47ad1a8a546b96a4215a60b1b2e29fd
4
+ data.tar.gz: cec244035e78c4abef7de5e44d845f4ccc306fd12a6b60e33762f26d88dca5f1
5
5
  SHA512:
6
- metadata.gz: ca47c68a8c81d3de24a5ae913155ece611ae9400fdbea47933355d6043036c269d15ab067df037afcdc4aae1fa982991f49bee4603fb5f6816a783dd6d7c30b1
7
- data.tar.gz: dcf04302fb3c882a81f630476b4e7dce4cf1e98320da04615d3d393fb4bdfadb9bc67aec732bee227321cd3af7cbc095363f0f0c22a903a5f954acb6101a243a
6
+ metadata.gz: 73df7b0e5b4a5281d9894f45ca81bf77e4afa2404ea84c6b50c5a6a97d146b629d610d9131cb0962e4f4dfeccfaafd290e2b225271e40691d18c602d53872201
7
+ data.tar.gz: 388067874b3264c10e38eef41270416637b93a1b4affad5427e05f4fe246fc3f39377e5b25fb1e1f21d641dea6a3ba6165e75f9aeca0fd621028a0db09d07177
@@ -12,12 +12,15 @@ jobs:
12
12
  packages: write
13
13
  contents: read
14
14
  steps:
15
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
16
+
16
17
  - name: Set up Ruby 2.6
17
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
18
+ uses: ruby/setup-ruby@v1
18
19
  with:
19
20
  ruby-version: 2.6
21
+
20
22
  - run: bundle install
23
+
21
24
  - name: Publish to RubyGems
22
25
  run: |
23
26
  mkdir -p $HOME/.gem
@@ -0,0 +1,33 @@
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@v3
13
+
14
+ - name: Set up Ruby 2.6
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.6
18
+
19
+ - run: bundle install
20
+
21
+ - name: Cleanup the Readme
22
+ run: |
23
+ sed -i /\<div/d README.md
24
+ sed -i /\<\\/div/d README.md
25
+
26
+ - name: Generate Docs
27
+ run: yardoc lib/crowdin-api/api_resources/*.rb
28
+
29
+ - name: Deploy 🚀
30
+ uses: JamesIves/github-pages-deploy-action@v4.4.1
31
+ with:
32
+ branch: gh-pages
33
+ 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 }}
@@ -15,17 +15,20 @@ jobs:
15
15
  ruby-version: [ '2.6', '2.7', '3.0' ]
16
16
  steps:
17
17
  - name: Checkout code
18
- uses: actions/checkout@v2
18
+ uses: actions/checkout@v3
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@v1
32
+ uses: codecov/codecov-action@v3
30
33
  with:
31
34
  token: ${{ secrets.CODECOV_TOKEN }}
data/.rubocop.yml CHANGED
@@ -3,3 +3,6 @@ inherit_from: .rubocop_todo.yml
3
3
  AllCops:
4
4
  SuggestExtensions: false
5
5
  NewCops: enable
6
+
7
+ Gemspec/DevelopmentDependencies:
8
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -104,7 +104,7 @@ Metrics/MethodLength:
104
104
  # Offense count: 8
105
105
  # Configuration parameters: CountComments, CountAsOne.
106
106
  Metrics/ModuleLength:
107
- Max: 196
107
+ Max: 256
108
108
 
109
109
  # Offense count: 2
110
110
  # Configuration parameters: Max, CountKeywordArgs.
data/CONTRIBUTING.md CHANGED
@@ -59,12 +59,15 @@ Unsure where to begin contributing to Crowdin Ruby Client? You can start by look
59
59
 
60
60
  Before sending your pull requests, make sure you followed the list below:
61
61
 
62
- - Read this guidelines.
62
+ - Read these guidelines.
63
63
  - Read [Code of Conduct](/CODE_OF_CONDUCT.md).
64
64
  - Ensure that your code adheres to standard conventions, as used in the rest of the project.
65
65
  - Ensure that there are unit tests for your code.
66
66
  - Run unit tests.
67
67
 
68
+ > **Note**
69
+ > This project uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for commit messages and PR titles.
70
+
68
71
  #### Philosophy of code contribution
69
72
 
70
73
  - 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 CHANGED
@@ -2,4 +2,7 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
+ # For Documentation
6
+ gem 'yard', '~> 0.9.28'
7
+
5
8
  gemspec
data/README.md CHANGED
@@ -1,16 +1,16 @@
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='200' height='200' align='center'/></p>](https://crowdin.com)
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
 
5
- The Crowdin Ruby client is a lightweight interface to the Crowdin API v2. It provides common services for making API requests.
5
+ The Crowdin Ruby client is a lightweight interface to the Crowdin API. It provides common services for making API requests.
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
- For more about Crowdin API v2 see the documentation:
10
- - [Crowdin](https://support.crowdin.com/api/v2/)
11
- - [Crowdin Enterprise](https://support.crowdin.com/enterprise/api/)
9
+ <div align="center">
12
10
 
13
- ## Status
11
+ [**`API Client Docs`**](http://crowdin.github.io/crowdin-api-client-ruby/) &nbsp;|&nbsp;
12
+ [**`Crowdin API`**](https://developer.crowdin.com/api/v2/) &nbsp;|&nbsp;
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,17 +21,7 @@ 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
- ## Table of Contents
25
- * [Requirements](#requirements)
26
- * [Installation](#installation)
27
- * [Quick Start](#quick-start)
28
- * [Initialization](#initialization)
29
- * [Usage](#usage)
30
- * [Fetch all records](#fetch-all-records)
31
- * [Command-Line Client](#command-line-client)
32
- * [Seeking Assistance](#seeking-assistance)
33
- * [Contributing](#contributing)
34
- * [License](#license)
24
+ </div>
35
25
 
36
26
  ## Requirements
37
27
  * Ruby >= 2.4
@@ -41,7 +31,7 @@ For more about Crowdin API v2 see the documentation:
41
31
  Add this line to your application's Gemfile:
42
32
 
43
33
  ```gemfile
44
- gem 'crowdin-api', '~> 1.4.0'
34
+ gem 'crowdin-api', '~> 1.6.0'
45
35
  ```
46
36
 
47
37
  And then execute:
@@ -56,14 +46,6 @@ Or install it yourself as:
56
46
  gem install crowdin-api
57
47
  ```
58
48
 
59
- ---
60
-
61
- :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.
62
-
63
- :exclamation: Migration from version *0.6.0* to *1.x.x* requires changes in your code.
64
-
65
- ---
66
-
67
49
  ## Quick start
68
50
 
69
51
  ### Initialization
@@ -199,11 +181,9 @@ When execute you'll have IRB console with configured *@crowdin* instance
199
181
 
200
182
  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.
201
183
 
202
- Need help working with Crowdin Ruby client or have any questions? [Contact](https://crowdin.com/contacts) Customer Success Service.
203
-
204
184
  ## Contributing
205
185
 
206
- If you want to contribute please read the [Contributing](/CONTRIBUTING.md) guidelines.
186
+ If you would like to contribute please read the [Contributing](/CONTRIBUTING.md) guidelines.
207
187
 
208
188
  ## License
209
189
 
@@ -3,6 +3,9 @@
3
3
  module Crowdin
4
4
  module ApiResources
5
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}
6
9
  def list_bundles(query = {}, project_id = config.project_id)
7
10
  project_id || raise_project_id_is_required_error
8
11
 
@@ -15,8 +18,14 @@ module Crowdin
15
18
  Web::SendRequest.new(request).perform
16
19
  end
17
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}
18
24
  def add_bundle(query = {}, project_id = config.project_id)
19
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
20
29
 
21
30
  request = Web::Request.new(
22
31
  connection,
@@ -27,6 +36,58 @@ module Crowdin
27
36
  Web::SendRequest.new(request).perform
28
37
  end
29
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
+
88
+ # @param bundle_id [Integer] Bundle ID
89
+ # * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.get API Documentation}
90
+ # * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.get Enterprise API Documentation}
30
91
  def get_bundle(bundle_id, project_id = config.project_id)
31
92
  bundle_id || raise_parameter_is_required_error(:bundle_id)
32
93
  project_id || raise_project_id_is_required_error
@@ -39,6 +100,9 @@ module Crowdin
39
100
  Web::SendRequest.new(request).perform
40
101
  end
41
102
 
103
+ # @param bundle_id [Integer] Bundle ID
104
+ # * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.delete API Documentation}
105
+ # * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.delete Enterprise API Documentation}
42
106
  def delete_bundle(bundle_id, project_id = config.project_id)
43
107
  bundle_id || raise_parameter_is_required_error(:bundle_id)
44
108
  project_id || raise_project_id_is_required_error
@@ -51,6 +115,10 @@ module Crowdin
51
115
  Web::SendRequest.new(request).perform
52
116
  end
53
117
 
118
+ # @param bundle_id [Integer] Bundle ID
119
+ # @param query [Hash] Request Body
120
+ # * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.patch API Documentation}
121
+ # * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.patch Enterprise API Documentation}
54
122
  def edit_bundle(bundle_id, query = {}, project_id = config.project_id)
55
123
  bundle_id || raise_parameter_is_required_error(:bundle_id)
56
124
  project_id || raise_project_id_is_required_error
@@ -64,6 +132,10 @@ module Crowdin
64
132
  Web::SendRequest.new(request).perform
65
133
  end
66
134
 
135
+ # @param bundle_id [Integer] Bundle ID
136
+ # @param query [Hash] Request Body
137
+ # * {https://developer.crowdin.com/api/v2/#operation/api.projects.bundles.files.getMany API Documentation}
138
+ # * {https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.bundles.files.getMany Enterprise API Documentation}
67
139
  def bundle_list_files(bundle_id, query = {}, project_id = config.project_id)
68
140
  bundle_id || raise_parameter_is_required_error(:bundle_id)
69
141
  project_id || raise_project_id_is_required_error
@@ -194,6 +194,71 @@ 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
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
197
262
  end
198
263
  end
199
264
  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)
@@ -115,6 +115,70 @@ module Crowdin
115
115
  )
116
116
  Web::SendRequest.new(request, destination).perform
117
117
  end
118
+
119
+ def list_report_settings_templates(query = {}, project_id = config.project_id)
120
+ project_id || raise_project_id_is_required_error
121
+
122
+ request = Web::Request.new(
123
+ connection,
124
+ :get,
125
+ "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates",
126
+ { params: query }
127
+ )
128
+ Web::SendRequest.new(request).perform
129
+ end
130
+
131
+ def add_report_settings_template(query = {}, project_id = config.project_id)
132
+ project_id || raise_project_id_is_required_error
133
+ %i[name currency unit mode config].each do |param|
134
+ query[param] || raise_parameter_is_required_error(param)
135
+ end
136
+
137
+ request = Web::Request.new(
138
+ connection,
139
+ :post,
140
+ "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates",
141
+ { params: query }
142
+ )
143
+ Web::SendRequest.new(request).perform
144
+ end
145
+
146
+ def get_report_settings_template(template_id = nil, project_id = config.project_id)
147
+ project_id || raise_project_id_is_required_error
148
+ template_id || raise_parameter_is_required_error(:template_id)
149
+
150
+ request = Web::Request.new(
151
+ connection,
152
+ :get,
153
+ "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates/#{template_id}"
154
+ )
155
+ Web::SendRequest.new(request).perform
156
+ end
157
+
158
+ def edit_report_settings_template(query = {}, template_id = nil, project_id = config.project_id)
159
+ project_id || raise_project_id_is_required_error
160
+ template_id || raise_parameter_is_required_error(:template_id)
161
+
162
+ request = Web::Request.new(
163
+ connection,
164
+ :patch,
165
+ "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates/#{template_id}",
166
+ { params: query }
167
+ )
168
+ Web::SendRequest.new(request).perform
169
+ end
170
+
171
+ def delete_report_settings_template(template_id = nil, project_id = config.project_id)
172
+ project_id || raise_project_id_is_required_error
173
+ template_id || raise_parameter_is_required_error(:template_id)
174
+
175
+ request = Web::Request.new(
176
+ connection,
177
+ :delete,
178
+ "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates/#{template_id}"
179
+ )
180
+ Web::SendRequest.new(request).perform
181
+ end
118
182
  end
119
183
  end
120
184
  end