Module: Crowdin::ApiResources::Languages

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

Instance Method Summary collapse

Instance Method Details

#add_custom_language(query = {}) ⇒ Object



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

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

#delete_custom_language(language_id = nil) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/crowdin-api/api_resources/languages.rb', line 37

def delete_custom_language(language_id = nil)
  language_id || raise_parameter_is_required_error(:language_id)

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

#edit_custom_language(language_id = nil, query = {}) ⇒ Object



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

def edit_custom_language(language_id = nil, query = {})
  language_id || raise_parameter_is_required_error(:language_id)

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

#get_language(language_id = nil) ⇒ Object



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

def get_language(language_id = nil)
  language_id || raise_parameter_is_required_error(:language_id)

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

#list_languages(query = {}) ⇒ Object



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

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