Sha256: 9b08bacf7cedadd9f8dc5b38a5345af3cbd8d4b09eef7d63a72ec34d43e780e1

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

require 'rubygems'
require 'active_support'
require 'active_resource'

module ZendeskAPI
  class Error < StandardError; end

  class << self

    def authenticate(account, username, password)
      @username = username
      @password = password
      self::Base.user = username
      self::Base.password = password
      self::Base.site = "http://#{account}.zendesk.com"
    end

    def resources
      @resources ||= []
    end

  end

  class Base < ActiveResource::Base
    self.format = :json
    def self.inherited(base)
      ZendeskAPI.resources << base
      super
    end
  end

  class Search < Base

    def self.collection_path(prefix_options = {}, query_options = nil) 
      prefix_options, query_options = split_options(prefix_options) if query_options.nil?
      "#{prefix(prefix_options)}search.#{format.extension}#{query_string(query_options)}"
    end

    def self.element_path(id, prefix_options = {}, query_options = nil)
      prefix_options, query_options = split_options(prefix_options) if query_options.nil?
      "#{prefix(prefix_options)}search.#{format.extension}#{query_string(query_options)}"
    end

  end

  class Ticket < Base
  end

  class User < Base
  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
taskmapper-zendesk-0.5.0 lib/zendesk/zendesk-api.rb
ticketmaster-zendesk-0.4.5 lib/zendesk/zendesk-api.rb
ticketmaster-zendesk-0.4.4 lib/zendesk/zendesk-api.rb
ticketmaster-zendesk-0.3.4 lib/zendesk/zendesk-api.rb
ticketmaster-zendesk-0.3.3 lib/zendesk/zendesk-api.rb
ticketmaster-zendesk-0.2.3 lib/zendesk/zendesk-api.rb
ticketmaster-zendesk-0.2.2 lib/zendesk/zendesk-api.rb