Module: Crowdin::ApiResources::Projects

Defined in:
lib/crowdin-api/api_resources/projects.rb

Instance Method Summary collapse

Instance Method Details

#add_group(query = {}) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Body



273
274
275
276
277
278
279
280
281
282
283
# File 'lib/crowdin-api/api_resources/projects.rb', line 273

def add_group(query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :post,
    "#{config.target_api_url}/groups",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#add_project(query = {}) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Body



22
23
24
25
26
27
28
29
30
# File 'lib/crowdin-api/api_resources/projects.rb', line 22

def add_project(query = {})
  request = Web::Request.new(
    connection,
    :post,
    "#{config.target_api_url}/projects",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#add_project_file_format_settings(body = {}, project_id = config.project_id) ⇒ Object

Parameters:

  • body (Hash) (defaults to: {}) —

    Request Body



167
168
169
170
171
172
173
174
175
176
177
# File 'lib/crowdin-api/api_resources/projects.rb', line 167

def add_project_file_format_settings(body = {}, project_id = config.project_id)
  project_id || raise_project_id_is_required_error

  request = Web::Request.new(
    connection,
    :post,
    "#{config.target_api_url}/projects/#{project_id}/file-format-settings",
    { params: body }
  )
  Web::SendRequest.new(request).perform
end

#add_project_strings_exporter_settings(project_id = nil, query = {}) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Body



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/crowdin-api/api_resources/projects.rb', line 89

def add_project_strings_exporter_settings(project_id = nil, query = {})
  project_id || raise_parameter_is_required_error(:project_id)

  request = Web::Request.new(
    connection,
    :post,
    "#{config.target_api_url}/projects/#{project_id}/strings-exporter-settings",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#delete_group(group_id = nil) ⇒ Object

Parameters:

  • group_id (Integer) (defaults to: nil) —

    Group Identifier



301
302
303
304
305
306
307
308
309
310
311
# File 'lib/crowdin-api/api_resources/projects.rb', line 301

def delete_group(group_id = nil)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  group_id         || raise_parameter_is_required_error(:group_id)

  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/groups/#{group_id}"
  )
  Web::SendRequest.new(request).perform
end

#delete_project(project_id = nil) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/crowdin-api/api_resources/projects.rb', line 47

def delete_project(project_id = nil)
  project_id || raise_parameter_is_required_error(:project_id)

  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/projects/#{project_id}"
  )
  Web::SendRequest.new(request).perform
end

#delete_project_file_format_settings(file_format_settings_id, project_id = config.project_id) ⇒ Object

Parameters:

  • file_format_settings_id (Integer) —

    File Format Settings Identifier



182
183
184
185
186
187
188
189
190
191
# File 'lib/crowdin-api/api_resources/projects.rb', line 182

def delete_project_file_format_settings(file_format_settings_id, project_id = config.project_id)
  project_id || raise_project_id_is_required_error

  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/projects/#{project_id}/file-format-settings/#{file_format_settings_id}"
  )
  Web::SendRequest.new(request).perform
end

#delete_project_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil) ⇒ Object

Parameters:

  • system_strings_exporter_settings_id (Integer) (defaults to: nil) —

    System strings exporter Settings Identifier



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/crowdin-api/api_resources/projects.rb', line 120

def delete_project_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil)
  project_id || raise_parameter_is_required_error(:project_id)
  system_strings_exporter_settings_id || raise_parameter_is_required_error(:system_strings_exporter_settings_id)

  path = "projects/#{project_id}/strings-exporter-settings/#{system_strings_exporter_settings_id}"
  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/#{path}"
  )
  Web::SendRequest.new(request).perform
end

#download_project_file_format_settings_custom_segmentation(file_format_settings_id, destination = nil, project_id = config.project_id) ⇒ Object

Parameters:

  • file_format_settings_id (Integer) —

    File Format Settings Identifier

  • destination (String) (defaults to: nil) —

    Destination of File



242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/crowdin-api/api_resources/projects.rb', line 242

def download_project_file_format_settings_custom_segmentation(file_format_settings_id, destination = nil,
                                                              project_id = config.project_id)
  project_id || raise_project_id_is_required_error

  endpoint = "projects/#{project_id}/file-format-settings/#{file_format_settings_id}/custom-segmentations"
  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/#{endpoint}"
  )
  Web::SendRequest.new(request, destination).perform
end

#edit_group(group_id = nil, query = {}) ⇒ Object

Parameters:

  • group_id (Integer) (defaults to: nil) —

    Group Identifier

  • query (Hash) (defaults to: {}) —

    Request Body



316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/crowdin-api/api_resources/projects.rb', line 316

