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.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module Notifications
6
+ def send_notification_to_authenticated_user(query = {})
7
+ %i[message].each do |param|
8
+ query[param] || raise_parameter_is_required_error(param)
9
+ end
10
+
11
+ request = Web::Request.new(
12
+ connection,
13
+ :post,
14
+ "#{config.target_api_url}/notify",
15
+ { params: query }
16
+ )
17
+ Web::SendRequest.new(request).perform
18
+ end
19
+
20
+ def send_notification_to_organization_members(query = {})
21
+ enterprise_mode? || raise_only_for_enterprise_mode_error
22
+
23
+ %i[message].each do |param|
24
+ query[param] || raise_parameter_is_required_error(param)
25
+ end
26
+
27
+ request = Web::Request.new(
28
+ connection,
29
+ :post,
30
+ "#{config.target_api_url}/notify",
31
+ { params: query }
32
+ )
33
+ Web::SendRequest.new(request).perform
34
+ end
35
+
36
+ def send_notifications_to_project_members(query = {}, project_id = config.project_id)
37
+ project_id || raise_project_id_is_required_error
38
+
39
+ %i[message].each do |param|
40
+ query[param] || raise_parameter_is_required_error(param)
41
+ end
42
+
43
+ request = Web::Request.new(
44
+ connection,
45
+ :post,
46
+ "#{config.target_api_url}/projects/#{project_id}/notify",
47
+ { params: query }
48
+ )
49
+ Web::SendRequest.new(request).perform
50
+ end
51
+ end
52
+ end
53
+ end
@@ -22,7 +22,7 @@ module Crowdin
22
22
  def add_storage(file = nil)
23
23
  file || raise_parameter_is_required_error(:file)
24
24
 
25
- file = file.is_a?(File) ? file : File.open(file, 'r')
25
+ file ||= File.open(file, 'r')
26
26
  headers = { 'Content-Type' => 'application/octet-stream', 'Crowdin-API-FileName' => File.basename(file) }
27
27
 
28
28
  request = Web::Request.new(
@@ -188,6 +188,22 @@ module Crowdin
188
188
  )
189
189
  Web::SendRequest.new(request).perform
190
190
  end
191
+
192
+ def add_translation_alignment(project_id = nil, query = {})
193
+ project_id || raise_project_id_is_required_error
194
+
195
+ %i[source_language_id target_language_id text].each do |param|
196
+ query[param] || raise_parameter_is_required_error(param)
197
+ end
198
+
199
+ request = Web::Request.new(
200
+ connection,
201
+ :post,
202
+ "#{config.target_api_url}/projects/#{project_id}/translations/alignment",
203
+ { params: query }
204
+ )
205
+ Web::SendRequest.new(request).perform
206
+ end
191
207
  end
192
208
  end
193
209
  end
@@ -126,6 +126,22 @@ module Crowdin
126
126
  )
127
127
  Web::SendRequest.new(request).perform
128
128
  end
129
+
130
+ def search_tms_concordance(project_id = nil, query = {})
131
+ project_id || raise_project_id_is_required_error
132
+
133
+ %i[source_language_id target_language_id expression auto_substitution min_relevant].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}/tms/concordance",
141
+ { params: query }
142
+ )
143
+ Web::SendRequest.new(request).perform
144
+ end
129
145
  end
130
146
  end
131
147
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Crowdin
4
4
  class Client
5
- VERSION = '1.5.0'
5
+ VERSION = '1.7.0'
6
6
  end
7
7
  end
data/lib/crowdin-api.rb CHANGED
@@ -5,7 +5,8 @@ module Crowdin
5
5
  API_RESOURCES_MODULES = %i[Storages Languages Projects Workflows SourceFiles Translations SourceStrings
6
6
  StringTranslations StringComments Screenshots Glossaries TranslationMemory
7
7
  MachineTranslationEngines Reports Tasks Users Teams Vendors Webhooks
8
- Dictionaries Distributions Labels TranslationStatus Bundles].freeze
8
+ Dictionaries Distributions Labels TranslationStatus Bundles Notifications
9
+ Applications].freeze
9
10
 
10
11
  # Error Raisers modules
