Sha256: 038921ab9b541d41d4e8dac64e23672a3f5a07678ddd26eca0f9711358d97374
Contents?: true
Size: 859 Bytes
Versions: 1
Compression:
Stored size: 859 Bytes
Contents
# frozen_string_literal: true require 'httparty' require 'max_exchange_api/helper' module MaxExchangeApi class BaseApi include HTTParty protected def send_request(method, path, headers, query) uuid = SecureRandom.uuid print_log(:info, "[API] #{uuid} #{method.upcase} '#{path}' query = #{query}") begin response = self.class.send( method, path, headers: headers, query: query, timeout: 3, ).parsed_response print_log(:info, "[API] #{uuid} response #{response}") return response rescue => error print_log(:error, "[API] #{uuid} raise exception #{error.message}") raise error end end private def print_log(_method, message) puts message end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
max_exchange_api-0.0.1 | lib/max_exchange_api/base_api.rb |