Sha256: 9c4d70325e5cbb1329ecf63ec6060e0f3a4912f84d26bd8ea7d822932c6dad9f

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

module ZendeskAPI
  class Activity < Resource
    has :user
    has :actor, :class => :user
  end

  class Setting < DataResource
    attr_reader :on

    def initialize(client, attributes = {})
      @on = attributes.first
      super(client, attributes[1])
    end
  end

  class MobileDevice < Resource
    put :clear_badge
  end

  class SatisfactionRating < ReadResource
    has :assignee, :class => :user 
    has :requester, :class => :user
    has :ticket
    has :group
  end

  class Attachment < Data
    def initialize(client, attributes)
      if attributes.is_a?(Hash)
        super
      else
        super(client, :file => attributes)
      end
    end

    def save
      upload = Upload.create!(@client, attributes)
      self.token = upload.token
    end

    def to_param
      token
    end
  end

  class Upload < Data
    include Create

    only_send_unnested_params
    has_many :attachments
  end

  class Locale < ReadResource; end
  class Bookmark < Resource; end
  class Macro < DataResource; end

  module Search
    class Result < Data; end

    def self.new(client, attributes)
      result_type = attributes["result_type"]

      if result_type
        result_type = ZendeskAPI::Helpers.modulize_string(result_type)
        klass = ZendeskAPI.const_get(result_type) rescue nil
      end

      (klass || Result).new(client, attributes)
    end

    def self.resource_name
      "search"
    end

    def self.model_key
      "results"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zendesk_api-0.1.7 lib/zendesk_api/resources/misc.rb
zendesk_api-0.1.6 lib/zendesk_api/resources/misc.rb