require 'open-uri' require 'helix_web_services_client/open_model' class HelixWebServicesClient # Array of Depot objects stored in the system. Not all fields will be # filled out (e.g., view). def depots arr = execute_method_no_body(:get, hve_path('depots')) arr.map { |a| OpenModel.new(a) } end # Returns the depot instance indicated by the depot name (or depot object) def depot(depot) depot = depot.depot if depot.is_a?(OpenModel) obj = execute_method_no_body(:get, hve_path("depots/#{URI.encode(depot)}")) OpenModel.new(obj) end # Creates a new depot in the system. def create_depot(depot) depot = OpenModel.new(depot) unless depot.is_a?(OpenModel) execute_method_with_body(:post, hve_path('depots'), depot.marshal_dump) end # Updates the depot specification. def update_depot(depot) depot = OpenModel.new(depot) unless depot.is_a?(OpenModel) execute_method_with_body(:patch, hve_path("depots/#{URI.encode(depot.depot)}"), depot.marshal_dump) end # Deletes the depot specification in the system. def delete_depot(depot) depot = depot.depot if depot.is_a?(OpenModel) execute_method_no_body(:delete, hve_path("depots/#{URI.encode(depot)}")) end end