reggora 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reggora/Adapters/api_client.rb +9 -1
- data/lib/reggora/Adapters/requests.rb +21 -17
- data/lib/reggora/Entity/Lender/evault.rb +9 -6
- data/lib/reggora/Entity/Lender/loan.rb +7 -6
- data/lib/reggora/Entity/Lender/order.rb +9 -9
- data/lib/reggora/Entity/Lender/product.rb +7 -6
- data/lib/reggora/Entity/Lender/schedule_payment_app.rb +6 -3
- data/lib/reggora/Entity/Lender/submission.rb +4 -3
- data/lib/reggora/Entity/Lender/user.rb +8 -7
- data/lib/reggora/Entity/Lender/vendor.rb +9 -8
- data/lib/reggora.rb +44 -17
- metadata +11 -12
- data/lib/reggora/Adapters/lender_api_client.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cff705fa73cc43c06a18cbfe00d6262676a47d13
|
4
|
+
data.tar.gz: 40a047df738665b965b71e811261bf19ffdd2262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 682f8f7640bdeedd487df8365f33ad27209dc81599cbec5ba9ef39bd1796ca98c0e08718c9046b78bb66bd8884ae5be214b21b77d2817801d2702985de3cbb17
|
7
|
+
data.tar.gz: 53f1b8bc814edf87a1623cf714644cdeb33d0f1d953abe6bd10ece79a88699f1d7346b474bd9d13ac4193e8e8643e9b63b48ddea61c2ef3453df51186ced171f
|
@@ -12,8 +12,16 @@ class ApiClient
|
|
12
12
|
case response
|
13
13
|
when Net::HTTPSuccess then
|
14
14
|
JSON.parse(response.read_body)
|
15
|
+
when Net::HTTPBadRequest then
|
16
|
+
res = JSON.parse(response.read_body)
|
17
|
+
raise res.inspect if res["error"].nil?
|
18
|
+
print res
|
19
|
+
when Net::HTTPUnauthorized then
|
20
|
+
raise "Unauthorized."
|
21
|
+
when Net::HTTPInternalServerError then
|
22
|
+
raise "Internal server error"
|
15
23
|
else
|
16
|
-
response
|
24
|
+
raise "Unknown error #{response}: #{response.inspect}"
|
17
25
|
end
|
18
26
|
end
|
19
27
|
end
|
@@ -26,26 +26,25 @@ class Requests
|
|
26
26
|
|
27
27
|
def post_file(url, params)
|
28
28
|
api_endpoint = full_uri url
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# This method reads the given file into memory all at once, thus it might not work well for large files
|
33
|
-
post_body = []
|
34
|
-
file = params[:file]
|
35
|
-
# Add the file Data
|
36
|
-
post_body << "--#{boundary}\r\n"
|
37
|
-
post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{ params[:file_name] || File.basename(file)}\"\r\n"
|
38
|
-
post_body << "Content-Type: #{MIME::Types.type_for(file)}\r\n\r\n"
|
39
|
-
post_body << File.open(file, 'rb') { |io| io.read }
|
29
|
+
header = @header.dup
|
30
|
+
boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW"
|
31
|
+
header["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
|
40
32
|
|
41
|
-
# Add the JSON
|
42
|
-
post_body << "--#{boundary}\r\n"
|
43
|
-
post_body << "Content-Disposition: form-data; name=\"id\"\r\n\r\n"
|
44
|
-
post_body << params[:id]
|
45
|
-
post_body << "\r\n\r\n--#{boundary}--\r\n"
|
46
33
|
request = Net::HTTP::Post.new(api_endpoint, header)
|
47
|
-
request.body =
|
34
|
+
request.body = ""
|
35
|
+
params.each do |k, v|
|
36
|
+
if k.to_s == 'file'
|
37
|
+
mime_type = MIME::Types.type_for(v)
|
38
|
+
request.body += "--#{boundary}\r\nContent-Disposition: form-data; name=\"#{k.to_s}\"; filename=\"#{v}\"\r\nContent-Type: #{mime_type[0]}\r\n"
|
39
|
+
else
|
40
|
+
request.body += "--#{boundary}\r\nContent-Disposition: form-data; name=\"#{k.to_s}\"\r\n\r\n#{v}\r\n"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
request.body += "\r\n\r\n--#{boundary}--"
|
45
|
+
|
48
46
|
send_request request
|
47
|
+
|
49
48
|
end
|
50
49
|
|
51
50
|
def put(url, params = {})
|
@@ -72,6 +71,9 @@ class Requests
|
|
72
71
|
end
|
73
72
|
|
74
73
|
def handle_response(response)
|
74
|
+
print "\n------ Response -----\n"
|
75
|
+
puts response.read_body
|
76
|
+
print "---------------------------"
|
75
77
|
case response
|
76
78
|
when Net::HTTPSuccess then
|
77
79
|
json_parse(response.read_body)
|
@@ -79,6 +81,8 @@ class Requests
|
|
79
81
|
res = json_parse(response.read_body)
|
80
82
|
raise res.inspect if res["error"].nil?
|
81
83
|
res
|
84
|
+
when Net::HTTPUnauthorized then
|
85
|
+
raise "Unauthorized."
|
82
86
|
when Net::HTTPInternalServerError then
|
83
87
|
raise "Internal server error"
|
84
88
|
else
|
@@ -1,27 +1,30 @@
|
|
1
1
|
class Evault
|
2
|
-
|
2
|
+
def initialize(client)
|
3
|
+
@model = 'evault'
|
4
|
+
@client = client
|
5
|
+
end
|
3
6
|
# returns an eVault object
|
4
7
|
def find(id)
|
5
|
-
|
8
|
+
@client.get("/evault/#{id}")
|
6
9
|
end
|
7
10
|
|
8
11
|
# returns a file object specified by the evault ID and the document ID
|
9
12
|
def document(evault_id, document_id)
|
10
|
-
|
13
|
+
@client.get("/evault/#{evault_id}/#{document_id}")
|
11
14
|
end
|
12
15
|
|
13
16
|
# upload a document to an evault and returns the ID of the document
|
14
17
|
def upload_document(upload_params)
|
15
|
-
|
18
|
+
@client.post_file("/evault", upload_params)
|
16
19
|
end
|
17
20
|
|
18
21
|
# upload a P&S to an order and returns the ID of the P&S document
|
19
22
|
def upload_p_s(upload_params)
|
20
|
-
|
23
|
+
@client.post_file("/p_and_s", upload_params)
|
21
24
|
end
|
22
25
|
|
23
26
|
# delete a document from the evault
|
24
27
|
def delete_document(params)
|
25
|
-
|
28
|
+
@client.delete("/evault", params)
|
26
29
|
end
|
27
30
|
end
|
@@ -1,29 +1,30 @@
|
|
1
1
|
class Loan
|
2
|
-
def initialize
|
2
|
+
def initialize(client)
|
3
3
|
@model = 'loan'
|
4
|
+
@client = client
|
4
5
|
end
|
5
6
|
# retrieves all loans, and can take a number of query parameters
|
6
7
|
def all(offset = 0, limit = 0, ordering = '-created', loan_officer = [])
|
7
|
-
|
8
|
+
@client.get("/#{@model}s", {offset: offset, limit: limit, ordering: ordering, loan_officer: loan_officer})
|
8
9
|
end
|
9
10
|
|
10
11
|
# retrieves a specific loan by id
|
11
12
|
def find(id)
|
12
|
-
|
13
|
+
@client.get("/#{@model}/#{id}")
|
13
14
|
end
|
14
15
|
|
15
16
|
# creates a loan and returns the ID of the created loan
|
16
17
|
def create(loan_params)
|
17
|
-
|
18
|
+
@client.post("/#{@model}", loan_params)
|
18
19
|
end
|
19
20
|
|
20
21
|
# edits a loan and returns the ID of the edited loan. Only the provided fields will be updated
|
21
22
|
def edit(id, loan_params)
|
22
|
-
|
23
|
+
@client.put("/#{@model}/#{id}", loan_params)
|
23
24
|
end
|
24
25
|
# deletes a specific loan
|
25
26
|
def delete(id)
|
26
|
-
|
27
|
+
@client.delete("/#{@model}/#{id}")
|
27
28
|
end
|
28
29
|
|
29
30
|
def sample_data
|
@@ -1,41 +1,41 @@
|
|
1
1
|
class Order
|
2
|
-
|
3
|
-
def initialize
|
2
|
+
def initialize(client)
|
4
3
|
@model = 'order'
|
4
|
+
@client = client
|
5
5
|
end
|
6
6
|
|
7
7
|
# retrieves all orders (limit 10 at a time). Can be filtered with query parameters
|
8
8
|
def all(offset = 0, limit = 0, ordering = '-created', search = '', due_in = nil, loan_officer = [], filter = '')
|
9
|
-
|
9
|
+
@client.get("/#{@model}s", {offset: offset, limit: limit, ordering: ordering, search: search, due_in: due_in, loan_officer: loan_officer, filter: filter})
|
10
10
|
end
|
11
11
|
|
12
12
|
# retrieves a specific order by id
|
13
13
|
def find(id)
|
14
|
-
|
14
|
+
@client.get("/#{@model}/#{id}")
|
15
15
|
end
|
16
16
|
|
17
17
|
# creates an order and returns the ID of the created Order
|
18
18
|
def create(loan_params)
|
19
|
-
|
19
|
+
@client.post("/#{@model}", loan_params)
|
20
20
|
end
|
21
21
|
|
22
22
|
# edits a order and returns the ID of the edited order
|
23
23
|
def edit(id, loan_params)
|
24
|
-
|
24
|
+
@client.put("/#{@model}/#{id}", loan_params)
|
25
25
|
end
|
26
26
|
|
27
27
|
# cancels a specific order
|
28
28
|
def cancel(id)
|
29
|
-
|
29
|
+
@client.delete("/#{@model}/#{id}/cancel")
|
30
30
|
end
|
31
31
|
|
32
32
|
# place an active order on hold, which will disable editing and other functionality while on hold.
|
33
33
|
def place_on_hold(order_id, reason = '')
|
34
|
-
|
34
|
+
@client.put("/order/#{order_id}/hold", {reason: reason})
|
35
35
|
end
|
36
36
|
|
37
37
|
def remove_from_hold(order_id)
|
38
|
-
|
38
|
+
@client.put("/order/#{order_id}/unhold")
|
39
39
|
end
|
40
40
|
|
41
41
|
def sample_data(loan_id, product_id)
|
@@ -1,29 +1,30 @@
|
|
1
1
|
class Product
|
2
|
-
def initialize
|
2
|
+
def initialize(client)
|
3
3
|
@model = 'product'
|
4
|
+
@client = client
|
4
5
|
end
|
5
6
|
# retrieves all products.
|
6
7
|
def all(params = {})
|
7
|
-
|
8
|
+
@client.get("/#{@model}s", params)
|
8
9
|
end
|
9
10
|
|
10
11
|
# retrieves a specific product by id.
|
11
12
|
def find(id)
|
12
|
-
|
13
|
+
@client.get("/#{@model}/#{id}")
|
13
14
|
end
|
14
15
|
|
15
16
|
# creates a product and returns the ID of the created product.
|
16
17
|
def create(product_params)
|
17
|
-
|
18
|
+
@client.post("/#{@model}", product_params)
|
18
19
|
end
|
19
20
|
|
20
21
|
# edits a product and returns the ID of the edited product.
|
21
22
|
def edit(id, product_params)
|
22
|
-
|
23
|
+
@client.put("/#{@model}/#{id}", product_params)
|
23
24
|
end
|
24
25
|
# deletes a specific product. If an order or a loan is associated with this product the reference will not be broken.
|
25
26
|
def delete(id)
|
26
|
-
|
27
|
+
@client.delete("/#{@model}/#{id}")
|
27
28
|
end
|
28
29
|
|
29
30
|
def sample_data
|
@@ -1,19 +1,22 @@
|
|
1
1
|
class SchedulePaymentApp
|
2
|
+
def initialize(client)
|
3
|
+
@client = client
|
4
|
+
end
|
2
5
|
|
3
6
|
def send_payment_app(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '')
|
4
7
|
payment_params = payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname, lastname)
|
5
|
-
|
8
|
+
@client.post('/consumer/payment', payment_params)
|
6
9
|
end
|
7
10
|
|
8
11
|
def send_scheduling_app(consumer_emails, order_id)
|
9
|
-
|
12
|
+
@client.post("/consumer/scheduling", {consumer_emails: consumer_emails, order_id: order_id})
|
10
13
|
end
|
11
14
|
|
12
15
|
# @param [String] order_id
|
13
16
|
# @param [String] link_type : payment/schedule/both
|
14
17
|
# @param [String] consumer_id
|
15
18
|
def consumer_app_link(order_id, consumer_id, link_type)
|
16
|
-
|
19
|
+
@client.get("/#{order_id}/#{consumer_id}/#{link_type}")
|
17
20
|
end
|
18
21
|
|
19
22
|
def payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '')
|
@@ -1,14 +1,15 @@
|
|
1
1
|
class Submission
|
2
|
-
def initialize
|
2
|
+
def initialize(client)
|
3
3
|
@model = 'submission'
|
4
|
+
@client = client
|
4
5
|
end
|
5
6
|
# retrieves all submissions associated with an order.
|
6
7
|
def all(order_id)
|
7
|
-
|
8
|
+
@client.get("/order-submissions/#{order_id}")
|
8
9
|
end
|
9
10
|
|
10
11
|
# retrieves one of the three forms that are associated with an order submission.
|
11
12
|
def download_submission_doc(order_id, version, report_type)
|
12
|
-
|
13
|
+
@client.get("/order-submission/#{order_id}/#{version}/#{report_type}")
|
13
14
|
end
|
14
15
|
end
|
@@ -1,37 +1,38 @@
|
|
1
1
|
class User
|
2
|
-
def initialize
|
2
|
+
def initialize(client)
|
3
3
|
@model = 'user'
|
4
|
+
@client = client
|
4
5
|
end
|
5
6
|
|
6
7
|
# returns a list of all the users in the requesting lender.
|
7
8
|
def all(params = {})
|
8
|
-
|
9
|
+
@client.get("/#{@model}s", params)
|
9
10
|
end
|
10
11
|
|
11
12
|
# takes a user ID as a URL parameter and returns a user object.
|
12
13
|
def find(user_id)
|
13
|
-
|
14
|
+
@client.get("/#{@model}s/#{user_id}")
|
14
15
|
end
|
15
16
|
|
16
17
|
# invites a user to the reggora platform
|
17
18
|
def invite(email, role, firstname, lastname, phone_number)
|
18
19
|
invite_params = invite_params(email, role, firstname, lastname, phone_number)
|
19
|
-
|
20
|
+
@client.post("/#{@model}s/invite", invite_params)
|
20
21
|
end
|
21
22
|
|
22
23
|
# creates a user to the reggora platform.
|
23
24
|
def create(user_params)
|
24
|
-
|
25
|
+
@client.post("/#{@model}s", user_params)
|
25
26
|
end
|
26
27
|
|
27
28
|
# updates a user's information.
|
28
29
|
# No fields are required and only the supplied fields will be updated on the user.
|
29
30
|
def edit(user_id, user_params)
|
30
|
-
|
31
|
+
@client.put("/#{@model}s/#{user_id}", user_params)
|
31
32
|
end
|
32
33
|
|
33
34
|
def delete(user_id)
|
34
|
-
|
35
|
+
@client.delete("/#{@model}s/#{user_id}")
|
35
36
|
end
|
36
37
|
|
37
38
|
def user_attributes(email, role, firstname, lastname, phone_number, branch_id = '', nmls_id = '', matched_users = [])
|
@@ -1,42 +1,43 @@
|
|
1
1
|
class Vendor
|
2
|
-
def initialize
|
2
|
+
def initialize(client)
|
3
3
|
@model = 'vendor'
|
4
|
+
@client = client
|
4
5
|
end
|
5
6
|
|
6
7
|
# returns all the vendors associated with the requesting lender.
|
7
8
|
def all(offset = 0, limit = 0)
|
8
|
-
|
9
|
+
@client.get("/#{@model}s", {offset: offset, limit: limit})
|
9
10
|
end
|
10
11
|
|
11
12
|
# takes a vendor ID as a URL parameter and returns the corresponding vendor.
|
12
13
|
def find(vendor_id)
|
13
|
-
|
14
|
+
@client.get("/#{@model}/#{vendor_id}")
|
14
15
|
end
|
15
16
|
|
16
17
|
# returns the vendors associated with the requesting lender filtered by zip code.
|
17
18
|
def find_by_zone(zones, offset = 0, limit = 0)
|
18
|
-
|
19
|
+
@client.post("/#{@model}s/by_zone", {zones: zones}, {offset: offset, limit: limit})
|
19
20
|
end
|
20
21
|
|
21
22
|
# returns the vendors associated with the requesting lender filtered by branch.
|
22
23
|
def find_by_branch(branch_id)
|
23
|
-
|
24
|
+
@client.get("/#{@model}s/branch", {branch_id: branch_id})
|
24
25
|
end
|
25
26
|
|
26
27
|
# adds a vendor to your lender.
|
27
28
|
def invite(firm_name, firstname, lastname, email, phone)
|
28
29
|
invite_params = vendor_params(firm_name, firstname, lastname, email, phone)
|
29
|
-
|
30
|
+
@client.post("/#{@model}", {}, invite_params)
|
30
31
|
end
|
31
32
|
|
32
33
|
# edits a vendor. Only the fields that are in the request body will be updated.
|
33
34
|
def edit(vendor_id, edit_vendor_params)
|
34
|
-
|
35
|
+
@client.put("/#{@model}/#{vendor_id}", edit_vendor_params)
|
35
36
|
end
|
36
37
|
|
37
38
|
# removes a vendor from your lender panel.
|
38
39
|
def delete(vendor_id)
|
39
|
-
|
40
|
+
@client.delete("/#{@model}/#{vendor_id}")
|
40
41
|
end
|
41
42
|
|
42
43
|
def vendor_params(firm_name = "", firstname = "", lastname = "", phone = "")
|
data/lib/reggora.rb
CHANGED
@@ -1,27 +1,54 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require_relative 'reggora/
|
3
|
-
require_relative 'reggora/
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
require_relative 'reggora/Entity/Lender/user'
|
8
|
-
require_relative 'reggora/Entity/Lender/vendor'
|
9
|
-
require_relative 'reggora/Entity/Lender/schedule_payment_app'
|
10
|
-
require_relative 'reggora/Adapters/lender_api_client'
|
11
|
-
|
12
|
-
# init api client
|
2
|
+
require_relative 'reggora/Adapters/api_client'
|
3
|
+
require_relative 'reggora/Adapters/requests'
|
4
|
+
Dir[File.join(__dir__, 'reggora', 'Entity', 'Lender', '*.rb')].each do |f|
|
5
|
+
require f
|
6
|
+
end
|
13
7
|
|
14
8
|
module Reggora
|
15
|
-
# class Error < StandardError; end
|
16
9
|
|
17
|
-
class
|
18
|
-
|
19
|
-
|
10
|
+
class LenderApiClient
|
11
|
+
|
12
|
+
# @param [String] username
|
13
|
+
# @param [String] password
|
14
|
+
# @param [String] integration_token
|
15
|
+
def initialize(username, password, integration_token)
|
16
|
+
authorization = ApiClient.authenticate(username, password, 'lender')
|
17
|
+
@api_client = Requests.new(authorization["token"], integration_token, 'lender')
|
18
|
+
end
|
19
|
+
|
20
|
+
# @param [string] username
|
21
|
+
# @param [string] password
|
22
|
+
def self.authenticate(username, password)
|
23
|
+
ApiClient.authenticate(username, password, 'lender')
|
24
|
+
end
|
25
|
+
|
26
|
+
def get(url, params = {})
|
27
|
+
@api_client.get(url, params)
|
28
|
+
end
|
29
|
+
|
30
|
+
def post(url, params = {}, query_params = {})
|
31
|
+
@api_client.post(url, params, query_params)
|
20
32
|
end
|
33
|
+
|
34
|
+
def post_file(url, params = {})
|
35
|
+
@api_client.post_file(url, params)
|
36
|
+
end
|
37
|
+
|
38
|
+
def put(url, params = {})
|
39
|
+
@api_client.put(url, params)
|
40
|
+
end
|
41
|
+
|
42
|
+
def delete(url, params = {})
|
43
|
+
@api_client.delete(url, params)
|
44
|
+
end
|
45
|
+
|
21
46
|
end
|
22
47
|
|
23
|
-
class
|
24
|
-
def initialize(
|
48
|
+
class VendorApiClient
|
49
|
+
def initialize(username, password, integration_token)
|
50
|
+
authorization = ApiClient.authenticate(username, password, 'vendor')
|
51
|
+
@api_client = Requests.new(authorization["token"], integration_token, 'vendor')
|
25
52
|
# Todo
|
26
53
|
end
|
27
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reggora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- reggora
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,47 +25,47 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.17'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: mime-types
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
68
|
+
version: '3.0'
|
69
69
|
description: https://sandbox.reggora.io/
|
70
70
|
email:
|
71
71
|
- development@reggora.com
|
@@ -75,7 +75,6 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- lib/reggora.rb
|
77
77
|
- lib/reggora/Adapters/api_client.rb
|
78
|
-
- lib/reggora/Adapters/lender_api_client.rb
|
79
78
|
- lib/reggora/Adapters/requests.rb
|
80
79
|
- lib/reggora/Entity/Lender/evault.rb
|
81
80
|
- lib/reggora/Entity/Lender/loan.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require_relative 'api_client'
|
2
|
-
require_relative 'requests'
|
3
|
-
class LenderApiClient
|
4
|
-
|
5
|
-
# @param [String] username
|
6
|
-
# @param [String] password
|
7
|
-
# @param [String] integration_token
|
8
|
-
def initialize(username, password, integration_token)
|
9
|
-
authorization = ApiClient.authenticate(username, password, 'lender')
|
10
|
-
@api_client = Requests.new(authorization["token"], integration_token, 'lender')
|
11
|
-
$lender_api_client = self
|
12
|
-
end
|
13
|
-
|
14
|
-
# @param [string] username
|
15
|
-
# @param [string] password
|
16
|
-
def self.authenticate(username, password)
|
17
|
-
ApiClient.authenticate(username, password, 'lender')
|
18
|
-
end
|
19
|
-
|
20
|
-
def get(url, params = {})
|
21
|
-
@api_client.get(url, params)
|
22
|
-
end
|
23
|
-
|
24
|
-
def post(url, params = {}, query_params = {})
|
25
|
-
@api_client.post(url, params, query_params)
|
26
|
-
end
|
27
|
-
|
28
|
-
def post_file(url, params = {})
|
29
|
-
@api_client.post_file(url, params)
|
30
|
-
end
|
31
|
-
|
32
|
-
def put(url, params = {})
|
33
|
-
@api_client.put(url, params)
|
34
|
-
end
|
35
|
-
|
36
|
-
def delete(url, params = {})
|
37
|
-
@api_client.delete(url, params)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|