11
12
  ERROR_RAISERS_MODULES = %i[ApiErrorsRaiser ClientErrorsRaiser].freeze
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe Crowdin::ApiResources::Applications do
4
+ let(:application_identifier) { 'identifier' }
5
+ let(:path) { 'application_path' }
6
+ describe 'Default endpoints' do
7
+ describe '#get_application_data' do
8
+ it 'when request are valid', :default do
9
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/applications/#{application_identifier}/api/#{path}")
10
+ get_application_data = @crowdin.get_application_data(application_identifier, path)
11
+ expect(get_application_data).to eq(200)
12
+ end
13
+ end
14
+
15
+ describe '#update_or_restore_application_data' do
16
+ it 'when request are valid', :default do
17
+ stub_request(:put, "https://api.crowdin.com/#{target_api_url}/applications/#{application_identifier}/api/#{path}")
18
+ get_application_data = @crowdin.update_or_restore_application_data({}, application_identifier, path)
19
+ expect(get_application_data).to eq(200)
20
+ end
21
+ end
22
+
23
+ describe '#add_application_data' do
24
+ it 'when request are valid', :default do
25
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/applications/#{application_identifier}/api/#{path}")
26
+ get_application_data = @crowdin.add_application_data({}, application_identifier, path)
27
+ expect(get_application_data).to eq(200)
28
+ end
29
+ end
30
+
31
+ describe '#delete_application_data' do
32
+ it 'when request are valid', :default do
33
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/applications/#{application_identifier}/api/#{path}")
34
+ get_application_data = @crowdin.delete_application_data({}, application_identifier, path)
35
+ expect(get_application_data).to eq(200)
36
+ end
37
+ end
38
+
39
+ describe '#edit_application_data' do
40
+ it 'when request are valid', :default do
41
+ stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/applications/#{application_identifier}/api/#{path}")
42
+ get_application_data = @crowdin.edit_application_data({}, application_identifier, path)
43
+ expect(get_application_data).to eq(200)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -18,6 +18,37 @@ describe Crowdin::ApiResources::Bundles do
18
18
  end
19
19
  end
20
20
 
21
+ describe '#export_bundle' do
22
+ let(:bundle_id) { 1 }
23
+ it 'when request are valid', :default do
24
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/exports")
25
+ export_bundle = @crowdin.export_bundle(bundle_id, project_id)
26
+ expect(export_bundle).to eq(200)
27
+ end
28
+ end
29
+
30
+ describe '#check_bundle_export_status' do
31
+ let(:bundle_id) { 1 }
32
+ let(:export_id) { 1 }
33
+
34
+ it 'when request are valid', :default do
35
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/exports/#{export_id}")
36
+ check_bundle_export_status = @crowdin.check_bundle_export_status(bundle_id, export_id, project_id)
37
+ expect(check_bundle_export_status).to eq(200)
38
+ end
39
+ end
40
+
41
+ describe '#download_bundle' do
42
+ let(:bundle_id) { 1 }
43
+ let(:export_id) { 1 }
44
+
45
+ it 'when request are valid', :default do
46
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/bundles/#{bundle_id}/exports/#{export_id}/download")
47
+ download_bundle = @crowdin.download_bundle(bundle_id, export_id, project_id)
48
+ expect(download_bundle).to eq(200)
49
+ end
50
+ end
51
+
21
52
  describe '#get_bundle' do
22
53
  let(:bundle_id) { 1 }
23
54
 
@@ -1,210 +1,231 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- describe Crowdin::ApiResources::Glossaries do
4
- describe 'Default endpoints' do
5
- describe '#list_glossaries' do
6
- it 'when request are valid', :default do
7
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries")
8
- list_glossaries = @crowdin.list_glossaries
9
- expect(list_glossaries).to eq(200)
10
- end
3
+ describe Crowdin::ApiResources::Glossaries, 'Default endpoints' do
4
+ describe '#list_glossaries' do
5
+ it 'when request are valid', :default do
6
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries")
7
+ list_glossaries = @crowdin.list_glossaries
8
+ expect(list_glossaries).to eq(200)
11
9
  end
10
+ end
12
11
 
13
- describe '#add_glossary' do
14
- it 'when request are valid', :default do
15
- stub_request(:post, "https://api.crowdin.com/#{target_api_url}/glossaries")
16
- add_glossary = @crowdin.add_glossary
17
- expect(add_glossary).to eq(200)
18
- end
12
+ describe '#add_glossary' do
13
+ it 'when request are valid', :default do
14
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/glossaries")
15
+ add_glossary = @crowdin.add_glossary
16
+ expect(add_glossary).to eq(200)
19
17
  end
18
+ end
20
19
 
