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



177
178
179
180
181
182
183
184
185
186
187
# File 'lib/crowdin-api/api_resources/projects.rb', line 177

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_strings_exporter_settings(project_id = nil, query = {}) ⇒ Object

Parameters:

  • project_id (Integer) (defaults to: nil)

    Project ID

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

    Request Body



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/crowdin-api/api_resources/projects.rb', line 94

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 ID



205
206
207
208
209
210
211
212
213
214
215
# File 'lib/crowdin-api/api_resources/projects.rb', line 205

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

Parameters:

  • project_id (Integer) (defaults to: nil)

    Project ID



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

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_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil) ⇒ Object

Parameters:

  • project_id (Integer) (defaults to: nil)

    Project ID

  • system_strings_exporter_settings_id (Integer) (defaults to: nil)

    Request Body



127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/crowdin-api/api_resources/projects.rb', line 127

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

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

Parameters:

  • group_id (Integer) (defaults to: nil)

    Group ID

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

    Request Body



220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/crowdin-api/api_resources/projects.rb', line 220

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:

  • project_id (Integer) (defaults to: nil)

    Project ID

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

    Request Body



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/crowdin-api/api_resources/projects.rb', line 64

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_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil, query = {}) ⇒ Object

Parameters:

  • project_id (Integer) (defaults to: nil)

    Project ID

  • system_strings_exporter_settings_id (Integer) (defaults to: nil)

    Request Body

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

    Request Body



145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/crowdin-api/api_resources/projects.rb', line 145

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 ID



191
192
193
194
195
196
197
198
199
200
201
# File 'lib/crowdin-api/api_resources/projects.rb', line 191

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

Parameters:

  • project_id (Integer) (defaults to: nil)

    Project ID



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

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_strings_exporter_settings(project_id = nil, system_strings_exporter_settings_id = nil) ⇒ Object

Parameters:

  • project_id (Integer) (defaults to: nil)

    Project ID

  • system_strings_exporter_settings_id (Integer) (defaults to: nil)

    Request Body



110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/crowdin-api/api_resources/projects.rb', line 110

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 Body



163
164
165
166
167
168
169
170
171
172
173
# File 'lib/crowdin-api/api_resources/projects.rb', line 163

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_strings_exporter_settings(project_id = nil) ⇒ Object

Parameters:

  • project_id (Integer) (defaults to: nil)

    Project ID



79
80
81
82
83
84
85
86
87
88
# File 'lib/crowdin-api/api_resources/projects.rb', line 79

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 Body



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