Sha256: 2df6a9476d3a2d3f26ad2c784c68049ad208fa5e1ef7935927ec8ce4e7df467b

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

require 'uploadcare/rails/api/rest/base'

module Uploadcare
  module Rails
    module Api
      module Rest
        # A class that contains Group related methods for Uploadcare REST API
        class GroupApi < Base
          class << self
            # Returns paginated list of groups
            # @see https://uploadcare.com/api-refs/rest-api/v0.5.0/#operation/groupsList
            #
            # valid options:
            # limit: (1..1000)
            # ordering: ["datetime_created"|"-datetime_created"]
            # from: A starting point for filtering group lists. MUST be a datetime value with T used as a separator.
            #   example: '2015-01-02T10:00:00'
            def get_groups(**options)
              Uploadcare::GroupList.list(**options)
            end

            # Get group info
            # @see https://uploadcare.com/api-refs/upload-api/#operation/filesGroupInfo
            def get_group(uuid)
              Uploadcare::Group.info(uuid)
            end

            # Stores all files in a group
            # @see https://uploadcare.com/api-refs/rest-api/v0.5.0/#tag/Group/paths/~1groups~1%3Cuuid%3E~1storage~1/put
            def store_group(uuid)
              Uploadcare::Group.store(uuid)
            end

            # Create files group from a set of files by using their UUIDs.
            # @see https://uploadcare.com/api-refs/upload-api/#operation/createFilesGroup
            def create_group(files, **options)
              Uploadcare::Group.create(files, **options)
            end
          end
        end
      end
    end
  end
end

Uploadcare::GroupApi = Uploadcare::Rails::Api::Rest::GroupApi

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uploadcare-rails-2.1.1 lib/uploadcare/rails/api/rest/group_api.rb
uploadcare-rails-2.1.0 lib/uploadcare/rails/api/rest/group_api.rb
uploadcare-rails-2.0.0 lib/uploadcare/rails/api/rest/group_api.rb