21
- describe '#get_glossary' do
22
- let(:glossary_id) { 1 }
20
+ describe '#get_glossary' do
21
+ let(:glossary_id) { 1 }
23
22
 
24
- it 'when request are valid', :default do
25
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}")
26
- get_glossary = @crowdin.get_glossary(glossary_id)
27
- expect(get_glossary).to eq(200)
28
- end
23
+ it 'when request are valid', :default do
24
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}")
25
+ get_glossary = @crowdin.get_glossary(glossary_id)
26
+ expect(get_glossary).to eq(200)
29
27
  end
28
+ end
30
29
 
31
- describe '#delete_glossary' do
32
- let(:glossary_id) { 1 }
30
+ describe '#delete_glossary' do
31
+ let(:glossary_id) { 1 }
33
32
 
34
- it 'when request are valid', :default do
35
- stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}")
36
- delete_glossary = @crowdin.delete_glossary(glossary_id)
37
- expect(delete_glossary).to eq(200)
38
- end
33
+ it 'when request are valid', :default do
34
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}")
35
+ delete_glossary = @crowdin.delete_glossary(glossary_id)
36
+ expect(delete_glossary).to eq(200)
39
37
  end
38
+ end
40
39
 
41
- describe '#edit_glossary' do
42
- let(:glossary_id) { 1 }
40
+ describe '#edit_glossary' do
41
+ let(:glossary_id) { 1 }
43
42
 
44
- it 'when request are valid', :default do
45
- stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}")
46
- edit_glossary = @crowdin.edit_glossary(glossary_id)
47
- expect(edit_glossary).to eq(200)
48
- end
43
+ it 'when request are valid', :default do
44
+ stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}")
45
+ edit_glossary = @crowdin.edit_glossary(glossary_id)
46
+ expect(edit_glossary).to eq(200)
49
47
  end
48
+ end
50
49
 
51
- describe '#export_glossary' do
52
- let(:glossary_id) { 1 }
50
+ describe '#export_glossary' do
51
+ let(:glossary_id) { 1 }
53
52
 
