Sha256: b7a9765c519ca6f9deff8704bb186baea8fc86f770298c87e774e0d566ad1324

Contents?: true

Size: 1.44 KB

Versions: 24

Compression:

Stored size: 1.44 KB

Contents

module Runcible
  module Resources
    # @see https://docs.pulpproject.org/dev-guide/integration/rest-api/user/index.html
    class User < Runcible::Base
      # Generates the API path for Users
      #
      # @param  [String]  login the user's login
      # @return [String]        the user path, may contain the login if passed
      def self.path(login = nil)
        login.nil? ? 'users/' : "users/#{login}/"
      end

      # Retrieves all users
      #
      # @return [RestClient::Response]
      def retrieve_all
        call(:get, path)
      end

      # Creates a user
      #
      # @param  [String]                login     the login requested for the user
      # @param  [Hash]                  optional  container for all optional parameters
      # @return [RestClient::Response]
      def create(login, optional = {})
        required = required_params(binding.send(:local_variables), binding)
        call(:post, path, :payload => { :required => required, :optional => optional })
      end

      # Retrieves a user
      #
      # @param  [String]                login the login of the user being retrieved
      # @return [RestClient::Response]
      def retrieve(login)
        call(:get, path(login))
      end

      # Deletes a user
      #
      # @param  [String]                login the login of the user being deleted
      # @return [RestClient::Response]
      def delete(login)
        call(:delete, path(login))
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
runcible-2.13.1 lib/runcible/resources/user.rb
runcible-2.13.0 lib/runcible/resources/user.rb
runcible-2.12.1 lib/runcible/resources/user.rb
runcible-2.12.0 lib/runcible/resources/user.rb
runcible-2.11.1 lib/runcible/resources/user.rb
runcible-2.11.0 lib/runcible/resources/user.rb
runcible-2.10.1 lib/runcible/resources/user.rb
runcible-2.10.0 lib/runcible/resources/user.rb
runcible-2.9.0 lib/runcible/resources/user.rb
runcible-2.8.1 lib/runcible/resources/user.rb
runcible-2.8.0 lib/runcible/resources/user.rb
runcible-2.7.0 lib/runcible/resources/user.rb
runcible-2.6.0 lib/runcible/resources/user.rb
runcible-2.5.0 lib/runcible/resources/user.rb
runcible-2.4.0 lib/runcible/resources/user.rb
runcible-2.3.0 lib/runcible/resources/user.rb
runcible-2.2.0 lib/runcible/resources/user.rb
runcible-1.12.0 lib/runcible/resources/user.rb
runcible-2.1.0 lib/runcible/resources/user.rb
runcible-2.0.1 lib/runcible/resources/user.rb