Module: ZendeskAPI::Create::ClassMethods
- Includes:
- Rescue
- Defined in:
- lib/zendesk_api/actions.rb
Instance Method Summary collapse
-
#create(client, attributes = {}) ⇒ Object
Create a resource given the attributes passed in.
- #create!(client, attributes = {}) ⇒ Object
Instance Method Details
#create(client, attributes = {}) ⇒ Object
Create a resource given the attributes passed in.
103 104 105 106 107 108 |
# File 'lib/zendesk_api/actions.rb', line 103 def create(client, attributes = {}) ZendeskAPI::Client.check_deprecated_namespace_usage attributes, singular_resource_name resource = new(client, attributes) return unless resource.save resource end |
#create!(client, attributes = {}) ⇒ Object
110 111 112 113 |
# File 'lib/zendesk_api/actions.rb', line 110 def create!(client, attributes={}) c = create(client, attributes) c || raise("Create failed #{self} #{attributes}") end |