54
- it 'when request are valid', :default do
55
- stub_request(:post, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/exports")
56
- export_glossary = @crowdin.export_glossary({}, glossary_id)
57
- expect(export_glossary).to eq(200)
58
- end
53
+ it 'when request are valid', :default do
54
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/exports")
55
+ export_glossary = @crowdin.export_glossary({}, glossary_id)
56
+ expect(export_glossary).to eq(200)
59
57
  end
58
+ end
60
59
 
61
- describe '#check_glossary_export_status' do
62
- let(:glossary_id) { 1 }
63
- let(:export_id) { 1 }
60
+ describe '#check_glossary_export_status' do
61
+ let(:glossary_id) { 1 }
62
+ let(:export_id) { 1 }
64
63
 
65
- it 'when request are valid', :default do
66
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/exports/#{export_id}")
67
- check_glossary_export_status = @crowdin.check_glossary_export_status(glossary_id, export_id)
68
- expect(check_glossary_export_status).to eq(200)
69
- end
64
+ it 'when request are valid', :default do
65
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/exports/#{export_id}")
66
+ check_glossary_export_status = @crowdin.check_glossary_export_status(glossary_id, export_id)
67
+ expect(check_glossary_export_status).to eq(200)
70
68
  end
69
+ end
71
70
 
72
- describe '#download_glossary' do
73
- let(:glossary_id) { 1 }
74
- let(:export_id) { 1 }
71
+ describe '#download_glossary' do
72
+ let(:glossary_id) { 1 }
73
+ let(:export_id) { 1 }
75
74
 
76
- it 'when request are valid', :default do
77
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/exports/#{export_id}/download")
78
- download_glossary = @crowdin.download_glossary(glossary_id, export_id)
79
- expect(download_glossary).to eq(200)
80
- end
75
+ it 'when request are valid', :default do
76
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/exports/#{export_id}/download")
77
+ download_glossary = @crowdin.download_glossary(glossary_id, export_id)
78
+ expect(download_glossary).to eq(200)
81
79
  end
80
+ end
82
81
 
83
- describe '#import_glossary' do
84
- let(:glossary_id) { 1 }
82
+ describe '#import_glossary' do
83
+ let(:glossary_id) { 1 }
85
84
 
86
- it 'when request are valid', :default do
87
- stub_request(:post, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/imports")
88
- import_glossary = @crowdin.import_glossary(glossary_id)
89
- expect(import_glossary).to eq(200)
90
- end
85
+ it 'when request are valid', :default do
86
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/imports")
87
+ import_glossary = @crowdin.import_glossary(glossary_id)
88
+ expect(import_glossary).to eq(200)
91
89
  end
90
+ end
92
91
 
93
- describe '#check_glossary_import_status' do
94
- let(:glossary_id) { 1 }
95
- let(:import_id) { 1 }
92
+ describe '#check_glossary_import_status' do
93
+ let(:glossary_id) { 1 }
94
+ let(:import_id) { 1 }
96
95
 
97
- it 'when request are valid', :default do
98
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/imports/#{import_id}")
99
- check_glossary_import_status = @crowdin.check_glossary_import_status(glossary_id, import_id)
100
- expect(check_glossary_import_status).to eq(200)
101
- end
96
+ it 'when request are valid', :default do
97
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/imports/#{import_id}")
98
+ check_glossary_import_status = @crowdin.check_glossary_import_status(glossary_id, import_id)
99
+ expect(check_glossary_import_status).to eq(200)
102
100
  end
101
+ end
103
102
 
104
- describe '#list_terms' do
105
- let(:glossary_id) { 1 }
103
+ describe '#clear_glossary' do
104
+ let(:glossary_id) { 1 }
106
105
 
107
- it 'when request are valid', :default do
108
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms")
109
- list_terms = @crowdin.list_terms(glossary_id)
110
- expect(list_terms).to eq(200)
111
- end
106
+ it 'when request are valid', :default do
107
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms")
108
+ clear_glossary = @crowdin.clear_glossary(glossary_id)
109
+ expect(clear_glossary).to eq(200)
112
110
  end
111
+ end
113
112
 
114
- describe '#add_term' do
115
- let(:glossary_id) { 1 }
113
+ describe '#search_glossaries_concordance' do
114
+ let(:project_id) { 1 }
116
115
 
117
- it 'when request are valid', :default do
118
- stub_request(:post, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms")
119
- add_term = @crowdin.add_term(glossary_id)
120
- expect(add_term).to eq(200)
121
- end
116
+ it 'returns 200 when request is valid', :default do
117
+ query = { source_language_id: 'en', target_language_id: 'ar', expression: 'Hello world!' }
118
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/glossaries/concordance")
119
+ search_glossaries_concordance = @crowdin.search_glossaries_concordance(project_id, query)
120
+ expect(search_glossaries_concordance).to eq(200)
122
121
  end
123
122
 
124
- describe '#clear_glossary' do
125
- let(:glossary_id) { 1 }
123
+ it 'raises ArgumentError when request is missing required query parameter', :default do
124
+ query = { source_language_id: 'en', target_language_id: 'ar' }
125
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/glossaries/concordance")
126
+ expect do
127
+ @crowdin.search_glossaries_concordance(project_id, query)
128
+ end.to raise_error(ArgumentError, ':expression is required')
129
+ end
130
+ end
131
+ end
126
132
 
127
- it 'when request are valid', :default do
128
- stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms")
129
- clear_glossary = @crowdin.clear_glossary(glossary_id)
130
- expect(clear_glossary).to eq(200)
131
- end
133
+ describe Crowdin::ApiResources::Glossaries, 'Concept endpoints' do
134
+ describe '#list_concepts' do
135
+ let(:glossary_id) { 1 }
136
+
137
+ it 'when request are valid', :default do
138
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/concepts")
139
+ concepts = @crowdin.list_concepts(glossary_id)
140
+ expect(concepts).to eq(200)
132
141
  end
142
+ end
133
143
 
134
- describe '#get_term' do
135
- let(:glossary_id) { 1 }
136
- let(:term_id) { 1 }
144
+ describe '#get_concept' do
145
+ let(:glossary_id) { 1 }
146
+ let(:concept_id) { 1 }
137
147
 
138
- it 'when request are valid', :default do
139
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms/#{term_id}")
140
- get_term = @crowdin.get_term(glossary_id, term_id)
141
- expect(get_term).to eq(200)
142
- end
148
+ it 'when request are valid', :default do
149
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}")
150
+ concept = @crowdin.get_concept(glossary_id, concept_id)
151
+ expect(concept).to eq(200)
143
152
  end
153
+ end
144
154
 
145
- describe '#delete_term' do
146
- let(:glossary_id) { 1 }
147
- let(:term_id) { 1 }
155
+ describe '#update_concept' do
156
+ let(:glossary_id) { 1 }
157
+ let(:concept_id) { 1 }
148
158
 
149
- it 'when request are valid', :default do
150
- stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms/#{term_id}")
151
- delete_term = @crowdin.delete_term(glossary_id, term_id)
152
- expect(delete_term).to eq(200)
153
- end
159
+ it 'when request are valid', :default do
160
+ stub_request(:put, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}")
161
+ concept = @crowdin.update_concept(glossary_id, concept_id)
162
+ expect(concept).to eq(200)
154
163
  end
164
+ end
155
165
 
156
- describe '#edit_term' do
157
- let(:glossary_id) { 1 }
158
- let(:term_id) { 1 }
166
+ describe '#update_concept' do
167
+ let(:glossary_id) { 1 }
168
+ let(:concept_id) { 1 }
159
169
 
160
- it 'when request are valid', :default do
161
- stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms/#{term_id}")
162
- edit_term = @crowdin.edit_term(glossary_id, term_id)
163
- expect(edit_term).to eq(200)
164
- end
170
+ it 'when request are valid', :default do
171
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}")
172
+ concept = @crowdin.delete_concept(glossary_id, concept_id)
173
+ expect(concept).to eq(200)
165
174
  end
175
+ end
176
+ end
166
177
 
167
- describe '#list_concepts' do
168
- let(:glossary_id) { 1 }
178
+ describe Crowdin::ApiResources::Glossaries, 'Term endpoints' do
179
+ describe '#list_terms' do
180
+ let(:glossary_id) { 1 }
169
181
 
170
- it 'when request are valid', :default do
171
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/concepts")
172
- concepts = @crowdin.list_concepts(glossary_id)
173
- expect(concepts).to eq(200)
174
- end
182
+ it 'when request are valid', :default do
183
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms")
184
+ list_terms = @crowdin.list_terms(glossary_id)
185
+ expect(list_terms).to eq(200)
175
186
  end
187
+ end
176
188
 
177
- describe '#get_concept' do
178
- let(:glossary_id) { 1 }
179
- let(:concept_id) { 1 }
189
+ describe '#add_term' do
190
+ let(:glossary_id) { 1 }
180
191
 
181
- it 'when request are valid', :default do
182
- stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}")
183
- concept = @crowdin.get_concept(glossary_id, concept_id)
184
- expect(concept).to eq(200)
185
- end
192
+ it 'when request are valid', :default do
193
+ stub_request(:post, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms")
194
+ add_term = @crowdin.add_term(glossary_id)
195
+ expect(add_term).to eq(200)
186
196
  end
197
+ end
198
+
199
+ describe '#get_term' do
200
+ let(:glossary_id) { 1 }
201
+ let(:term_id) { 1 }
202
+
203
+ it 'when request are valid', :default do
204
+ stub_request(:get, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms/#{term_id}")
205
+ get_term = @crowdin.get_term(glossary_id, term_id)
206
+ expect(get_term).to eq(200)
207
+ end
208
+ end
187
209
 
188
- describe '#update_concept' do
189
- let(:glossary_id) { 1 }
190
- let(:concept_id) { 1 }
210
+ describe '#delete_term' do
211
+ let(:glossary_id) { 1 }
212
+ let(:term_id) { 1 }
191
213
 
192
- it 'when request are valid', :default do
193
- stub_request(:put, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}")
194
- concept = @crowdin.update_concept(glossary_id, concept_id)
195
- expect(concept).to eq(200)
196
- end
214
+ it 'when request are valid', :default do
215
+ stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms/#{term_id}")
216
+ delete_term = @crowdin.delete_term(glossary_id, term_id)
217
+ expect(delete_term).to eq(200)
197
218
  end
219
+ end
198
220
 
199
- describe '#update_concept' do
200
- let(:glossary_id) { 1 }
201
- let(:concept_id) { 1 }
221
+ describe '#edit_term' do
222
+ let(:glossary_id) { 1 }
223
+ let(:term_id) { 1 }
202
224
 
203
- it 'when request are valid', :default do
204
- stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/concepts/#{concept_id}")
205
- concept = @crowdin.delete_concept(glossary_id, concept_id)
206
- expect(concept).to eq(200)
207
- end
225
+ it 'when request are valid', :default do
226
+ stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/glossaries/#{glossary_id}/terms/#{term_id}")
227
+ edit_term = @crowdin.edit_term(glossary_id, term_id)
228
+ expect(edit_term).to eq(200)
208
229
  end
209
230
  end
210
231
  end