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.
240 241 242 |
# File 'lib/smplkit/management/client.rb', line 240 def initialize(api_client) @api = SmplkitGeneratedClient::App::ContextTypesApi.new(api_client) end |
Instance Method Details
#_create_context_type(ct) ⇒ Object
263 264 265 266 |
# File 'lib/smplkit/management/client.rb', line 263 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
268 269 270 271 |
# File 'lib/smplkit/management/client.rb', line 268 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
254 255 256 257 |
# File 'lib/smplkit/management/client.rb', line 254 def delete(key) ErrorMapping.call { @api.delete_context_type(key) } true end |
#get(key) ⇒ Object
249 250 251 252 |
# File 'lib/smplkit/management/client.rb', line 249 def get(key) response = ErrorMapping.call { @api.get_context_type(key) } from_resource(ResourceShim.from_model(response.data)) end |
#list ⇒ Object
244 245 246 247 |
# File 'lib/smplkit/management/client.rb', line 244 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
259 260 261 |
# File 'lib/smplkit/management/client.rb', line 259 def new_context_type(key, name: nil, description: nil) Management::ContextType.new(self, key: key, name: name, description: description) end |