Class: Adhearsion::VoIP::DSL::DialingDSL::ProviderDefinition

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/adhearsion/voip/dsl/dialing_dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ProviderDefinition

Returns a new instance of ProviderDefinition.



51
52
53
54
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 51

def initialize(name)
  super()
  self.name = name.to_s.to_sym
end

Instance Method Details

#>>(other) ⇒ Object



56
57
58
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 56

def >>(other)
  RouteRule.new :providers => [self, other]
end

#defined_properties_without_nameObject



78
79
80
81
82
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 78

def defined_properties_without_name
  @table.clone.tap do |copy|
    copy.delete :name
  end
end

#format_number_for_platform(number, platform = :asterisk) ⇒ Object



60
61
62
63
64
65
66
67
# File 'lib/adhearsion/voip/dsl/dialing_dsl.rb', line 60

def format_number_for_platform(number, platform=:asterisk)
  case platform
    when :asterisk
      [protocol || "SIP", name || "default", number].join '/'
    else
      raise "Unsupported platform #{platform}!"
  end
end