class RouteNGNClient::AllowList
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
RouteNGNClient::Model::new
# File lib/routengn_client/models/allow_list.rb, line 6 def initialize(attributes = {}) super attributes @attributes.uri_matchers = (@attributes.uri_matchers || []).collect { |h| RouteNGNClient::URIMatcher.from_hash h } self.order_uri_matchers! end
Public Instance Methods
best_uri_match(header, uri)
click to toggle source
# File lib/routengn_client/models/allow_list.rb, line 17 def best_uri_match(header, uri) return nil unless header && uri && @attributes.uri_matchers.find { |uri_matcher| uri_matcher.matches_header? header } prefix = uri.user.prefix(self.inbound_end_point_group.dialcode_prefix_regexp) unless uri.user.blank? user_params = uri.user.params.collect { |k,v| "#{k}=#{v}" } unless uri.user.params.blank? uri_params = uri.params.collect { |k,v| "#{k}=#{v}" } unless uri.params.blank? h = {}.with_indifferent_access h[:header] = header h[:prefix] = prefix unless prefix.blank? h[:user_params] = user_params unless user_params.blank? h[:uri_params] = uri_params unless uri_params.blank? @attributes.uri_matchers.each do |uri_matcher| return uri_matcher if uri_matcher.matches? h end nil end
order_uri_matchers!()
click to toggle source
# File lib/routengn_client/models/allow_list.rb, line 13 def order_uri_matchers! @attributes.uri_matchers.sort! end