Class: TicketSharing::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/ticket_sharing/request.rb

Constant Summary collapse

MAX_REDIRECTS =
2
USER_AGENT =
'Zendesk-TicketSharing'
CA_PATH =
"/etc/ssl/certs"

Instance Method Summary collapse

Constructor Details

#initialize(connection = TicketSharing.connection) ⇒ Request

Returns a new instance of Request.



11
12
13
# File 'lib/ticket_sharing/request.rb', line 11

def initialize(connection = TicketSharing.connection)
  @connection = connection
end

Instance Method Details

#request(method, url, options = {}) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
19
20
# File 'lib/ticket_sharing/request.rb', line 15

def request(method, url, options = {})
  raise ArgumentError, "Unsupported method: #{method.inspect}" unless %i(get post put delete).include?(method)

  response = send_request(method, url, options)
  follow_redirects!(method, response, options)
end