Class: TokenEndpoint::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/token_endpoint/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Client

Returns a new instance of Client.



3
4
5
6
7
8
9
# File 'lib/token_endpoint/client.rb', line 3

def initialize(url)
  raise ArgumentError, "url must be a String (given #{url.class.name})" unless url.is_a?(String)

  @uri = Addressable::URI.parse(url)
rescue Addressable::URI::InvalidURIError => error
  raise InvalidURIError, error
end

Instance Method Details

#endpointObject



11
12
13
# File 'lib/token_endpoint/client.rb', line 11

def endpoint
  @endpoint ||= Discover.new(response).endpoint
end

#responseObject



15
16
17
# File 'lib/token_endpoint/client.rb', line 15

def response
  @response ||= Response.new(@uri).response
end