class QueueIt::Api::Client
Constants
- JSON_FORMAT
Attributes
api_key[RW]
customer_id[RW]
debug[RW]
endpoint[RW]
Public Class Methods
new(customer_id, api_key: nil, debug: false)
click to toggle source
# File lib/queue_it/api/client.rb, line 12 def initialize(customer_id, api_key: nil, debug: false) self.customer_id = customer_id self.api_key = api_key self.debug = debug self.endpoint = URI("https://#{customer_id}.api2.queue-it.net/2_0/event") end
Public Instance Methods
put(path, body)
click to toggle source
# File lib/queue_it/api/client.rb, line 19 def put(path, body) connection.put(path, body) end
Private Instance Methods
connection()
click to toggle source
# File lib/queue_it/api/client.rb, line 42 def connection @connection ||= Faraday.new(options) do |builder| builder.request :json builder.response :logger, nil, { bodies: true } if debug? builder.response :json, content_type: /\bjson$/ builder.adapter Faraday.default_adapter builder.use FaradayMiddleware::RaiseHttpException end end
debug?()
click to toggle source
# File lib/queue_it/api/client.rb, line 38 def debug? debug end
options()
click to toggle source
# File lib/queue_it/api/client.rb, line 27 def options { url: endpoint.dup, headers: { accept: JSON_FORMAT, content_type: JSON_FORMAT, "Api-Key" => api_key, }, } end