crowdin-api 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test-and-lint.yml +1 -1
  3. data/.gitignore +2 -2
  4. data/.rubocop_todo.yml +37 -30
  5. data/README.md +23 -12
  6. data/bin/crowdin-console +4 -4
  7. data/lib/crowdin-api/api-resources/dictionaries.rb +34 -0
  8. data/lib/crowdin-api/api-resources/distributions.rb +99 -0
  9. data/lib/crowdin-api/api-resources/glossaries.rb +217 -0
  10. data/lib/crowdin-api/api-resources/labels.rb +117 -0
  11. data/lib/crowdin-api/api-resources/languages.rb +1 -0
  12. data/lib/crowdin-api/api-resources/machine_translation_engines.rb +74 -0
  13. data/lib/crowdin-api/api-resources/projects.rb +15 -1
  14. data/lib/crowdin-api/api-resources/reports.rb +138 -0
  15. data/lib/crowdin-api/api-resources/screenshots.rb +186 -0
  16. data/lib/crowdin-api/api-resources/source_files.rb +2 -1
  17. data/lib/crowdin-api/api-resources/storages.rb +5 -1
  18. data/lib/crowdin-api/api-resources/string_comments.rb +73 -0
  19. data/lib/crowdin-api/api-resources/string_translations.rb +220 -0
  20. data/lib/crowdin-api/api-resources/tasks.rb +113 -0
  21. data/lib/crowdin-api/api-resources/teams.rb +144 -0
  22. data/lib/crowdin-api/api-resources/translation_memory.rb +145 -0
  23. data/lib/crowdin-api/api-resources/translations.rb +0 -1
  24. data/lib/crowdin-api/api-resources/users.rb +129 -0
  25. data/lib/crowdin-api/api-resources/vendors.rb +21 -0
  26. data/lib/crowdin-api/api-resources/webhooks.rb +73 -0
  27. data/lib/crowdin-api/api-resources/workflows.rb +3 -0
  28. data/lib/crowdin-api/client/client.rb +41 -28
  29. data/lib/crowdin-api/client/configuration.rb +10 -6
  30. data/lib/crowdin-api/client/version.rb +1 -1
  31. data/lib/crowdin-api/core/errors.rb +2 -1
  32. data/lib/crowdin-api/core/{api_errors_raiser.rb → errors_raisers.rb} +21 -11
  33. data/lib/crowdin-api/core/request.rb +3 -3
  34. data/lib/crowdin-api/core/utils.rb +10 -0
  35. data/lib/crowdin-api.rb +22 -6
  36. data/spec/client/client-instance_spec.rb +14 -0
  37. data/spec/{core/config-instance_spec.rb → client/configuration-instance_spec.rb} +7 -7
  38. metadata +21 -5
  39. data/spec/crowdin-api_spec.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ec79bf0a2483fca9502087888c52323ebe12c0c755897f0c71759722f74fd89
4
- data.tar.gz: b38ea8b69348734224f7631403f2ac0c6b33496c9098556688c4e648c85cbb6c
3
+ metadata.gz: bec711e702205bef5cf0bd74dc1a99c6f770225ee0fb37afa702cc8fb3712cab
4
+ data.tar.gz: '09425dd51fe242b61eb7a3fe12331f5a6827504d5cd5b5157ff6824c56069a39'
5
5
  SHA512:
6
- metadata.gz: aea9c98831b8abfacb4fe670d4d9025cee21cf33334083645ad9f4767f5d375249a9d2fde8ab7739fec3ca61f1ade03496f23b12377414ce18f62eea2819f453
7
- data.tar.gz: 5e69bf63d256bb96faaa11d749635253ad4625b6741d3d312cd7b61af127bd09d494ee87350b7b589e9c8c78de807bccba25286480627aa0e80153554e81fd1f
6
+ metadata.gz: 8e7b0806bbc5a1caf4c963df4f7120cdff2dfd4f0df068f7a308ade71c6b45c9373f157338065e9a116a0dc081ceeea07a593d8933701f2c2d43a5640810a901
7
+ data.tar.gz: f5d06bfce2e0257c4249a856923eb3ea8afd1f424efe26ee212193c647cbc2cb3ad4caa42bed305e9874198e433b4ac8b50e87d5dcfb244d3689febef5a67d41
@@ -12,7 +12,7 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  strategy:
14
14
  matrix:
15
- ruby-version: ['2.6', '2.7', '3.0']
15
+ ruby-version: [ '2.6', '2.7', '3.0' ]
16
16
  steps:
17
17
  - name: Checkout code
18
18
  uses: actions/checkout@v2
data/.gitignore CHANGED
@@ -1,12 +1,12 @@
1
1
  # Ignore Ruby logs
2
- .ruby-version
3
2
  .idea
4
3
 
5
4
  # Ignore MacOS logs
6
5
  .DS_Store
7
6
 
8
- # Ignore versioning file
7
+ # Ignore versioning files
9
8
  Gemfile.lock
9
+ .ruby-version
10
10
 
11
11
  # Ignore tests coverage folder
12
12
  coverage
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-12-13 20:26:23 UTC using RuboCop version 1.23.0.
3
+ # on 2022-02-14 06:05:44 UTC using RuboCop version 1.23.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,12 +21,15 @@ Gemspec/RequiredRubyVersion:
21
21
  Exclude:
22
22
  - 'crowdin-api.gemspec'
23
23
 
24
- # Offense count: 2
24
+ # Offense count: 4
25
25
  # Cop supports --auto-correct.
26
- # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
27
- Layout/ExtraSpacing:
26
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
27
+ # SupportedHashRocketStyles: key, separator, table
28
+ # SupportedColonStyles: key, separator, table
29
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
30
+ Layout/HashAlignment:
28
31
  Exclude:
29
- - 'bin/crowdin-console'
32
+ - 'lib/crowdin-api/client/configuration.rb'
30
33
 
31
34
  # Offense count: 1
32
35
  # Cop supports --auto-correct.
@@ -47,24 +50,26 @@ Metrics/AbcSize:
47
50
  Metrics/BlockLength:
48
51
  Max: 54
49
52
 
50
- # Offense count: 4
53
+ # Offense count: 12
51
54
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
52
55
  Metrics/MethodLength:
53
56
  Max: 18
54
57
 
55
- # Offense count: 2
58
+ # Offense count: 8
56
59
  # Configuration parameters: CountComments, CountAsOne.
57
60
  Metrics/ModuleLength:
58
- Max: 205
61
+ Max: 199
59
62
 
60
- # Offense count: 1
61
- # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
63
+ # Offense count: 2
64
+ # Configuration parameters: CountKeywordArgs.
62
65
  Metrics/ParameterLists:
66
+ MaxOptionalParameters: 4
63
67
  Max: 6
64
68
 
65
- # Offense count: 1
69
+ # Offense count: 2
66
70
  Naming/AccessorMethodName:
67
71
  Exclude:
72
+ - 'lib/crowdin-api/api-resources/users.rb'
68
73
  - 'lib/crowdin-api/core/request.rb'
69
74
 
70
75
  # Offense count: 3
@@ -74,8 +79,8 @@ Naming/AccessorMethodName:
74
79
  Naming/FileName:
75
80
  Exclude:
76
81
  - 'lib/crowdin-api.rb'
77
- - 'spec/core/config-instance_spec.rb'
78
- - 'spec/crowdin-api_spec.rb'
82
+ - 'spec/client/client-instance_spec.rb'
83
+ - 'spec/client/configuration-instance_spec.rb'
79
84
 
80
85
  # Offense count: 3
81
86
  # Configuration parameters: EnforcedStyleForLeadingUnderscores.
@@ -91,7 +96,7 @@ Naming/RescuedExceptionsVariableName:
91
96
  Exclude:
92
97
  - 'lib/crowdin-api/core/request.rb'
93
98
 
94
- # Offense count: 7
99
+ # Offense count: 8
95
100
  # Cop supports --auto-correct.
96
101
  # Configuration parameters: EnforcedStyle.
97
102
  # SupportedStyles: separated, grouped
@@ -106,24 +111,10 @@ Style/CollectionCompact:
106
111
  Exclude:
107
112
  - 'lib/crowdin-api/core/request.rb'
108
113
 
109
- # Offense count: 12
114
+ # Offense count: 22
110
115
  # Configuration parameters: AllowedConstants.
111
116
  Style/Documentation:
112
- Exclude:
113
- - 'spec/**/*'
114
- - 'test/**/*'
115
- - 'lib/crowdin-api/api-resources/languages.rb'
116
- - 'lib/crowdin-api/api-resources/projects.rb'
117
- - 'lib/crowdin-api/api-resources/source_files.rb'
118
- - 'lib/crowdin-api/api-resources/source_strings.rb'
119
- - 'lib/crowdin-api/api-resources/storages.rb'
120
- - 'lib/crowdin-api/api-resources/translation_status.rb'
121
- - 'lib/crowdin-api/api-resources/translations.rb'
122
- - 'lib/crowdin-api/api-resources/workflows.rb'
123
- - 'lib/crowdin-api/client/client.rb'
124
- - 'lib/crowdin-api/client/configuration.rb'
125
- - 'lib/crowdin-api/core/api_errors_raiser.rb'
126
- - 'lib/crowdin-api/core/request.rb'
117
+ Enabled: false
127
118
 
128
119
  # Offense count: 1
129
120
  # Cop supports --auto-correct.
@@ -137,3 +128,19 @@ Style/FrozenStringLiteralComment:
137
128
  Style/MixinUsage:
138
129
  Exclude:
139
130
  - 'bin/crowdin-console'
131
+
132
+ # Offense count: 2
133
+ # Cop supports --auto-correct.
134
+ # Configuration parameters: EnforcedStyle.
135
+ # SupportedStyles: implicit, explicit
136
+ Style/RescueStandardError:
137
+ Exclude:
138
+ - 'lib/crowdin-api/api-resources/labels.rb'
139
+ - 'lib/crowdin-api/api-resources/string_translations.rb'
140
+
141
+ # Offense count: 1
142
+ # Cop supports --auto-correct.
143
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
144
+ # URISchemes: http, https
145
+ Layout/LineLength:
146
+ Max: 122
data/README.md CHANGED
@@ -10,7 +10,7 @@ For more about Crowdin API v2 see the documentation:
10
10
  - [Crowdin](https://support.crowdin.com/api/v2/)
11
11
  - [Crowdin Enterprise](https://support.crowdin.com/enterprise/api/)
12
12
 
13
- ### Status
13
+ ## Status
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)
@@ -22,21 +22,25 @@ For more about Crowdin API v2 see the documentation:
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
24
  ## Table of Contents
25
+ * [Requirements](#requirements)
25
26
  * [Installation](#installation)
26
27
  * [Quick Start](#quick-start)
27
28
  * [Initialization](#initialization)
28
- * [How to call methods](#how-to-call-methods)
29
+ * [Usage](#usage)
29
30
  * [Command-Line Client](#command-line-client)
30
31
  * [Seeking Assistance](#seeking-assistance)
31
32
  * [Contributing](#contributing)
32
33
  * [License](#license)
33
34
 
35
+ ## Requirements
36
+ * Ruby >= 2.4
37
+
34
38
  ## Installation
35
39
 
36
40
  Add this line to your application's Gemfile:
37
41
 
38
42
  ```gemfile
39
- gem 'crowdin-api', '~> 1.1.0'
43
+ gem 'crowdin-api', '~> 1.2.0'
40
44
  ```
41
45
 
42
46
  And then execute:
@@ -70,12 +74,13 @@ crowdin = Crowdin::Client.new do |config|
70
74
  config.api_token = 'YourApiToken'
71
75
  end
72
76
 
73
- # Or you can intialize Enterprise Client instance by specifying your organization_domain in config options
77
+ # Or you can intialize Enterprise Client instance by specifying your
78
+ # organization_domain in config options
74
79
  crowdin = Crowdin::Client.new do |config|
75
80
  config.api_token = 'YourEnterpriseApiToken'
76
81
  config.organization_domain = 'YourOrganizationDomain'
77
82
  end
78
- # Note: we use full specified organization domain if that includes .com
83
+ # Note: we use full specified organization domain if that includes '.com'
79
84
  # config.organization_domain = your_domain -> https://your_domain.api.crowdin.com
80
85
  # config.organization_domain = your_domain.com -> your_domain.com
81
86
 
@@ -86,8 +91,8 @@ crowdin = Crowdin::Client.new do |config|
86
91
  config.project_id = 'YourProjectId' # [Integer] nil by default
87
92
  config.enable_logger = true # [Boolean] false by default
88
93
  end
89
- # Note: Client will initialize default Logger instance if you have specify enable_logger to true,
90
- # you can change it by crowdin.logger = YourLogger
94
+ # Note: Client will initialize default Logger instance if you have specify
95
+ # enable_logger to true, you can change it by crowdin.logger = YourLogger
91
96
 
92
97
  # Also you can specify proxy by adding it to ENV['http_proxy'] before Client initialization
93
98
  ```
@@ -115,14 +120,20 @@ projects = crowdin.list_projects(offset: 10, limit: 20)
115
120
  # Get specified project
116
121
  project = crowdin.get_project(your_project_id)
117
122
 
123
+ # Edit project
124
+ project = crowdin.edit_project(project_id, [{op: 'replace',
125
+ path: '/name',
126
+ value: 'your_new_project_name'}])
127
+
118
128
  # Add Storage
119
129
  storage = crowdin.add_storage(File.open('YourFilename.extension', 'r'))
120
- # or you can specify only filename
130
+ # or you can specify only absolute path to file
121
131
  storage = crowdin.add_storage('YourFilename.extension')
122
132
 
123
133
  # Download file
124
- filename = crowdin.download_file(your_file_id, your_destination, your_project_id)
125
- # your_destination - filename or full path to file, default - saving to currect directory with default filename
134
+ file = crowdin.download_file(your_file_id, your_destination, your_project_id)
135
+ # your_destination - filename or absolute path to file, optional
136
+ # Without destination option file will be saved to the current directory with a default filename
126
137
  # project_id is optional, as it can be initialized with a Crowdin Client
127
138
 
128
139
  # File revisions
@@ -143,9 +154,9 @@ $ bundle exec crowdin-console --enable-logger --api-token API_TOKEN --project-id
143
154
  Or Crowdin Enterprise
144
155
 
145
156
  ```console
146
- $ bundle exec crowdin-console --enable-logger --enterprise --api-token API_TOKEN --organization-domain YOUR_DOMAIN --project-id PROJECT_ID
157
+ $ bundle exec crowdin-console --enable-logger --enterprise --api-token API_TOKEN --organization-domain DOMAIN --project-id PROJECT_ID
147
158
  ```
148
- Note: you can specify full organization domain by adding .com
159
+ Note: you can specify full organization domain by adding '.com'
149
160
 
150
161
  When execute you'll have IRB console with configured *@crowdin* instance
151
162
 
data/bin/crowdin-console CHANGED
@@ -17,7 +17,7 @@ require 'optparse'
17
17
  # bundle exec crowdin-console --enterprise --api-token YOUR_ENTERPRISE_API_TOKEN --organization-domain YOUR_DOMAIN
18
18
  #
19
19
 
20
- include Crowdin::Errors::ApiErrorsRaiser
20
+ include Crowdin::Errors::ClcErrorsRaiser
21
21
 
22
22
  options = {}
23
23
 
@@ -27,7 +27,7 @@ OptionParser.new do |opts|
27
27
  opts.on('--enterprise', 'Enterprise API') { |v| options[:enterprise] = v }
28
28
  opts.on('--api-token TOKEN', 'API Token') { |v| options[:api_token] = v }
29
29
  opts.on('--organization-domain DOMAIN', 'Organization Domain') { |v| options[:organization_domain] = v }
30
- opts.on('--project-id ID', 'Project ID') { |v| options[:project_id] = v }
30
+ opts.on('--project-id ID', 'Project ID') { |v| options[:project_id] = v }
31
31
  opts.on('--enable-logger', 'Enable logger') { |v| options[:enable_logger] = v }
32
32
  end.parse!
33
33
 
@@ -39,8 +39,8 @@ if options[:enterprise]
39
39
  @crowdin = Crowdin::Client.new do |config|
40
40
  config.api_token = options[:api_token]
41
41
  config.organization_domain = options[:organization_domain]
42
- config.enable_logger = options[:enable_logger] || false
43
- config.project_id = options[:project_id] || nil
42
+ config.enable_logger = options[:enable_logger] || false
43
+ config.project_id = options[:project_id] || nil
44
44
  end
45
45
  else
46
46
  @crowdin = Crowdin::Client.new do |config|
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module Dictionaries
6
+ def list_dictionaries(query = {}, project_id = config.project_id)
7
+ project_id || raise_project_id_is_required_error
8
+
9
+ request = Web::Request.new(
10
+ self,
11
+ :get,
12
+ "/projects/#{project_id}/dictionaries",
13
+ query
14
+ )
15
+
16
+ request.perform
17
+ end
18
+
19
+ def edit_dictionary(language_id = nil, query = {}, project_id = config.project_id)
20
+ language_id || raise_parameter_is_required_error(:language_id)
21
+ project_id || raise_project_id_is_required_error
22
+
23
+ request = Web::Request.new(
24
+ self,
25
+ :patch,
26
+ "/projects/#{project_id}/dictionaries/#{language_id}",
27
+ query
28
+ )
29
+
30
+ request.perform
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module Distributions
6
+ def list_distributions(query = {}, project_id = config.project_id)
7
+ project_id || raise_project_id_is_required_error
8
+
9
+ request = Web::Request.new(
10
+ self,
11
+ :get,
12
+ "/projects/#{project_id}/distributions",
13
+ query
14
+ )
15
+
16
+ request.perform
17
+ end
18
+
19
+ def add_distribution(query = {}, project_id = config.project_id)
20
+ project_id || raise_project_id_is_required_error
21
+
22
+ request = Web::Request.new(
23
+ self,
24
+ :post,
25
+ "/projects/#{project_id}/distributions",
26
+ query
27
+ )
28
+
29
+ request.perform
30
+ end
31
+
32
+ def get_distribution(hash = nil, project_id = config.project_id)
33
+ hash || raise_parameter_is_required_error(:hash)
34
+ project_id || raise_project_id_is_required_error
35
+
36
+ request = Web::Request.new(
37
+ self,
38
+ :get,
39
+ "/projects/#{project_id}/distributions/#{hash}"
40
+ )
41
+
42
+ request.perform
43
+ end
44
+
45
+ def delete_distribution(hash = nil, project_id = config.project_id)
46
+ hash || raise_parameter_is_required_error(:hash)
47
+ project_id || raise_project_id_is_required_error
48
+
49
+ request = Web::Request.new(
50
+ self,
51
+ :delete,
52
+ "/projects/#{project_id}/distributions/#{hash}"
53
+ )
54
+
55
+ request.perform
56
+ end
57
+
58
+ def edit_distribution(hash = nil, query = {}, project_id = config.project_id)
59
+ hash || raise_parameter_is_required_error(:hash)
60
+ project_id || raise_project_id_is_required_error
61
+
62
+ request = Web::Request.new(
63
+ self,
64
+ :patch,
65
+ "/projects/#{project_id}/distributions/#{hash}",
66
+ query
67
+ )
68
+
69
+ request.perform
70
+ end
71
+
72
+ def get_destribution_release(hash = nil, project_id = config.project_id)
73
+ hash || raise_parameter_is_required_error(:hash)
74
+ project_id || raise_project_id_is_required_error
75
+
76
+ request = Web::Request.new(
77
+ self,
78
+ :get,
79
+ "/projects/#{project_id}/distributions/#{hash}/release"
80
+ )
81
+
82
+ request.perform
83
+ end
84
+
85
+ def release_distribution(hash = nil, project_id = config.project_id)
86
+ hash || raise_parameter_is_required_error(:hash)
87
+ project_id || raise_project_id_is_required_error
88
+
89
+ request = Web::Request.new(
90
+ self,
91
+ :post,
92
+ "/projects/#{project_id}/distributions/#{hash}/release"
93
+ )
94
+
95
+ request.perform
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,217 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module Glossaries
6
+ def list_glossaries(query = {})
7
+ request = Web::Request.new(
8
+ self,
9
+ :get,
10
+ '/glossaries',
11
+ query
12
+ )
13
+
14
+ request.perform
15
+ end
16
+
17
+ def add_glossary(query = {})
18
+ request = Web::Request.new(
19
+ self,
20
+ :post,
21
+ '/glossaries',
22
+ query
23
+ )
24
+
25
+ request.perform
26
+ end
27
+
28
+ def get_glossary(glossary_id = nil, query = {})
29
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
30
+
31
+ request = Web::Request.new(
32
+ self,
33
+ :get,
34
+ "/glossaries/#{glossary_id}",
35
+ query
36
+ )
37
+
38
+ request.perform
39
+ end
40
+
41
+ def delete_glossary(glossary_id = nil, query = {})
42
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
43
+
44
+ request = Web::Request.new(
45
+ self,
46
+ :delete,
47
+ "/glossaries/#{glossary_id}",
48
+ query
49
+ )
50
+
51
+ request.perform
52
+ end
53
+
54
+ def edit_glossary(glossary_id = nil, query = {})
55
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
56
+
57
+ request = Web::Request.new(
58
+ self,
59
+ :patch,
60
+ "/glossaries/#{glossary_id}",
61
+ query
62
+ )
63
+
64
+ request.perform
65
+ end
66
+
67
+ def export_glossary(query = {}, glossary_id = nil, destination = nil)
68
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
69
+
70
+ request = Web::Request.new(
71
+ self,
72
+ :post,
73
+ "/glossaries/#{glossary_id}/exports",
74
+ query,
75
+ {},
76
+ destination
77
+ )
78
+
79
+ request.perform
80
+ end
81
+
82
+ def check_glossary_export_status(glossary_id = nil, export_id = nil)
83
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
84
+ export_id || raise_parameter_is_required_error(:export_id)
85
+
86
+ request = Web::Request.new(
87
+ self,
88
+ :get,
89
+ "/glossaries/#{glossary_id}/exports/#{export_id}"
90
+ )
91
+
92
+ request.perform
93
+ end
94
+
95
+ def download_glossary(glossary_id = nil, export_id = nil, destination = nil)
96
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
97
+ export_id || raise_parameter_is_required_error(:export_id)
98
+
99
+ request = Web::Request.new(
100
+ self,
101
+ :get,
102
+ "/glossaries/#{glossary_id}/exports/#{export_id}/download",
103
+ {},
104
+ {},
105
+ destination
106
+ )
107
+
108
+ request.perform
109
+ end
110
+
111
+ def import_glossary(glossary_id = nil, query = {})
112
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
113
+
114
+ request = Web::Request.new(
115
+ self,
116
+ :post,
117
+ "/glossaries/#{glossary_id}/imports",
118
+ query
119
+ )
120
+
121
+ request.perform
122
+ end
123
+
124
+ def check_glossary_import_status(glossary_id = nil, import_id = nil)
125
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
126
+ import_id || raise_parameter_is_required_error(:import_id)
127
+
128
+ request = Web::Request.new(
129
+ self,
130
+ :get,
131
+ "/glossaries/#{glossary_id}/imports/#{import_id}"
132
+ )
133
+
134
+ request.perform
135
+ end
136
+
137
+ def list_terms(glossary_id = nil, query = {})
138
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
139
+
140
+ request = Web::Request.new(
141
+ self,
142
+ :get,
143
+ "/glossaries/#{glossary_id}/terms",
144
+ query
145
+ )
146
+
147
+ request.perform
148
+ end
149
+
150
+ def add_term(glossary_id = nil, query = {})
151
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
152
+
153
+ request = Web::Request.new(
154
+ self,
155
+ :post,
156
+ "/glossaries/#{glossary_id}/terms",
157
+ query
158
+ )
159
+
160
+ request.perform
161
+ end
162
+
163
+ def clear_glossary(glossary_id = nil, query = {})
164
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
165
+
166
+ request = Web::Request.new(
167
+ self,
168
+ :delete,
169
+ "/glossaries/#{glossary_id}/terms",
170
+ query
171
+ )
172
+
173
+ request.perform
174
+ end
175
+
176
+ def get_term(glossary_id = nil, term_id = nil)
177
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
178
+ term_id || raise_parameter_is_required_error(:term_id)
179
+
180
+ request = Web::Request.new(
181
+ self,
182
+ :get,
183
+ "/glossaries/#{glossary_id}/terms/#{term_id}"
184
+ )
185
+
186
+ request.perform
187
+ end
188
+
189
+ def delete_term(glossary_id = nil, term_id = nil)
190
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
191
+ term_id || raise_parameter_is_required_error(:term_id)
192
+
193
+ request = Web::Request.new(
194
+ self,
195
+ :delete,
196
+ "/glossaries/#{glossary_id}/terms/#{term_id}"
197
+ )
198
+
199
+ request.perform
200
+ end
201
+
202
+ def edit_term(glossary_id = nil, term_id = nil, query = {})
203
+ glossary_id || raise_parameter_is_required_error(:glossary_id)
204
+ term_id || raise_parameter_is_required_error(:term_id)
205
+
206
+ request = Web::Request.new(
207
+ self,
208
+ :patch,
209
+ "/glossaries/#{glossary_id}/terms/#{term_id}",
210
+ query
211
+ )
212
+
213
+ request.perform
214
+ end
215
+ end
216
+ end
217
+ end