Skip to content

Instantly share code, notes, and snippets.

View trevrosen's full-sized avatar
🦆
herding bits

Trevor Rosen trevrosen

🦆
herding bits
View GitHub Profile
module WebEx
## Convenience methods
def self.filter_by_session_name(collection, name=nil)
return collection unless name
collection.collect{|session|
session if session['sessionName'].downcase.include?(name)
}.compact
end
## Provides a list of attendees based on meeting ID
get '/list-attendees/:meeting_id' do
w = WebEx::Request.new
attendees = w.lst_meeting_attendee(params[:meeting_id])
if attendees[:response][:result] == "SUCCESS"
@attendees = attendees[:body]
erb :list_attendees, :layout => false
else
LOGGER.warn('Problem obtaining meeting information')
end
# Booting ----
$: << File.join(File.dirname(__FILE__), 'lib')
$: << File.join(File.dirname(__FILE__), 'routes')
$: << File.join(File.dirname(__FILE__), 'helpers')
SINATRA_ROOT = File.expand_path(File.dirname((__FILE__))) unless defined? SINATRA_ROOT
require "rubygems"
require "sinatra"
require 'config/config'
# /Booting ----
ZPROXY_CONFIG = Hash.new
# General config
configure do
gems = %w(activerecord logger hpricot open-uri resolv restclient net/http yaml rexml/document rack-flash mailfactory json net/smtp)
zproxy_libs = %w(submission validator webex)
(gems + zproxy_libs).each do |dependency|
begin
require dependency
$: << File.join(File.dirname(__FILE__), '..')
begin
require "spec"
require "spec/interop/test"
require 'rack/test'
require "proxy"
require "libxml"
Test::Unit::TestCase.send :include, Rack::Test
rescue LoadError => error
# --------------------- POST handler -- processes the form submission -----------------------
post "/post" do
# Instantiate the Submission to get the party started
sub = Submission.new(params,
request.env['HTTP_REFERER'],
request.env['REMOTE_ADDR']
)
debugger
#! /usr/bin/env ruby
require "rubygems"
require "hpricot"
# File to alter and suffix to add
HEADER_FILE = "/path/to/your/file"
suffix = "?time=" + Time.now.strftime('%Y%m%d%H%M%S')
# Use Hpricot to open and parse file as well as to find path