require 'helix_web_services_client/open_model' class HelixWebServicesClient # Array of Client objects stored in the system. Not all fields will be # filled out (e.g., view). def clients arr = execute_method_no_body(:get, hve_path('clients')) arr.map { |a| OpenModel.new(a) } end # Returns the client instance indicated by the client name or model def client(client) client = OpenModel.new(client).client unless client.is_a?(String) obj = execute_method_no_body(:get, hve_path("clients/#{URI.encode(client)}")) OpenModel.new(obj) end # Creates a new client in the system. def create_client(client) client = OpenModel.new(client) unless client.is_a?(OpenModel) execute_method_with_body(:post, hve_path('clients'), client.marshal_dump) true end # Updates the client specification. def update_client(client) client = OpenModel.new(client) unless client.is_a?(OpenModel) execute_method_with_body(:patch, hve_path("clients/#{URI.encode(client.client)}"), client.marshal_dump) true end # Deletes the client specification in the system. def delete_client(client) client = OpenModel.new(client).client unless client.is_a?(String) execute_method_no_body(:delete, hve_path("clients/#{URI.encode(client)}")) true end end