Sha256: 5831216b78dbe2be01615bdaabb65c8f17eab5b08b2b3980aa83f2b0e506fa1a

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

require 'base64'
require 'json'
require 'faraday'
require 'fintecture/utils/validation'
require 'fintecture/exceptions'
require 'fintecture/utils/date'
require 'fintecture/utils/constants'

module Fintecture
  module Ressources
    class Applications
      class << self
        # ------------ PUBLIC METHOD ------------
        def get(client)
          @client = client

          # Do the request
          _request
        end

        private

        # ------------ REQUEST ------------
        def _request
          # Get the url request
          url = _endpoint

          # Build additional headers
          additional_headers = {}
          additional_headers['app_id'] = @client.app_id

          # Do connect request
          Fintecture::Faraday::Authentication::Connection.get(
            url: url,
            client: @client,
            custom_content_type: 'application/json',
            secure_headers: true,
            additional_headers: additional_headers
          )
        end

        # ------------ API ENDPOINT ------------
        def _endpoint
          "#{_api_base_url}/#{Fintecture::Api::Endpoints::Ressources::APPLICATION}"
        end

        # ------------ BASE URL ------------
        def _api_base_url
          Fintecture::Api::BaseUrl::FINTECTURE_API_URL[@client.environment.to_sym]
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fintecture-0.6.2 lib/fintecture/api/ressources/applications.rb
fintecture-0.6.1 lib/fintecture/api/ressources/applications.rb
fintecture-0.6.0 lib/fintecture/api/ressources/applications.rb
fintecture-0.4.0 lib/fintecture/api/ressources/applications.rb