-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathhyperclient.rb
More file actions
29 lines (26 loc) · 835 Bytes
/
hyperclient.rb
File metadata and controls
29 lines (26 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'hyperclient/collection'
require 'hyperclient/link'
require 'hyperclient/attributes'
require 'hyperclient/curie'
require 'hyperclient/entry_point'
require 'hyperclient/link_collection'
require 'hyperclient/resource'
require 'hyperclient/resource_collection'
require 'hyperclient/version'
require 'hyperclient/railtie' if defined?(Rails)
# Public: Hyperclient namespace.
#
module Hyperclient
URL_TO_ENDPOINT_MAPPING = { }
# Public: Convenience method to create new EntryPoints.
#
# url - A String with the url of the API.
#
# Returns a Hyperclient::EntryPoint
def self.new(url, &block)
URL_TO_ENDPOINT_MAPPING[url] = Hyperclient::EntryPoint.new(url, &block)
end
def self.lookup_entry_point(uri)
URL_TO_ENDPOINT_MAPPING[uri] || raise(ArgumentError, "Entry point not registered for #{uri}")
end
end