Module: Stir::Endpoints

Included in:
RestClient
Defined in:
lib/stir/rest/endpoints.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/stir/rest/endpoints.rb', line 4

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#routes(name, *args) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/stir/rest/endpoints.rb', line 8

def routes(name, *args)
  endpoints = self.class.send(:endpoints)
  endpoint = nil
  endpoints.each {|x| endpoint = x[name.to_sym] if x[name.to_sym]}
  return nil if endpoint.nil?
  base_uri + endpoint.interpolate(args.first)
end