Class: Smplkit::ManagementClient::ContextTypesNamespace
- Inherits:
-
Object
- Object
- Smplkit::ManagementClient::ContextTypesNamespace
- Includes:
- HttpHelpers
- 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(http) ⇒ ContextTypesNamespace
constructor
A new instance of ContextTypesNamespace.
- #list ⇒ Object
- #new_context_type(key, name: nil, description: nil) ⇒ Object
Constructor Details
#initialize(http) ⇒ ContextTypesNamespace
Returns a new instance of ContextTypesNamespace.
208 209 210 |
# File 'lib/smplkit/management/client.rb', line 208 def initialize(http) @http = http end |
Instance Method Details
#_create_context_type(ct) ⇒ Object
230 231 232 233 |
# File 'lib/smplkit/management/client.rb', line 230 def _create_context_type(ct) resp = http_post("/api/v1/context_types", body_for(ct)) from_resource(resp["data"]) end |
#_update_context_type(ct) ⇒ Object
235 236 237 238 |
# File 'lib/smplkit/management/client.rb', line 235 def _update_context_type(ct) resp = http_put("/api/v1/context_types/#{ct.key}", body_for(ct)) from_resource(resp["data"]) end |
#delete(key) ⇒ Object
222 223 224 |
# File 'lib/smplkit/management/client.rb', line 222 def delete(key) http_delete("/api/v1/context_types/#{key}") end |
#get(key) ⇒ Object
217 218 219 220 |
# File 'lib/smplkit/management/client.rb', line 217 def get(key) resp = http_get("/api/v1/context_types/#{key}") from_resource(resp["data"]) end |
#list ⇒ Object
212 213 214 215 |
# File 'lib/smplkit/management/client.rb', line 212 def list list_resp = http_list("/api/v1/context_types") list_resp.map { |r| from_resource(r) } end |
#new_context_type(key, name: nil, description: nil) ⇒ Object
226 227 228 |
# File 'lib/smplkit/management/client.rb', line 226 def new_context_type(key, name: nil, description: nil) Management::ContextType.new(self, key: key, name: name, description: description) end |