class Credova::Application
Constants
- CREATE_ATTRS
- ENDPOINTS
- MAXIMUM_FINANCING_AMOUNT
- MINIMUM_FINANCING_AMOUNT
- SET_DELIVERY_INFORMATION_ATTRS
Public Class Methods
new(client)
click to toggle source
# File lib/credova/application.rb, line 30 def initialize(client) @client = client end
Public Instance Methods
check_status_by_phone_number(phone)
click to toggle source
# File lib/credova/application.rb, line 56 def check_status_by_phone_number(phone) endpoint = ENDPOINTS[:check_status_by_phone_number] % phone get_request(endpoint, auth_header(@client.access_token)) end
check_status_by_public_id(public_id)
click to toggle source
# File lib/credova/application.rb, line 50 def check_status_by_public_id(public_id) endpoint = ENDPOINTS[:check_status_by_public_id] % public_id get_request(endpoint, auth_header(@client.access_token)) end
create(application_data, callback_url = nil)
click to toggle source
# File lib/credova/application.rb, line 34 def create(application_data, callback_url = nil) requires!(application_data, *CREATE_ATTRS[:required]) endpoint = ENDPOINTS[:create] headers = [ *auth_header(@client.access_token), *content_type_header('application/json'), ].to_h headers['Callback-Url'] = callback_url if callback_url.present? application_data = standardize_body_data(application_data, CREATE_ATTRS[:permitted]) post_request(endpoint, application_data, headers) end
request_return(public_id)
click to toggle source
# File lib/credova/application.rb, line 76 def request_return(public_id) endpoint = ENDPOINTS[:request_return] % public_id post_request(endpoint, {}, auth_header(@client.access_token)) end
set_delivery_information(public_id, delivery_data)
click to toggle source
# File lib/credova/application.rb, line 62 def set_delivery_information(public_id, delivery_data) requires!(delivery_data, *SET_DELIVERY_INFORMATION_ATTRS[:required]) endpoint = ENDPOINTS[:set_delivery_information] % public_id headers = [ *auth_header(@client.access_token), *content_type_header('application/json'), ].to_h delivery_data = standardize_body_data(delivery_data, SET_DELIVERY_INFORMATION_ATTRS[:permitted]) post_request(endpoint, delivery_data, headers) end
upload_invoice(public_id, invoice_file_data)
click to toggle source
# File lib/credova/application.rb, line 82 def upload_invoice(public_id, invoice_file_data) requires!(invoice_file_data, *FILE_UPLOAD_ATTRS[:required]) endpoint = ENDPOINTS[:upload_invoice] % public_id post_file_request(endpoint, invoice_file_data, auth_header(@client.access_token)) end