Module: ZendeskAPI::Create::ClassMethods
- Defined in:
- lib/zendesk_api/actions.rb
Instance Method Summary (collapse)
-
- (Object) create(client, attributes = {})
Create a resource given the attributes passed in.
-
- (Object) create!(client, attributes = {})
Creates the resource, raising an ArgumentError if it fails.
Instance Method Details
- (Object) create(client, attributes = {})
Create a resource given the attributes passed in.
116 117 118 119 120 121 |
# File 'lib/zendesk_api/actions.rb', line 116 def create(client, attributes = {}) ZendeskAPI::Client.check_deprecated_namespace_usage attributes, singular_resource_name resource = new(client, attributes) return unless resource.save resource end |
- (Object) create!(client, attributes = {})
Creates the resource, raising an ArgumentError if it fails
125 126 127 128 |
# File 'lib/zendesk_api/actions.rb', line 125 def create!(client, attributes={}) c = create(client, attributes) c || raise("Create failed #{self} #{attributes}") end |