Sha256: c756bf2cf0b0c40dac04473f071b103d1e7dbaf764f4e8793019ddedc3c77280

Contents?: true

Size: 1.83 KB

Versions: 4

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

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

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

        request.perform
      end

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

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

        request.perform
      end

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

        request.perform
      end

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

        request.perform
      end

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

        request.perform
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
crowdin-api-1.2.1 lib/crowdin-api/api-resources/source_strings.rb
crowdin-api-1.2.0 lib/crowdin-api/api-resources/source_strings.rb
crowdin-api-1.1.1 lib/crowdin-api/api-resources/source_strings.rb
crowdin-api-1.1.0 lib/crowdin-api/api-resources/source_strings.rb