/zendesk_engine

Create tickets using Zendesk API through a ready to use moutable controller

Primary LanguageRubyMIT LicenseMIT

ZendeskEngine Codeship Status for catarse/zendesk_engine Code Climate

Install and configure

Just add to your Gemfile:

gem 'zendesk_engine'

And create an initializer in config/initializers/zendesk_engine.rb with your Zendesk credentials:

ZendeskEngine.configure do |config|
  config.url   = 'https://foocompany.zendesk.com/api/v2'
  config.user  = 'myzendeskagent@foocompany.com'
  config.token = 'my zendesk token found in API config'
end

Mount the routes

Add to your config/routes.rb:

MyApplication::Application.routes.draw do
  mount ZendeskEngine::Engine => "/"
end

This will add the /tickets resources route to the path you've chosen as mouting point ("/" in the example above).

Make requests

After this you can post tickets to /tickets and they will be relayed to the Zendesk API via the zendesk_api gem ;) The parameters to ticket creation should be:

{
  user: {
    email: 'foo@bar.com',
    name: 'Foo Bar'
  },
  ticket: {
    subject: 'Awesome ticket',
    comment: {value: 'This is a ticket just to show a cool example'},
    priority: 'urgent'
  }
}

The response will be a json with the created ticket.

This project rocks and uses MIT-LICENSE.