Class: K8y::Client::API
- Inherits:
-
Object
- Object
- K8y::Client::API
- Extended by:
- Forwardable
- Defined in:
- lib/k8y/client/api.rb
Instance Attribute Summary collapse
-
#group_version ⇒ Object
readonly
Returns the value of attribute group_version.
Instance Method Summary collapse
- #discovered? ⇒ Boolean
- #has_api_method?(method) ⇒ Boolean
-
#initialize(group_version:) ⇒ API
constructor
A new instance of API.
-
#path ⇒ Object
Core/v1 resources are in ‘/api/#version`.
Constructor Details
#initialize(group_version:) ⇒ API
Returns a new instance of API.
14 15 16 17 18 |
# File 'lib/k8y/client/api.rb', line 14 def initialize(group_version:) @group_version = group_version @discovered = false @api_methods = {} end |
Instance Attribute Details
#group_version ⇒ Object (readonly)
Returns the value of attribute group_version.
10 11 12 |
# File 'lib/k8y/client/api.rb', line 10 def group_version @group_version end |
Instance Method Details
#discovered? ⇒ Boolean
20 21 22 |
# File 'lib/k8y/client/api.rb', line 20 def discovered? discovered end |
#has_api_method?(method) ⇒ Boolean
24 25 26 |
# File 'lib/k8y/client/api.rb', line 24 def has_api_method?(method) api_methods.dig(method) end |
#path ⇒ Object
Core/v1 resources are in ‘/api/#version`. In general, all other resources are found in `/apis/GROUP/VERSION`
29 30 31 32 33 34 35 |
# File 'lib/k8y/client/api.rb', line 29 def path @path ||= if group == "core" "/api/#{version}" else "/apis/#{group}/#{version}" end end |