Class: Smplkit::ManagementClient::ContextTypesNamespace

Inherits:
Object
  • Object
show all
Includes:
HttpHelpers
Defined in:
lib/smplkit/management/client.rb

Instance Method Summary collapse

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/context_types/v1", 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/context_types/v1/#{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/context_types/v1/#{key}")
end

#get(key) ⇒ Object



217
218
219
220
# File 'lib/smplkit/management/client.rb', line 217

def get(key)
  resp = http_get("/api/context_types/v1/#{key}")
  from_resource(resp["data"])
end

#listObject



212
213
214
215
# File 'lib/smplkit/management/client.rb', line 212

def list
  list_resp = http_list("/api/context_types/v1")
  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