Sha256: 9d7604fb60733728cfe4ce53b56a785fc345fffc614a936c3649cb50b327343a

Contents?: true

Size: 1.05 KB

Versions: 27

Compression:

Stored size: 1.05 KB

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, opts = {})
      send_request :post, ticket_url, params, opts
    end

    def self.comments(params, opts = {})
      send_request :post, ticket_url(params, true), params, opts.merge(required_params: [:id])
    end

    def self.all(params, opts = {})
      send_request :get, ticket_url, params, opts
    end

    def self.get(params, opts = {})
      send_request :get, ticket_url(params), params, opts.merge(required_params: [:id])
    end

    def self.delete(params, opts = {})
      send_request :delete, ticket_url(params), params, opts.merge(required_params: [:id])
    end

    def self.update(params, opts = {})
      send_request :put, ticket_url(params), params, opts.merge(required_params: [:id])
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
eligible-3.0.0.beta28 lib/eligible/ticket.rb
eligible-3.0.0.beta27 lib/eligible/ticket.rb
eligible-3.0.0.beta26 lib/eligible/ticket.rb
eligible-3.0.0.beta25 lib/eligible/ticket.rb
eligible-3.0.0.beta24 lib/eligible/ticket.rb
eligible-3.0.0.beta23 lib/eligible/ticket.rb
eligible-3.0.0.beta22 lib/eligible/ticket.rb
eligible-3.0.0.beta20 lib/eligible/ticket.rb
eligible-3.0.0.beta19 lib/eligible/ticket.rb
eligible-3.0.0.beta18 lib/eligible/ticket.rb
eligible-3.0.0.beta17 lib/eligible/ticket.rb
eligible-3.0.0.beta16 lib/eligible/ticket.rb
eligible-3.0.0.beta15 lib/eligible/ticket.rb
eligible-3.0.0.beta14 lib/eligible/ticket.rb
eligible-3.0.0.beta13 lib/eligible/ticket.rb
eligible-3.0.0.beta12 lib/eligible/ticket.rb
eligible-3.0.0.beta11 lib/eligible/ticket.rb
eligible-3.0.0.beta10 lib/eligible/ticket.rb
eligible-3.0.0.beta9 lib/eligible/ticket.rb
eligible-3.0.0.beta8 lib/eligible/ticket.rb