Sha256: 48dc8ce5d356fbaf1093fa858edd35c4f4717f90fb50f86e6b03b6fbb910f0dc

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

require 'ticketmaster'
module TicketMaster::Provider
  # This is the Zendesk Provider for ticketmaster
  module Zendesk
    include TicketMaster::Provider::Base
    #PROJECT_API = ZendeskAPI::Organization
    
    # This is for cases when you want to instantiate using TicketMaster::Provider::Yoursystem.new(auth)
    def self.new(auth = {})
      TicketMaster.new(:zendesk, auth)
    end
    
    # The authorize and initializer for this provider
    def authorize(auth = {})
      @authentication ||= TicketMaster::Authenticator.new(auth)
      auth = @authentication
      if (auth.account.nil? and auth.username.nil? and auth.password.nil?)
        raise "Please provide at least an url (subdomain), username and password)"
      end
      ZendeskAPI.authenticate(auth.account, auth.username, auth.password)
    end

    def projects(*options)
      [Project.new({:account => @authentication.account, :username => @authentication.username, :name => "#{@authentication.account}-project"})]
    end

    def project(*options)
      unless options.empty?
        Project.new({:account => @authentication.account, :username => @authentication.username, :name => "#{@authentication.account}-project"})
      else
        TicketMaster::Provider::Zendesk::Project
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ticketmaster-zendesk-0.2.3 lib/provider/zendesk.rb
ticketmaster-zendesk-0.2.2 lib/provider/zendesk.rb
ticketmaster-zendesk-0.1.2 lib/provider/zendesk.rb
ticketmaster-zendesk-0.0.2 lib/provider/zendesk.rb
ticketmaster-zendesk-0.0.1 lib/provider/zendesk.rb