class Levelup::Endpoints::Base

The class describing the behavior required of all endpoints.

Private Instance Methods

build_request(request, building_class) click to toggle source

Constructs the specified class out of the supplied hash. If the first parameter is not a hash, simply returns it.

# File lib/levelup/endpoints/base.rb, line 9
def build_request(request, building_class)
  request.is_a?(Hash) ? building_class.new(request) : request
end
endpoint_path(version = Configuration::DEFAULT_API_VERSION) click to toggle source

Builds a path to this endpoint dynamically.

# File lib/levelup/endpoints/base.rb, line 14
def endpoint_path(version = Configuration::DEFAULT_API_VERSION)
  Configuration.api_url(version) + "/#{path}"
end
path() click to toggle source

Determines the name of this endpoint for purposes of building a URL.

# File lib/levelup/endpoints/base.rb, line 19
def path
  raise NotImplementedError,
    'Attempted to access endpoint with undefined path.'
end