Module: Crowdin::ApiResources::Placeholders

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

Instance Method Summary collapse

Instance Method Details

#add_custom_placeholder(body = {}) ⇒ Object

Parameters:

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

    Request Body



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

def add_custom_placeholder(body = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :post,
    "#{config.target_api_url}/custom-placeholders",
    { params: body }
  )
  Web::SendRequest.new(request).perform
end

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

Parameters:

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

    Request Body



124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/crowdin-api/api_resources/placeholders.rb', line 124

def add_project_placeholder(body = {}, project_id = config.project_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  project_id || raise_project_id_is_required_error

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

#delete_custom_placeholder(custom_placeholder_id) ⇒ Object

Parameters:

  • custom_placeholder_id (Integer) —

    Custom Placeholder identifier



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

def delete_custom_placeholder(custom_placeholder_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/custom-placeholders/#{custom_placeholder_id}"
  )
  Web::SendRequest.new(request).perform
end

#delete_project_placeholder(project_placeholder_id, project_id = config.project_id) ⇒ Object

Parameters:

  • project_placeholder_id (Integer) —

    Project Placeholder identifier



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

def delete_project_placeholder(project_placeholder_id, project_id = config.project_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  project_id || raise_project_id_is_required_error

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

#edit_custom_placeholder(custom_placeholder_id, body = []) ⇒ Object

Parameters:

  • custom_placeholder_id (Integer) —

    Custom Placeholder identifier

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

    Request Body



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

def edit_custom_placeholder(custom_placeholder_id, body = [])
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :patch,
    "#{config.target_api_url}/custom-placeholders/#{custom_placeholder_id}",
    { params: body }
  )
  Web::SendRequest.new(request).perform
end

#edit_project_placeholder(project_placeholder_id, body = [], project_id = config.project_id) ⇒ Object

Parameters:

  • project_placeholder_id (Integer) —

    Project Placeholder identifier

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

    Request Body



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

def edit_project_placeholder(project_placeholder_id, body = [], project_id = config.project_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  project_id || raise_project_id_is_required_error

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

#get_custom_placeholder(custom_placeholder_id) ⇒ Object

Parameters:

  • custom_placeholder_id (Integer) —

    Custom Placeholder identifier



81
82
83
84
85
86
87
88
89
90
# File 'lib/crowdin-api/api_resources/placeholders.rb', line 81

def get_custom_placeholder(custom_placeholder_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/custom-placeholders/#{custom_placeholder_id}"
  )
  Web::SendRequest.new(request).perform
end

#get_project_placeholder(project_placeholder_id, project_id = config.project_id) ⇒ Object

Parameters:

  • project_placeholder_id (Integer) —

    Project Placeholder identifier



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

def get_project_placeholder(project_placeholder_id, project_id = config.project_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  project_id || raise_project_id_is_required_error

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

#list_custom_placeholders(query = {}) ⇒ Object

Parameters:

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

    Request Query Parameters



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

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

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

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

Parameters:

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

    Request Query Parameters



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

def list_project_placeholders(query = {}, project_id = config.project_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  project_id || raise_project_id_is_required_error

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

#list_project_system_placeholders(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/placeholders.rb', line 9

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

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

Parameters:

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

    Request Body



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

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