Class: Smplkit::ManagementClient::ContextTypesNamespace
- Inherits:
-
Object
- Object
- Smplkit::ManagementClient::ContextTypesNamespace
- Defined in:
- lib/smplkit/management/client.rb
Instance Method Summary collapse
- #_create_context_type(ct) ⇒ Object
- #_update_context_type(ct) ⇒ Object
- #delete(key) ⇒ Object
- #get(key) ⇒ Object
-
#initialize(api_client) ⇒ ContextTypesNamespace
constructor
A new instance of ContextTypesNamespace.
- #list ⇒ Object
- #new_context_type(key, name: nil, description: nil) ⇒ Object
Constructor Details
#initialize(api_client) ⇒ ContextTypesNamespace
Returns a new instance of ContextTypesNamespace.
236 237 238 |
# File 'lib/smplkit/management/client.rb', line 236 def initialize(api_client) @api = SmplkitGeneratedClient::App::ContextTypesApi.new(api_client) end |
Instance Method Details
#_create_context_type(ct) ⇒ Object
259 260 261 262 |
# File 'lib/smplkit/management/client.rb', line 259 def _create_context_type(ct) response = ErrorMapping.call { @api.create_context_type(body_for(ct)) } from_resource(ResourceShim.from_model(response.data)) end |
#_update_context_type(ct) ⇒ Object
264 265 266 267 |
# File 'lib/smplkit/management/client.rb', line 264 def _update_context_type(ct) response = ErrorMapping.call { @api.update_context_type(ct.key, body_for(ct)) } from_resource(ResourceShim.from_model(response.data)) end |
#delete(key) ⇒ Object
250 251 252 253 |
# File 'lib/smplkit/management/client.rb', line 250 def delete(key) ErrorMapping.call { @api.delete_context_type(key) } true end |
#get(key) ⇒ Object
245 246 247 248 |
# File 'lib/smplkit/management/client.rb', line 245 def get(key) response = ErrorMapping.call { @api.get_context_type(key) } from_resource(ResourceShim.from_model(response.data)) end |
#list ⇒ Object
240 241 242 243 |
# File 'lib/smplkit/management/client.rb', line 240 def list response = ErrorMapping.call { @api.list_context_types } (response.data || []).map { |r| from_resource(ResourceShim.from_model(r)) } end |
#new_context_type(key, name: nil, description: nil) ⇒ Object
255 256 257 |
# File 'lib/smplkit/management/client.rb', line 255 def new_context_type(key, name: nil, description: nil) Management::ContextType.new(self, key: key, name: name, description: description) end |