Module: Credova::API

Included in:
Application, Client, FFL, Payments, Retailer
Defined in:
lib/credova/api.rb

Constant Summary collapse

DEVELOPMENT_URL =
'https://staging-lending-api.credova.com'.freeze
PRODUCTION_URL =
'https://lending-api.credova.com'.freeze
API_VERSION =
'v2'.freeze
USER_AGENT =
"CredovaRubyGem/#{Credova::VERSION}".freeze
FILE_UPLOAD_ATTRS =
{
  permitted: %i( file_name file_type file_contents ).freeze,
  reqired:   %i( file_type file_contents ).freeze,
}

Instance Method Summary collapse

Instance Method Details

#get_request(endpoint, headers = {}) ⇒ Object



17
18
19
20
21
# File 'lib/credova/api.rb', line 17

def get_request(endpoint, headers = {})
  request = Net::HTTP::Get.new(request_url(endpoint))

  submit_request(request, {}, headers)
end

#post_file_request(endpoint, file_data, headers = {}) ⇒ Object



29
30
31
32
33
# File 'lib/credova/api.rb', line 29

def post_file_request(endpoint, file_data, headers = {})
  request = Net::HTTP::Post.new(request_url(endpoint))

  submit_file_request(request, file_data, headers)
end

#post_request(endpoint, data = {}, headers = {}) ⇒ Object



23
24
25
26
27
# File 'lib/credova/api.rb', line 23

def post_request(endpoint, data = {}, headers = {})
  request = Net::HTTP::Post.new(request_url(endpoint))

  submit_request(request, data, headers)
end