Method: LHS::Record::Endpoints::ClassMethods#find_endpoint
- Defined in:
- lib/lhs/concerns/record/endpoints.rb
#find_endpoint(params = {}, url = nil) ⇒ Object
Find an endpoint based on the provided parameters. If no parameters are provided it finds the base endpoint otherwise it finds the endpoint that matches the parameters best.
39 40 41 42 43 44 45 |
# File 'lib/lhs/concerns/record/endpoints.rb', line 39 def find_endpoint(params = {}, url = nil) endpoint = find_best_endpoint(params) if params && params.keys.count > 0 endpoint ||= find_endpoint_by_url(url) if url.present? endpoint ||= LHC::Endpoint.new(url) if url.present? endpoint ||= find_base_endpoint endpoint end |