Sha256: 02ef957c5976d5ee1cef2a7adeff12b6c66358e3127fb5408c8a09dc97693ec5

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

require "json"
require "rest-client"
require "facets"

class UERequest
    def self.fetch(resource, request_options)
        form = request_options[:form] || {}
        user = request_options[:user]
        pass = request_options[:pass]

        # $logger.debug form.inspect
        #Inject user:pass into base url
        url_prefix = Constants.base_url.gsub /https?:\/\//, "https://#{user}:#{pass}@"
        #Concat base url with resource
        url = url_prefix + resource
        # $logger.debug "http => #{url}"

        response = RestClient.post url, form.to_json

        # $logger.debug "resp => #{JSON.parse(response).deep_symbolize_keys}"
        JSON.parse(response).deep_symbolize_keys rescue response
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ue-ruby-sdk-1.1.13 lib/utilities/UERequest.rb
ue-ruby-sdk-1.1.12 lib/utilities/UERequest.rb