Module: Crowdin::ApiResources::StringComments

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

Instance Method Summary collapse

Instance Method Details

#add_string_comment(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/string_comments.rb', line 24

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

#delete_attachment_from_string_asset_comment(comment_id, attachment_id, project_id = config.project_id) ⇒ Object

Parameters:

  • comment_id (Integer) —

    String Comment Identifier

  • attachment_id (Integer) —

    Attachment Identifier



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

def delete_attachment_from_string_asset_comment(comment_id, attachment_id, project_id = config.project_id)
  project_id || raise_project_id_is_required_error

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

#delete_string_comment(string_comment_id = nil, project_id = config.project_id) ⇒ Object

Parameters:

  • string_comment_id (Hash) (defaults to: nil) —

    Request Body



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

def delete_string_comment(string_comment_id = nil, project_id = config.project_id)
  string_comment_id || raise_parameter_is_required_error(:string_comment_id)
  project_id        || raise_project_id_is_required_error

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

#edit_string_comment(string_comment_id = nil, query = {}, project_id = config.project_id) ⇒ Object

Parameters:

  • string_comment_id (Hash) (defaults to: nil) —

    Request Body

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

    Request Body



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/crowdin-api/api_resources/string_comments.rb', line 70

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

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

#get_string_comment(string_comment_id = nil, project_id = config.project_id) ⇒ Object

Parameters:

  • string_comment_id (Hash) (defaults to: nil) —

    Request Body



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

def get_string_comment(string_comment_id = nil, project_id = config.project_id)
  string_comment_id || raise_parameter_is_required_error(:string_comment_id)
  project_id        || raise_project_id_is_required_error

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

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

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

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

Parameters:

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

    Request Body



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/crowdin-api/api_resources/string_comments.rb', line 86

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