Class: TelphinApi::Namespace
- Inherits:
-
Object
- Object
- TelphinApi::Namespace
- Includes:
- Resolvable, Resolver
- Defined in:
- lib/telphin_api/namespace.rb
Overview
An API method namespace (such as extensions
or phone_calls
).
It includes Resolvable
and Resolver
and calls API methods via Resolver#call_method
.
It also holds the list of all known namespaces.
Instance Attribute Summary
Attributes included from Resolvable
Class Method Summary collapse
-
.exists?(name) ⇒ Boolean
Does a given namespace exist?.
-
.names ⇒ Array
An array of all method namespaces.
Instance Method Summary collapse
-
#method_missing(*args, &block) ⇒ Object
Creates and calls the
TelphinApi::Method
usingTelphinApi::Resolver#call_method
.
Methods included from Resolver
Methods included from Resolvable
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
Creates and calls the TelphinApi::Method
using TelphinApi::Resolver#call_method
.
11 12 13 |
# File 'lib/telphin_api/namespace.rb', line 11 def method_missing(*args, &block) call_method(args, &block) end |
Class Method Details
.exists?(name) ⇒ Boolean
Does a given namespace exist?
31 32 33 |
# File 'lib/telphin_api/namespace.rb', line 31 def exists?(name) names.include?(name.to_s) end |
.names ⇒ Array
An array of all method namespaces.
Lazily loads the list from namespaces.yml
and caches it.
20 21 22 23 24 25 26 27 |
# File 'lib/telphin_api/namespace.rb', line 20 def names if @names.nil? filename = File.('../namespaces.yml', __FILE__) @names = YAML.load_file(filename) end @names end |