Sha256: fb65df24698baef2ed30c9485e08282fc4d9d4349ce5c6e2db7054911567bcf9
Contents?: true
Size: 899 Bytes
Versions: 16
Compression:
Stored size: 899 Bytes
Contents
require_relative 'request' require_relative 'response' require_relative 'helpers' module Tickethub class Endpoint attr_reader :options, :url def initialize(url, options = {}) @url = url @options = options end def [](suburl, options = {}) url = (if suburl.nil? then self.url else suburl = suburl.to_s base = self.url base += "/" unless base =~ /\/$/ URI.join(base, suburl).to_s end) self.class.new url, Tickethub::Helpers.deep_merge(@options, options) end [:get, :post, :delete, :patch].each do |method| define_method method do |params = {}, options = {}| request options.merge(method: method, params: params) end end def request(options = {}) Tickethub::Request.new(url, Tickethub::Helpers.deep_merge(@options, options)).execute end end end
Version data entries
16 entries across 16 versions & 1 rubygems