Sha256: 8f51e35fe4773e9e7134d49f01b015bc7ada45e15dd289afd1da3827e4dfb879

Contents?: true

Size: 947 Bytes

Versions: 35

Compression:

Stored size: 947 Bytes

Contents

# RootTenancyUrl will lookup configuration hash and

# TODO: Write Tests (PN)
module IuguSDK
  class RootTenancyUrl

    # +matches?+ will check a request.host against a set of invalid urls
    #
    # * *Args*:
    #   - +request+ -> An ActionDispatch::Request object
    # * *Success*
    #   - Return true if request.host is found in the invalid array
    # * *False*
    #   - Return true if request.host is not found in the invalid array
    def self.matches?(request)
      application_domain = IuguSDK::application_main_host
      application_domain = application_domain.gsub('.dev','')
      valids = [ application_domain, ['www.',application_domain].join, 'localhost' ]
      normalized_host = request.host.gsub('.dev','')
      unless Rails.env.production?
        return true if normalized_host.match("#{application_domain}\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.xip.io")
      end
      valids.include?( normalized_host )
    end

  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
iugusdk-1.0.11 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.10 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.9 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.8 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.7 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.6 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.5 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.4 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.3 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.2 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.1 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.32 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.31 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.30 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.29 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.28 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.27 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.26 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.25 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.24 lib/iugusdk/root_tenancy_url.rb