Sha256: 6f0282379be48d825fb3afb8846c5085621b3601433f3a0e3f20a51783de6e38

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ticketmaster-zendesk-0.1.2 lib/zendesk/zendesk-api.rb
ticketmaster-zendesk-0.0.2 lib/zendesk/zendesk-api.rb
ticketmaster-zendesk-0.0.1 lib/zendesk/zendesk-api.rb