class Namely::Authenticator::URL
Attributes
options[R]
Public Class Methods
new(options)
click to toggle source
# File lib/namely/authenticator.rb, line 163 def initialize(options) @options = options end
Public Instance Methods
to_s()
click to toggle source
# File lib/namely/authenticator.rb, line 167 def to_s "#{protocol}://#{host}#{path}?#{query}" end
Private Instance Methods
host()
click to toggle source
# File lib/namely/authenticator.rb, line 179 def host if options.has_key?(:subdomain) "#{options[:subdomain]}.namely.com" else options.fetch(:host) end end
optional_params()
click to toggle source
# File lib/namely/authenticator.rb, line 201 def optional_params [:redirect_uri, :state].inject({}) do |additional_params, key| if options.has_key?(key) additional_params[key] = options[key] end additional_params end end
params()
click to toggle source
# File lib/namely/authenticator.rb, line 197 def params options.fetch(:params, {}).merge(optional_params) end
path()
click to toggle source
# File lib/namely/authenticator.rb, line 187 def path options.fetch(:path) end
protocol()
click to toggle source
# File lib/namely/authenticator.rb, line 175 def protocol options.fetch(:protocol, "https") end
query()
click to toggle source
# File lib/namely/authenticator.rb, line 191 def query params. map { |key, value| "#{CGI.escape(key.to_s)}=#{CGI.escape(value)}" }. join("&") end