require 'open-uri' require 'helix_web_services_client/open_model' class HelixWebServicesClient # Returns an array of Stream objects representing people in the system. def streams arr = execute_method_no_body(:get, hve_path('streams')) arr.map { |obj| OpenModel.new(obj) } end # Fetch single stream details # # @return An OpenModel wrapper around the stream data def stream(stream) stream = stream.stream if stream.is_a?(OpenModel) obj = execute_method_no_body(:get, hve_path("streams/#{URI.encode(stream)}")) OpenModel.new(obj) end # Creates a new stream in the system based on the Stream instance def create_stream(stream) stream = OpenModel.new(stream) unless stream.is_a?(OpenModel) execute_method_with_body(:post, hve_path('streams'), stream.marshal_dump) end def update_stream(stream) stream = OpenModel.new(stream) unless stream.is_a?(OpenModel) execute_method_with_body(:patch, hve_path("streams/#{URI.encode(stream.stream)}"), stream.marshal_dump) end def delete_stream(stream) stream = stream.stream if stream.is_a?(OpenModel) execute_method_no_body(:delete, hve_path("streams/#{URI.encode(stream)}")) end end