Sha256: 98dfc49e794c5b610853f9eb60703ad05f2f6a9522ecf2889b8bddbebc1a1d7c

Contents?: true

Size: 1020 Bytes

Versions: 24

Compression:

Stored size: 1020 Bytes

Contents

module Eligible
  class Ticket < APIResource
    def self.ticket_url(params = nil, comments = false)
      if params.nil?
        '/tickets'
      else
        id = Util.value(params, :id)
        if comments
          "/tickets/#{id}/comments"
        else
          "/tickets/#{id}"
        end
      end
    end

    def self.create(params, api_key = nil)
      send_request(:post, ticket_url, api_key, params)
    end

    def self.comments(params, api_key = nil)
      send_request(:post, ticket_url(params, true), api_key, params, :id)
    end

    def self.all(params, api_key = nil)
      send_request(:get, ticket_url, api_key, params)
    end

    def self.get(params, api_key = nil)
      send_request(:get, ticket_url(params), api_key, params, :id)
    end

    def self.delete(params, api_key = nil)
      send_request(:delete, ticket_url(params), api_key, params, :id)
    end

    def self.update(params, api_key = nil)
      send_request(:put, ticket_url(params), api_key, params, :id)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
eligible-2.9.17 lib/eligible/ticket.rb
eligible-2.9.16 lib/eligible/ticket.rb
eligible-2.9.15 lib/eligible/ticket.rb
eligible-2.9.14 lib/eligible/ticket.rb
eligible-2.9.13 lib/eligible/ticket.rb
eligible-2.9.12 lib/eligible/ticket.rb
eligible-2.9.11 lib/eligible/ticket.rb
eligible-2.9.10 lib/eligible/ticket.rb
eligible-2.9.9 lib/eligible/ticket.rb
eligible-2.9.8 lib/eligible/ticket.rb
eligible-2.9.7 lib/eligible/ticket.rb
eligible-2.9.6 lib/eligible/ticket.rb
eligible-2.9.5 lib/eligible/ticket.rb
eligible-2.9.4 lib/eligible/ticket.rb
eligible-2.9.3 lib/eligible/ticket.rb
eligible-2.9.2 lib/eligible/ticket.rb
eligible-2.9.1 lib/eligible/ticket.rb
eligible-2.8.2 lib/eligible/ticket.rb
eligible-2.8.1 lib/eligible/ticket.rb
eligible-2.8.0 lib/eligible/ticket.rb