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(page_number: nil, page_size: nil) ⇒ Object
- #new_context_type(key, name: nil, description: nil) ⇒ Object
Constructor Details
#initialize(api_client) ⇒ ContextTypesNamespace
Returns a new instance of ContextTypesNamespace.
272 273 274 |
# File 'lib/smplkit/management/client.rb', line 272 def initialize(api_client) @api = SmplkitGeneratedClient::App::ContextTypesApi.new(api_client) end |
Instance Method Details
#_create_context_type(ct) ⇒ Object
298 299 300 301 |
# File 'lib/smplkit/management/client.rb', line 298 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
303 304 305 306 |
# File 'lib/smplkit/management/client.rb', line 303 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
289 290 291 292 |
# File 'lib/smplkit/management/client.rb', line 289 def delete(key) ErrorMapping.call { @api.delete_context_type(key) } true end |
#get(key) ⇒ Object
284 285 286 287 |
# File 'lib/smplkit/management/client.rb', line 284 def get(key) response = ErrorMapping.call { @api.get_context_type(key) } from_resource(ResourceShim.from_model(response.data)) end |
#list(page_number: nil, page_size: nil) ⇒ Object
276 277 278 279 280 281 282 |
# File 'lib/smplkit/management/client.rb', line 276 def list(page_number: nil, page_size: nil) opts = {} opts[:page_number] = page_number unless page_number.nil? opts[:page_size] = page_size unless page_size.nil? response = ErrorMapping.call { @api.list_context_types(opts) } (response.data || []).map { |r| from_resource(ResourceShim.from_model(r)) } end |
#new_context_type(key, name: nil, description: nil) ⇒ Object
294 295 296 |
# File 'lib/smplkit/management/client.rb', line 294 def new_context_type(key, name: nil, description: nil) Management::ContextType.new(self, key: key, name: name, description: description) end |