lib/runcible/resources/consumer.rb in runcible-0.4.12 vs lib/runcible/resources/consumer.rb in runcible-1.0.0

- old
+ new

@@ -38,137 +38,137 @@ # Creates a consumer # # @param [String] id the ID of the consumer # @param [Hash] optional container for all optional parameters # @return [RestClient::Response] - def self.create(id, optional={}) + def create(id, optional={}) required = required_params(binding.send(:local_variables), binding) call(:post, path, :payload => { :required => required, :optional => optional }) end # Retrieves a consumer # # @param [String] id the ID of the consumer # @return [RestClient::Response] - def self.retrieve(id) + def retrieve(id) call(:get, path(id)) end # Updates a consumer # # @param [String] id the ID of the consumer # @param [Hash] optional container for all optional parameters # @return [RestClient::Response] - def self.update(id, optional={}) + def update(id, optional={}) call(:put, path(id), :payload => { :delta => optional }) end # Deletes a consumer # # @param [String] id the id of the consumer # @return [RestClient::Response] - def self.delete(id) + def delete(id) call(:delete, path(id)) end # Create consumer profile # # @param [String] id the ID of the consumer # @param [String] content_type the content type # @param [Hash] profile hash representing the consumer profile # @return [RestClient::Response] - def self.upload_profile(id, content_type, profile) + def upload_profile(id, content_type, profile) required = required_params(binding.send(:local_variables), binding, ["id"]) call(:post, path("#{id}/profiles/"), :payload => { :required => required }) end # Retrieve a consumer profile # # @param [String] id the ID of the consumer # @param [String] content_type the content type # @return [RestClient::Response] - def self.retrieve_profile(id, content_type) + def retrieve_profile(id, content_type) call(:get, path("#{id}/profiles/#{content_type}/")) end # Retrieve a consumer binding # # @param [String] id the ID of the consumer # @param [String] repo_id the ID of the repository # @param [String] distributor_id the ID of the distributor # @return [RestClient::Response] - def self.retrieve_binding(id, repo_id, distributor_id) + def retrieve_binding(id, repo_id, distributor_id) call(:get, path("#{id}/bindings/#{repo_id}/#{distributor_id}")) end # Retrieve all consumer bindings # # @param [String] id the ID of the consumer # @return [RestClient::Response] - def self.retrieve_bindings(id) + def retrieve_bindings(id) call(:get, path("#{id}/bindings/")) end # Bind a consumer to a repository for a given distributor # # @param [String] id the ID of the consumer # @param [String] repo_id the ID of the repository # @param [String] distributor_id the ID of the distributor # @param [Hash] optional optional parameters # @return [RestClient::Response] - def self.bind(id, repo_id, distributor_id, optional={}) + def bind(id, repo_id, distributor_id, optional={}) required = required_params(binding.send(:local_variables), binding, ["id"]) call(:post, path("#{id}/bindings/"), :payload => { :required => required, :optional=>optional }) end # Unbind a consumer to a repository for a given distributor # # @param [String] id the ID of the consumer # @param [String] repo_id the ID of the repository # @param [String] distributor_id the ID of the distributor # @return [RestClient::Response] - def self.unbind(id, repo_id, distributor_id) + def unbind(id, repo_id, distributor_id) call(:delete, path("#{id}/bindings/#{repo_id}/#{distributor_id}")) end # Install a set of units onto a consumer # # @param [String] id the ID of the consumer # @param [Array] units array of units to install # @param [Hash] options hash of install options # @return [RestClient::Response] - def self.install_units(id, units, options={}) + def install_units(id, units, options={}) required = required_params(binding.send(:local_variables), binding, ["id"]) call(:post, path("#{id}/actions/content/install/"), :payload => { :required => required }) end # Update a set of units on a consumer # # @param [String] id the ID of the consumer # @param [Array] units array of units to update # @param [Hash] options hash of update options # @return [RestClient::Response] - def self.update_units(id, units, options={}) + def update_units(id, units, options={}) required = required_params(binding.send(:local_variables), binding, ["id"]) call(:post, path("#{id}/actions/content/update/"), :payload => { :required => required }) end # Uninstall a set of units from a consumer # # @param [String] id the ID of the consumer # @param [Array] units array of units to uninstall # @param [Hash] options hash of uninstall options # @return [RestClient::Response] - def self.uninstall_units(id, units, options={}) + def uninstall_units(id, units, options={}) required = required_params(binding.send(:local_variables), binding, ["id"]) call(:post, path("#{id}/actions/content/uninstall/"), :payload => { :required => required }) end # Determine if a set of content is applicable to a consumer # # @param [Hash] options hash of uninstall options # @return [RestClient::Response] - def self.applicability(options={}) + def applicability(options={}) call(:post, path("actions/content/applicability/"), :payload => { :required => options }) end end end