Method: Contentful::Management::Resource::ClassMethods#create

Defined in:
lib/contentful/management/resource.rb

#create(client, space_id, environment_id = nil, attributes = {}) ⇒ Contentful::Management::Resource

Creates a resource.

Parameters:

Returns:

See Also:

  • README for full attribute list for each resource.


259
260
261
262
263
264
265
266
# File 'lib/contentful/management/resource.rb', line 259

def create(client, space_id, environment_id = nil, attributes = {})
  endpoint_options = { space_id: space_id, environment_id: environment_id }
  endpoint_options[:resource_id] = attributes[:id] if attributes.respond_to?(:key) && attributes.key?(:id)
  ResourceRequester.new(client, self).create(
    endpoint_options,
    attributes
  )
end