module ZendeskAPI::Create::ClassMethods

Public Instance Methods

create(client, attributes = {}, &block) click to toggle source

Creates, returning nil if it fails @param [Client] client The {Client} object to be used @param [Hash] options Any additional GET parameters to be added

# 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) click to toggle source

Create a resource given the attributes passed in. @param [Client] client The {Client} object to be used @param [Hash] attributes The attributes to create.

# 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