def edit_group(group_id = nil, query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error
  group_id         || raise_parameter_is_required_error(:group_id)

  request = Web::Request.new(
    connection,
    :patch,
    "#{config.target_api_url}/groups/#{group_id}",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#edit_project(project_id = nil, query = {}) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Body



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/crowdin-api/api_resources/projects.rb', line 61

def edit_project(project_id = nil, query = {})
  project_id || raise_parameter_is_required_error(:project_id)

  request = Web::Request.new(
    connection,
    :patch,
    "#{config.target_api_url}/projects/#{project_id}",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#edit_project_file_format_settings(file_format_settings_id, body = [], project_id = config.project_id) ⇒ Object

Parameters:

  • file_format_settings_id (Integer) —

    File Format Settings Identifier

  • body (Array) (defaults to: []) —

    Request Body



211
212
213
214
215
216
217
218
219
220
221
# File 'lib/crowdin-api/api_resources/projects.rb', line 211

def edit_project_file_format_settings(file_format_settings_id, body = [], project_id = config.project_id)
  project_id || raise_project_id_is_required_error

  request = Web::Request.new(
    connection,
    :patch,
    "#{config.target_api_url}/projects/#{project_id}/file-format-settings/#{file_format_settings_id}",
    { params: body }
  )
  Web::SendRequest.new(request).perform
end

#edit_project_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil, query = {}) ⇒ Object

Parameters:

  • system_strings_exporter_settings_id (Integer) (defaults to: nil) —

    System strings exporter Settings Identifier

  • query (Hash) (defaults to: {}) —

    Request Body



137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/crowdin-api/api_resources/projects.rb', line 137

def edit_project_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil, query = {})
  project_id || raise_parameter_is_required_error(:project_id)
  system_strings_exporter_settings_id || raise_parameter_is_required_error(:system_strings_exporter_settings_id)

  path = "projects/#{project_id}/strings-exporter-settings/#{system_strings_exporter_settings_id}"
  request = Web::Request.new(
    connection,
    :patch,
    "#{config.target_api_url}/#{path}",
    params: query
  )
  Web::SendRequest.new(request).perform
end

#get_group(group_id = nil) ⇒ Object

Parameters:

  • group_id (Integer) (defaults to: nil) —

    Group Identifier



287
288
289
290
291
292
293
294
295
296
297
# File 'lib/crowdin-api/api_resources/projects.rb', line 287

def get_group(group_id = nil)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  group_id         || raise_parameter_is_required_error(:group_id)

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/groups/#{group_id}"
  )
  Web::SendRequest.new(request).perform
end

#get_project(project_id = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/crowdin-api/api_resources/projects.rb', line 34

def get_project(project_id = nil)
  project_id || raise_parameter_is_required_error(:project_id)

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/projects/#{project_id}"
  )
  Web::SendRequest.new(request).perform
end

#get_project_file_format_settings(file_format_settings_id, project_id = config.project_id) ⇒ Object

Parameters:

  • file_format_settings_id (Integer) —

    File Format Settings Identifier



196
197
198
199
200
201
202
203
204
205
# File 'lib/crowdin-api/api_resources/projects.rb', line 196

def get_project_file_format_settings(file_format_settings_id, project_id = config.project_id)
  project_id || raise_project_id_is_required_error

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/projects/#{project_id}/file-format-settings/#{file_format_settings_id}"
  )
  Web::SendRequest.new(request).perform
end

#get_project_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil) ⇒ Object

Parameters:

  • system_strings_exporter_settings_id (Integer) (defaults to: nil) —

    System strings exporter Settings Identifier



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/crowdin-api/api_resources/projects.rb', line 104

def get_project_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil)
  project_id || raise_parameter_is_required_error(:project_id)
  system_strings_exporter_settings_id || raise_parameter_is_required_error(:system_strings_exporter_settings_id)

  path = "projects/#{project_id}/strings-exporter-settings/#{system_strings_exporter_settings_id}"
  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/#{path}"
  )
  Web::SendRequest.new(request).perform
end

#list_groups(query = {}) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Query Parameters



259
260
261
262
263
264
265
266
267
268
269
# File 'lib/crowdin-api/api_resources/projects.rb', line 259

def list_groups(query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/groups",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#list_project_file_format_settings(project_id = config.project_id) ⇒ Object



153
154
155
156
157
158
159
160
161
162
# File 'lib/crowdin-api/api_resources/projects.rb', line 153

def list_project_file_format_settings(project_id = config.project_id)
  project_id || raise_project_id_is_required_error

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/projects/#{project_id}/file-format-settings"
  )
  Web::SendRequest.new(request).perform
end

#list_project_strings_exporter_settings(project_id = nil) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/crowdin-api/api_resources/projects.rb', line 75

def list_project_strings_exporter_settings(project_id = nil)
  project_id || raise_parameter_is_required_error(:project_id)

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/projects/#{project_id}/strings-exporter-settings"
  )
  Web::SendRequest.new(request).perform
end

#list_projects(query = {}) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Query Parameters



9
10
11
12
13
14
15
16
17
# File 'lib/crowdin-api/api_resources/projects.rb', line 9

def list_projects(query = {})
  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/projects",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#reset_project_file_format_settings_custom_segmentation(file_format_settings_id, project_id = config.project_id) ⇒ Object

Parameters:

  • file_format_settings_id (Integer) —

    File Format Settings Identifier



226
227
228
229
230
231
232
233
234
235
236
# File 'lib/crowdin-api/api_resources/projects.rb', line 226

def reset_project_file_format_settings_custom_segmentation(file_format_settings_id, project_id = config.project_id)
  project_id || raise_project_id_is_required_error

  endpoint = "projects/#{project_id}/file-format-settings/#{file_format_settings_id}/custom-segmentations"
  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/#{endpoint}"
  )
  Web::SendRequest.new(request).perform
end