Module: Crowdin::ApiResources::MachineTranslationEngines

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

Instance Method Summary collapse

Instance Method Details

#add_mt(query = {}) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/crowdin-api/api_resources/machine_translation_engines.rb', line 54

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

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

#delete_mt(mt_id = nil) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/crowdin-api/api_resources/machine_translation_engines.rb', line 66

def delete_mt(mt_id = nil)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  mt_id            || raise_parameter_is_required_error(:mt_id)

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

#edit_mt(mt_id = nil, query = {}) ⇒ Object

– For Enterprise mode only –



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/crowdin-api/api_resources/machine_translation_engines.rb', line 41

def edit_mt(mt_id = nil, query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error
  mt_id            || raise_parameter_is_required_error(:mt_id)

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

#get_mt(mt_id = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/crowdin-api/api_resources/machine_translation_engines.rb', line 16

def get_mt(mt_id = nil)
  mt_id || raise_parameter_is_required_error(:mt_id)

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

#list_mts(query = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/crowdin-api/api_resources/machine_translation_engines.rb', line 6

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

#translate_via_mt(mt_id = nil, query = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/crowdin-api/api_resources/machine_translation_engines.rb', line 27

def translate_via_mt(mt_id = nil, query = {})
  mt_id || raise_parameter_is_required_error(:mt_id)

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