Sha256: 70024909b13d178c5422176e37920f0ff314427624c510196cc123739f88e6b1

Contents?: true

Size: 476 Bytes

Versions: 6

Compression:

Stored size: 476 Bytes

Contents

# frozen_string_literal: true

require 'net/http'
require 'json'

module APIClients
  # Base APIClient
  class APIClient
    # @param api_base_path [String] Base path to the API
    def initialize(api_base_path:)
      @api_base_path = api_base_path
    end

    private

    def make_request(endpoint:)
      uri = URI(URI.join(@api_base_path, endpoint))

      response = Net::HTTP.get_response(uri)

      JSON.parse(response.body, symbolize_names: true)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ynab_convert-2.0.6 lib/ynab_convert/api_clients/api_client.rb
ynab_convert-2.0.5 lib/ynab_convert/api_clients/api_client.rb
ynab_convert-2.0.4 lib/ynab_convert/api_clients/api_client.rb
ynab_convert-2.0.3 lib/ynab_convert/api_clients/api_client.rb
ynab_convert-2.0.1 lib/ynab_convert/api_clients/api_client.rb
ynab_convert-2.0.0 lib/ynab_convert/api_clients/api_client.rb