Sha256: 3eab5e28fea41858a3822e55cabeb531ad2fb5d6637a987744f5232353a59f20

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true
module Payment
  module Manager
    module Request
      def self.get_from_api(path, params)
        api_url = Payment::Manager::Config.api_url
        final_url = api_url + path
        get(final_url, params)
      end

      def self.get(url, params)
        uri = URI(url)
        uri.query = URI.encode_www_form(params)
        conn(uri).get(uri)
      end

      def self.conn(uri)
        http = Net::HTTP.new(uri.hostname, uri.port)
        http.use_ssl = uri.scheme == 'https'
        http
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
payment-manager-client-0.3.0 lib/payment/manager/request.rb