Sha256: 17f134ab0d4abc0193f8c5bcf39d13667c60ae97871d35b8df4add7a37caf74c

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 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
      valids = [ application_domain, ['www.',application_domain].join ]
      unless Rails.env.production?
        first_part_uri = application_domain.gsub('.dev','')
        return true if request.host.match("#{first_part_uri}\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.xip.io")
      end
      valids.include?( request.host )
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.3 lib/iugusdk/root_tenancy_url.rb