Sha256: 145902bd8420395b58f2c6bc936ff1c9edaf22861bd336b6b31b1b642bbc4010
Contents?: true
Size: 784 Bytes
Versions: 2
Compression:
Stored size: 784 Bytes
Contents
module Sqoot module Request def get(path, options) request(:get, path, convert_params(path, options)) end def convert_params(path, data={}) auth_endpoints = ['commissions', 'clicks'] if auth_endpoints.include? path.split('/')[2] data['authentication_token'] = authentication_token else data['affiliate_token'] = affiliate_token end data end def request(method, path, options) response = connection.send(method) do |request| case method when :delete, :get request.url(path, options) when :post, :put request.path = path request.body = MultiJson.encode(options) unless options.empty? end end response.body end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sqoot-1.0.0 | lib/sqoot/request.rb |
sqoot-0.0.1 | lib/sqoot/request.rb |