Class: K8y::Client::APIs
- Inherits:
-
Object
- Object
- K8y::Client::APIs
- Includes:
- Enumerable
- Defined in:
- lib/k8y/client/apis.rb
Instance Method Summary collapse
- #apis_for_method(method) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(group_versions:) ⇒ APIs
constructor
A new instance of APIs.
Constructor Details
#initialize(group_versions:) ⇒ APIs
Returns a new instance of APIs.
9 10 11 12 13 14 15 |
# File 'lib/k8y/client/apis.rb', line 9 def initialize(group_versions:) @apis = group_versions.each_with_object({}) do |gv, acc| api = API.new(group_version: gv) acc[gv.to_s] = api define_singleton_method(gv.to_method_name) { api } end end |
Instance Method Details
#apis_for_method(method) ⇒ Object
21 22 23 |
# File 'lib/k8y/client/apis.rb', line 21 def apis_for_method(method) select { |api| api.has_api_method?(method) } end |
#each(&block) ⇒ Object
17 18 19 |
# File 'lib/k8y/client/apis.rb', line 17 def each(&block) apis.each { |_, api| yield(api) } end |