Module: Crowdin::ApiResources::SourceStrings

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

Instance Method Summary collapse

Instance Method Details

#add_string(query = {}, project_id = config.project_id) ⇒ Object

Parameters:

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

    Request Body



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

def add_string(query = {}, 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}/strings",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#delete_string(string_id = nil, project_id = config.project_id) ⇒ Object

Parameters:

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

    String Identifier



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/crowdin-api/api_resources/source_strings.rb', line 56

def delete_string(string_id = nil, project_id = config.project_id)
  string_id  || raise_parameter_is_required_error(:string_id)
  project_id || raise_project_id_is_required_error

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

#edit_string(string_id = nil, query = {}, project_id = config.project_id) ⇒ Object

Parameters:

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

    String Identifier

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

    Request Body



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/crowdin-api/api_resources/source_strings.rb', line 72

def edit_string(string_id = nil, query = {}, project_id = config.project_id)
  string_id  || raise_parameter_is_required_error(:string_id)
  project_id || raise_project_id_is_required_error

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

#get_string(string_id = nil, query = {}, project_id = config.project_id) ⇒ Object

Parameters:

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

    String Identifier

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

    Request Query Parameters



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

def get_string(string_id = nil, query = {}, project_id = config.project_id)
  string_id  || raise_parameter_is_required_error(:string_id)
  project_id || raise_project_id_is_required_error

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

#list_strings(query = {}, project_id = config.project_id) ⇒ Object

Parameters:

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

    Request Query Parameters



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

def list_strings(query = {}, 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}/strings",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#search_strings(query = {}) ⇒ Object

Parameters:

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

    Request Query Parameters



132
133
134
135
136
137
138
139
140
# File 'lib/crowdin-api/api_resources/source_strings.rb', line 132

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

#string_batch_operations(query = {}, project_id = config.project_id) ⇒ Object

Parameters:

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

    Request Body



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

def string_batch_operations(query = {}, 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}/strings",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

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

Parameters:

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

    Request Body



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

def upload_strings(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}/strings/uploads",
    { params: body }
  )
  Web::SendRequest.new(request).perform
end

#upload_strings_status(upload_id, project_id = config.project_id) ⇒ Object

Parameters:

  • upload_id (String) —

    Upload Strings Identifier, consists of 36 characters



118
119
120
121
122
123
124
125
126
127
# File 'lib/crowdin-api/api_resources/source_strings.rb', line 118

def upload_strings_status(upload_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}/strings/uploads/#{upload_id}"
  )
  Web::SendRequest.new(request).perform
end