Skip to content

Instantly share code, notes, and snippets.

@libryder
Created February 20, 2012 05:12
Show Gist options
  • Select an option

  • Save libryder/1867954 to your computer and use it in GitHub Desktop.

Select an option

Save libryder/1867954 to your computer and use it in GitHub Desktop.
class CallFlow < ActiveRecord::Base
belongs_to :routable, :polymorphic => true
#validates_presence_of :dnis
#validates_uniqueness_of :dnis
def dialplan
puts self.routable.description.squeeze("\n").strip
end
def target_route=(params)
self.routable = params[:kind].constantize.new(params.reject {|k,v| k == "kind"})
end
end
class GeoOption < ActiveRecord::Base
belongs_to :route_by_geography
belongs_to :target_routable, :polymorphic => true
geocoded_by :full_street_address
reverse_geocoded_by :latitude, :longitude
def target_route=(params)
self.target_routable = params[:kind].constantize.new(params.reject {|k,v| k == "kind"})
end
end
class RouteByGeography < ActiveRecord::Base
has_many :call_flows, :as => :routable
has_many :geo_options
accepts_nested_attributes_for :geo_options
def options
self.geo_options
end
def description
options.map {|o| "\nGEO: If value is #{o.value}, target DID #{o.target_did || 'n/a'}, target route: #{o.target_routable.try(:description) || 'n/a'}" }.join("\n")
end
end
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120127222330) do
create_table "call_flows", :force => true do |t|
t.string "dnis"
t.string "default_ringto_did"
t.integer "zoho_id"
t.integer "ouid"
t.string "routable_type"
t.integer "routable_id"
t.integer "repeat_greeting_on_invalid", :default => 0
t.string "caller_to_sms"
t.string "email_to_notify"
t.string "play_disclaimer", :default => "before"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "is_outbound"
t.string "country_code", :limit => 10, :default => "1"
end
create_table "call_logs", :force => true do |t|
t.string "dnis"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "canada_posts", :force => true do |t|
t.string "post_code"
t.string "location"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "canada_posts", ["post_code"], :name => "post_code", :unique => true
create_table "geo_options", :force => true do |t|
t.integer "route_by_geography_id"
t.integer "organizational_unit_id"
t.float "latitude"
t.float "longitude"
t.string "target_did"
t.string "target_routable_type"
t.integer "target_routable_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "address"
end
create_table "global_configurations", :force => true do |t|
t.string "file_extension"
t.string "recorording_path"
t.string "transcoder_path"
t.string "main_trunk"
t.string "fail_over_trunk"
t.string "system_move_FQN"
t.integer "read_timeout"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "google_analytics", :force => true do |t|
t.integer "ouid"
t.string "postback"
t.integer "enabled"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "hunt_filenames", :force => true do |t|
t.string "timestamp"
t.string "dnis"
t.string "filename"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "hunt_members", :force => true do |t|
t.string "uniqueid"
t.integer "hunt_id"
t.integer "ouid"
t.string "membername"
t.string "queue_name"
t.string "interface"
t.integer "penalty"
t.integer "paused"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "huntgroup_options", :force => true do |t|
t.integer "ouid"
t.string "type"
t.integer "penalty"
t.integer "route_by_huntgroup_id"
t.integer "sequence"
t.string "target_did"
t.string "target_routable_type"
t.integer "target_routable_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "hunts", :force => true do |t|
t.string "name"
t.string "dnis"
t.string "musiconhold"
t.string "announce"
t.string "context"
t.integer "timeout"
t.integer "monitor_join"
t.string "monitor_format"
t.string "queue_youarenext"
t.string "queue_thereare"
t.string "queue_callswaiting"
t.string "queue_holdtime"
t.string "queue_minutes"
t.string "queue_seconds"
t.string "queue_lessthan"
t.string "queue_thankyou"
t.string "queue_reporthold"
t.integer "announce_frequency"
t.integer "announce_round_seconds"
t.string "announce_holdtime"
t.integer "retry"
t.integer "wrapuptime"
t.integer "maxlen"
t.integer "servicelevel"
t.string "strategy"
t.string "joinempty"
t.string "leavewhenempty"
t.integer "eventmemberstatus"
t.integer "eventwhencalled"
t.integer "reportholdtime"
t.integer "memberdelay"
t.integer "weight"
t.integer "ringinuse"
t.integer "setinterfacevar"
t.string "autofill"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "inbound_logs", :force => true do |t|
t.string "dnis"
t.string "text"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "ivr_options", :force => true do |t|
t.integer "ouid"
t.integer "route_by_ivr_id"
t.string "value"
t.string "target_did"
t.string "target_routable_type"
t.integer "target_routable_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "mentor_provisioned_routes", :force => true do |t|
t.string "dnis", :null => false
t.string "ring_to_number", :null => false
t.integer "company_id", :null => false
t.integer "group_id", :null => false
t.integer "active", :null => false
t.string "name", :null => false
t.integer "play_disclaimer", :null => false
t.string "recording_name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "message_options", :force => true do |t|
t.integer "route_by_message_id"
t.string "message"
t.string "target_did"
t.string "target_routable_type"
t.integer "target_routable_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "outbound_logs", :force => true do |t|
t.string "dnis"
t.string "text"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "products", :force => true do |t|
t.string "dnis", :null => false
t.string "ring_to_number", :null => false
t.integer "company_id", :null => false
t.integer "group_id", :null => false
t.string "name", :null => false
t.integer "play_disclaimer", :null => false
t.string "recording_name", :null => false
end
create_table "route_by_geographies", :force => true do |t|
t.integer "radius", :default => 25
t.integer "play_branding", :default => 1
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "route_by_huntgroups", :force => true do |t|
t.string "process"
t.string "last_sequence"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "route_by_ivrs", :force => true do |t|
t.integer "repeat_greeting"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "route_by_messages", :force => true do |t|
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "route_by_outbounds", :force => true do |t|
t.integer "pin"
t.string "callerid", :limit => 25
t.integer "play_disclaimer"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "play_prompt"
end
create_table "route_by_schedules", :force => true do |t|
t.string "timezone"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "schedule_options", :force => true do |t|
t.integer "route_by_schedule_id"
t.integer "day"
t.string "from_time"
t.string "to_time"
t.string "target_did"
t.string "target_routable_type"
t.integer "target_routable_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "test_calls", :force => true do |t|
t.string "dnis"
t.string "next_run"
t.string "result"
t.datetime "created_at"
t.datetime "updated_at"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment