Sha256: 2a4c5f4e70213ace1c887b3d855965cfa3612a08cacfa719b17a6abf1ca1910f

Contents?: true

Size: 1.96 KB

Versions: 2

Compression:

Stored size: 1.96 KB

Contents

# frozen_string_literal: true

module Crowdin
  module ApiResources
    module StringComments
      def list_string_comments(query = {}, project_id = config.project_id)
        project_id || raise_project_id_is_required_error

        request = Web::Request.new(
          self,
          :get,
          "/projects/#{project_id}/comments",
          query
        )

        request.perform
      end

      def add_string_comment(query = {}, project_id = config.project_id)
        project_id || raise_project_id_is_required_error

        request = Web::Request.new(
          self,
          :post,
          "/projects/#{project_id}/comments",
          query
        )

        request.perform
      end

      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(
          self,
          :get,
          "/projects/#{project_id}/comments/#{string_comment_id}"
        )

        request.perform
      end

      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(
          self,
          :delete,
          "/projects/#{project_id}/comments/#{string_comment_id}"
        )

        request.perform
      end

      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(
          self,
          :patch,
          "/projects/#{project_id}/comments/#{string_comment_id}",
          query
        )

        request.perform
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crowdin-api-1.2.1 lib/crowdin-api/api-resources/string_comments.rb
crowdin-api-1.2.0 lib/crowdin-api/api-resources/string_comments.rb