Sha256: e4f5e2417537d8a207ac458f895c41ba7a3dce44f0e3f3e5ec48907a82ac7db6

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8

module Nimbu
  module Endpoints
    class Collections < Endpoint
      def list(*args)
        arguments(args)

        response = get_request("/collections", arguments.params)
        return response unless block_given?
        response.each { |el| yield el }
      end
      alias :all :list

      def get(*args)
        arguments(args, :required => [:collection_id])

        get_request("/collections/#{collection_id}", arguments.params)
      end
      alias :find :get

      def create(*args)
        arguments(args)

        post_request("/collections", arguments.params)
      end

      def update(*args)
        arguments(args, :required => [:collection_id])

        patch_request("/collections/#{collection_id}", arguments.params)
      end
      alias :edit :update

      def delete(*args)
        arguments(args, :required => [:collection_id])

        delete_request("/collections/#{collection_id}", arguments.params)
      end
      alias :remove :delete

    end # Products
  end # Endpoints
end # Nimbu

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
nimbu-api-0.4.4 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.4.3 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.4.2 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.4.1 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.4.0 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.3.0 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.2.1 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.2 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.2.beta.3 lib/nimbu-api/endpoints/collections.rb
nimbu-api-0.2.beta.2 lib/nimbu-api/endpoints/collections.rb