Module: ZendeskAPI::Create::ClassMethods
- Defined in:
- lib/zendesk_api/actions.rb
Instance Method Summary collapse
-
#create(client, attributes = {}, &block) ⇒ Object
Creates, returning nil if it fails.
-
#create!(client, attributes = {}, &block) ⇒ Object
Create a resource given the attributes passed in.
Instance Method Details
#create(client, attributes = {}, &block) ⇒ Object
Creates, returning nil if it fails
160 161 162 163 164 |
# File 'lib/zendesk_api/actions.rb', line 160 def create(client, attributes = {}, &block) create!(client, attributes, &block) rescue ZendeskAPI::Error::ClientError nil end |
#create!(client, attributes = {}, &block) ⇒ Object
Create a resource given the attributes passed in.
149 150 151 152 153 154 155 |
# File 'lib/zendesk_api/actions.rb', line 149 def create!(client, attributes = {}, &block) ZendeskAPI::Client.check_deprecated_namespace_usage attributes, singular_resource_name new(client, attributes).tap do |resource| resource.save!(&block) end end |