Module: DiandianOAuth::API::Interface::ClassMethods

Defined in:
lib/diandian_oauth/api/interface.rb

Instance Method Summary collapse

Instance Method Details

#interface(name, interface_class) ⇒ Object



17
18
19
# File 'lib/diandian_oauth/api/interface.rb', line 17

def interface name, interface_class
  self.interfaces[name.to_sym] = interface_class.new
end

#interfacesObject



21
22
23
# File 'lib/diandian_oauth/api/interface.rb', line 21

def interfaces
  @interfaces ||= {}
end

#url_for(path, options = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/diandian_oauth/api/interface.rb', line 9

def url_for path, options = {}
  protocol = options[:protocol] || "https"
  version = options[:version] || API::VERSION
  host = options[:host] || API::HOST
  path = if options[:no_version] then path else "/#{version}#{path}" end
  "#{protocol}://#{host}#{path}"
end