Module: DiandianOAuth::API::Interface::ClassMethods
- Defined in:
- lib/diandian_oauth/api/interface.rb
Instance Method Summary collapse
- #interface(name, interface_class) ⇒ Object
- #interfaces ⇒ Object
- #url_for(path, options = {}) ⇒ Object
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 |
#interfaces ⇒ Object
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, = {} protocol = [:protocol] || "https" version = [:version] || API::VERSION host = [:host] || API::HOST path = if [:no_version] then path else "/#{version}#{path}" end "#{protocol}://#{host}#{path}" end |