Module: FreshdeskAPI::Create::ClassMethods
- Defined in:
- lib/freshdesk_api/actions.rb
Instance Method Summary collapse
-
#create(client, attributes = {}, &block) ⇒ Object
Create a resource, 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
Create a resource, returning nil if it fails
99 100 101 102 103 |
# File 'lib/freshdesk_api/actions.rb', line 99 def create(client, attributes = {}, &block) create!(client, attributes, &block) rescue FreshdeskAPI::Error::ClientError nil end |
#create!(client, attributes = {}, &block) ⇒ Object
Create a resource given the attributes passed in.
89 90 91 92 93 94 95 96 |
# File 'lib/freshdesk_api/actions.rb', line 89 def create!(client, attributes = {}, &block) response = nil new(client, attributes).tap do |resource| response = resource.save!(&block) end response end |