Sha256: bd94dc60dcc72f98a2c1490031e94ecc8e4df1b845a8ee83114d271e1b2bfa29

Contents?: true

Size: 900 Bytes

Versions: 11

Compression:

Stored size: 900 Bytes

Contents

module Runcible
  module Resources
    # @see https://pulp-dev-guide.readthedocs.org/en/latest/rest-api/content/index.html
    class Unit < Runcible::Base
      # Generates the API path for Units
      #
      # @param  [String]  type  the unit type
      # @return [String]        the unit search path
      def path(type)
        "content/units/#{type}/search/"
      end

      # Searches a given unit type based on criteria
      #
      # @param  [String]                type      the unit type
      # @param  [Hash]                  criteria  criteria object containing Mongo syntax
      # @param  [Hash]                  optional  container for all optional parameters
      # @return [RestClient::Response]
      def search(type, criteria, optional = {})
        call(:post, path(type), :payload => {:required => {:criteria => criteria}, :optional => optional})
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
runcible-1.9.2 lib/runcible/resources/unit.rb
runcible-1.9.1 lib/runcible/resources/unit.rb
runcible-1.9.0 lib/runcible/resources/unit.rb
runcible-1.8.0 lib/runcible/resources/unit.rb
runcible-1.7.2 lib/runcible/resources/unit.rb
runcible-1.7.1 lib/runcible/resources/unit.rb
runcible-1.7.0 lib/runcible/resources/unit.rb
runcible-1.6.0 lib/runcible/resources/unit.rb
runcible-1.5.1 lib/runcible/resources/unit.rb
runcible-1.5.0 lib/runcible/resources/unit.rb
runcible-1.4.0 lib/runcible/resources/unit.rb