class RouteNGNClient::OutboundEndPointGroup

Public Instance Methods

build_uri_parts(options = {}) click to toggle source
# File lib/routengn_client/models/outbound_end_point_group.rb, line 32
def build_uri_parts(options = {})
  {
    :uri_user_params => self.s_to_h(self.attributes.uri_user_params ? self.attributes.uri_user_params.strip : ''),
    :uri_params => self.s_to_h(self.attributes.uri_params ? self.attributes.uri_params.strip : '')
  }
end
dialcode_regexp() click to toggle source
# File lib/routengn_client/models/outbound_end_point_group.rb, line 28
def dialcode_regexp
  Regexp.new(self.attributes.dialcode_expression) unless self.attributes.dialcode_expression.blank?
end
prioritized_end_points() click to toggle source
# File lib/routengn_client/models/outbound_end_point_group.rb, line 15
def prioritized_end_points
  eps_with_priority = self.end_points.select { |ep| !ep.attributes.priority.nil? }
  eps_with_priority.shuffle!
  eps_without_priority = self.end_points.select { |ep| ep.attributes.priority.nil? }
  eps_without_priority.shuffle!

  eps_with_priority.sort! { |x,y| x.attributes.priority <=> y.attributes.priority }
  eps_without_priority.sort! { |x,y| x.random_priority <=> y.random_priority }

  eps = (eps_with_priority + eps_without_priority)
  self.attributes.max_contact_end_points ? eps[0, self.attributes.max_contact_end_points] : eps
end

Protected Instance Methods

s_to_h(s) click to toggle source
# File lib/routengn_client/models/outbound_end_point_group.rb, line 41
def s_to_h(s)
  h = {}
  m = s.match /^;*(.*);*$/

  h = Hash[m[1].split(';').map! {|p| p.split('=')}] if m[1]

  h
end