reggora 0.1.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/reggora.rb +9 -0
- data/lib/reggora/Adapters/api_client.rb +2 -1
- data/lib/reggora/Adapters/lender_api_client.rb +8 -4
- data/lib/reggora/Adapters/requests.rb +45 -6
- data/lib/reggora/Entity/Lender/evault.rb +27 -0
- data/lib/reggora/Entity/Lender/loan.rb +31 -7
- data/lib/reggora/Entity/Lender/order.rb +63 -6
- data/lib/reggora/Entity/Lender/product.rb +38 -0
- data/lib/reggora/Entity/Lender/schedule_payment_app.rb +32 -0
- data/lib/reggora/Entity/Lender/submission.rb +14 -0
- data/lib/reggora/Entity/Lender/user.rb +82 -0
- data/lib/reggora/Entity/Lender/vendor.rb +50 -0
- metadata +32 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4af8144ca6859604ed393635da6af5f40e16922d
|
4
|
+
data.tar.gz: 9f99e965e6e5393c2e92f289e7b7d48a6afe46cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564dc35b635466a6293d786f214d4fa4a6172afee38070946de665f8728b16d63afd7019252c39d6d4dfd63b5dc4e50f1ec4c3b51933ac2e1ffd81ac53d4287e
|
7
|
+
data.tar.gz: e9d90f4f7df264119e685b14eeeb6f82826585481713940cc2a4c8c63e05ad4268831b0877d6bc8f3e32fd45f9d06af108ed2013006d9e1ac2ccf500e4cf8183
|
data/lib/reggora.rb
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require_relative 'reggora/Entity/Lender/loan'
|
3
3
|
require_relative 'reggora/Entity/Lender/order'
|
4
|
+
require_relative 'reggora/Entity/Lender/evault'
|
5
|
+
require_relative 'reggora/Entity/Lender/product'
|
6
|
+
require_relative 'reggora/Entity/Lender/submission'
|
7
|
+
require_relative 'reggora/Entity/Lender/user'
|
8
|
+
require_relative 'reggora/Entity/Lender/vendor'
|
9
|
+
require_relative 'reggora/Entity/Lender/schedule_payment_app'
|
4
10
|
require_relative 'reggora/Adapters/lender_api_client'
|
11
|
+
|
12
|
+
# init api client
|
13
|
+
|
5
14
|
module Reggora
|
6
15
|
# class Error < StandardError; end
|
7
16
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'net/http'
|
3
3
|
require 'json'
|
4
|
+
require 'mime/types'
|
4
5
|
class ApiClient
|
5
6
|
$base_api_uri = 'https://sandbox.reggora.io/'
|
6
7
|
|
@@ -12,7 +13,7 @@ class ApiClient
|
|
12
13
|
when Net::HTTPSuccess then
|
13
14
|
JSON.parse(response.read_body)
|
14
15
|
else
|
15
|
-
response
|
16
|
+
response
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -21,16 +21,20 @@ class LenderApiClient
|
|
21
21
|
@api_client.get(url, params)
|
22
22
|
end
|
23
23
|
|
24
|
-
def post(url, params = {})
|
25
|
-
@api_client.post(url, params)
|
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)
|
26
30
|
end
|
27
31
|
|
28
32
|
def put(url, params = {})
|
29
33
|
@api_client.put(url, params)
|
30
34
|
end
|
31
35
|
|
32
|
-
def delete(url)
|
33
|
-
@api_client.delete(url)
|
36
|
+
def delete(url, params = {})
|
37
|
+
@api_client.delete(url, params)
|
34
38
|
end
|
35
39
|
|
36
40
|
end
|
@@ -16,13 +16,38 @@ class Requests
|
|
16
16
|
send_request Net::HTTP::Get.new(api_endpoint.request_uri, @header)
|
17
17
|
end
|
18
18
|
|
19
|
-
def post(url, params = {})
|
19
|
+
def post(url, params = {}, query_params = {})
|
20
20
|
api_endpoint = full_uri url
|
21
|
+
api_endpoint.query = URI.encode_www_form(query_params) unless query_params.empty?
|
21
22
|
request = Net::HTTP::Post.new(api_endpoint, @header)
|
22
23
|
request.body = params.to_json
|
23
24
|
send_request request
|
24
25
|
end
|
25
26
|
|
27
|
+
def post_file(url, params)
|
28
|
+
api_endpoint = full_uri url
|
29
|
+
boundary = "AaB03x"
|
30
|
+
header = {"Content-Type" => "multipart/form-data, boundary=#{boundary}", "Authorization" => "Bearer #{@header['Authorization']}", "integration" => @header['integration']}
|
31
|
+
# We're going to compile all the parts of the body into an array, then join them into one single string
|
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 }
|
40
|
+
|
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
|
+
request = Net::HTTP::Post.new(api_endpoint, header)
|
47
|
+
request.body = post_body.to_json
|
48
|
+
send_request request
|
49
|
+
end
|
50
|
+
|
26
51
|
def put(url, params = {})
|
27
52
|
api_endpoint = full_uri url
|
28
53
|
request = Net::HTTP::Put.new(api_endpoint, @header)
|
@@ -30,9 +55,11 @@ class Requests
|
|
30
55
|
send_request request
|
31
56
|
end
|
32
57
|
|
33
|
-
def delete(url)
|
58
|
+
def delete(url, params = {})
|
34
59
|
api_endpoint = full_uri url
|
35
|
-
|
60
|
+
request = Net::HTTP::Delete.new(api_endpoint, @header)
|
61
|
+
request.body = params.to_json
|
62
|
+
send_request request
|
36
63
|
end
|
37
64
|
|
38
65
|
def send_request(request)
|
@@ -47,11 +74,23 @@ class Requests
|
|
47
74
|
def handle_response(response)
|
48
75
|
case response
|
49
76
|
when Net::HTTPSuccess then
|
50
|
-
|
77
|
+
json_parse(response.read_body)
|
51
78
|
when Net::HTTPBadRequest then
|
52
|
-
|
79
|
+
res = json_parse(response.read_body)
|
80
|
+
raise res.inspect if res["error"].nil?
|
81
|
+
res
|
82
|
+
when Net::HTTPInternalServerError then
|
83
|
+
raise "Internal server error"
|
53
84
|
else
|
54
|
-
raise
|
85
|
+
raise "Unknown error #{response}: #{response.inspect}"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def json_parse(res)
|
90
|
+
begin
|
91
|
+
JSON.parse(res)
|
92
|
+
rescue JSON::ParserError
|
93
|
+
res
|
55
94
|
end
|
56
95
|
end
|
57
96
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class Evault
|
2
|
+
|
3
|
+
# returns an eVault object
|
4
|
+
def find(id)
|
5
|
+
$lender_api_client.get("/evault/#{id}")
|
6
|
+
end
|
7
|
+
|
8
|
+
# returns a file object specified by the evault ID and the document ID
|
9
|
+
def document(evault_id, document_id)
|
10
|
+
$lender_api_client.get("/evault/#{evault_id}/#{document_id}")
|
11
|
+
end
|
12
|
+
|
13
|
+
# upload a document to an evault and returns the ID of the document
|
14
|
+
def upload_document(upload_params)
|
15
|
+
$lender_api_client.post_file("/evault", upload_params)
|
16
|
+
end
|
17
|
+
|
18
|
+
# upload a P&S to an order and returns the ID of the P&S document
|
19
|
+
def upload_p_s(upload_params)
|
20
|
+
$lender_api_client.post_file("/order/p_and_s", upload_params)
|
21
|
+
end
|
22
|
+
|
23
|
+
# delete a document from the evault
|
24
|
+
def delete_document(params)
|
25
|
+
$lender_api_client.delete("/evault", params)
|
26
|
+
end
|
27
|
+
end
|
@@ -1,21 +1,45 @@
|
|
1
1
|
class Loan
|
2
|
-
def
|
3
|
-
|
2
|
+
def initialize
|
3
|
+
@model = 'loan'
|
4
|
+
end
|
5
|
+
# retrieves all loans, and can take a number of query parameters
|
6
|
+
def all(offset = 0, limit = 0, ordering = '-created', loan_officer = [])
|
7
|
+
$lender_api_client.get("/#{@model}s", {offset: offset, limit: limit, ordering: ordering, loan_officer: loan_officer})
|
4
8
|
end
|
5
9
|
|
10
|
+
# retrieves a specific loan by id
|
6
11
|
def find(id)
|
7
|
-
$lender_api_client.get("
|
12
|
+
$lender_api_client.get("/#{@model}/#{id}")
|
8
13
|
end
|
9
14
|
|
15
|
+
# creates a loan and returns the ID of the created loan
|
10
16
|
def create(loan_params)
|
11
|
-
$lender_api_client.post(
|
17
|
+
$lender_api_client.post("/#{@model}", loan_params)
|
12
18
|
end
|
13
19
|
|
20
|
+
# edits a loan and returns the ID of the edited loan. Only the provided fields will be updated
|
14
21
|
def edit(id, loan_params)
|
15
|
-
$lender_api_client.put("
|
22
|
+
$lender_api_client.put("/#{@model}/#{id}", loan_params)
|
16
23
|
end
|
17
|
-
|
24
|
+
# deletes a specific loan
|
18
25
|
def delete(id)
|
19
|
-
$lender_api_client.delete("
|
26
|
+
$lender_api_client.delete("/#{@model}/#{id}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def sample_data
|
30
|
+
n = rand(10...100)
|
31
|
+
s = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
|
32
|
+
{
|
33
|
+
"loan_number": "#{3 * n}#{s[1...5]}#{n}",
|
34
|
+
"loan_officer": "",
|
35
|
+
"appraisal_type": "Refinance",
|
36
|
+
"due_date": (Time.now + 60*60*24*30).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
37
|
+
"subject_property_address": "100 Mass Ave",
|
38
|
+
"subject_property_city": "Boston",
|
39
|
+
"subject_property_state": "MA",
|
40
|
+
"subject_property_zip": "02192",
|
41
|
+
"case_number": "10029MA",
|
42
|
+
"loan_type": "FHA"
|
43
|
+
}
|
20
44
|
end
|
21
45
|
end
|
@@ -1,21 +1,78 @@
|
|
1
1
|
class Order
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@model = 'order'
|
5
|
+
end
|
6
|
+
|
7
|
+
# retrieves all orders (limit 10 at a time). Can be filtered with query parameters
|
8
|
+
def all(offset = 0, limit = 0, ordering = '-created', search = '', due_in = nil, loan_officer = [], filter = '')
|
9
|
+
$lender_api_client.get("/#{@model}s", {offset: offset, limit: limit, ordering: ordering, search: search, due_in: due_in, loan_officer: loan_officer, filter: filter})
|
4
10
|
end
|
5
11
|
|
12
|
+
# retrieves a specific order by id
|
6
13
|
def find(id)
|
7
|
-
$lender_api_client.get("
|
14
|
+
$lender_api_client.get("/#{@model}/#{id}")
|
8
15
|
end
|
9
16
|
|
17
|
+
# creates an order and returns the ID of the created Order
|
10
18
|
def create(loan_params)
|
11
|
-
$lender_api_client.post(
|
19
|
+
$lender_api_client.post("/#{@model}", loan_params)
|
12
20
|
end
|
13
21
|
|
22
|
+
# edits a order and returns the ID of the edited order
|
14
23
|
def edit(id, loan_params)
|
15
|
-
$lender_api_client.put("
|
24
|
+
$lender_api_client.put("/#{@model}/#{id}", loan_params)
|
16
25
|
end
|
17
26
|
|
27
|
+
# cancels a specific order
|
18
28
|
def cancel(id)
|
19
|
-
$lender_api_client.delete("
|
29
|
+
$lender_api_client.delete("/#{@model}/#{id}/cancel")
|
30
|
+
end
|
31
|
+
|
32
|
+
# place an active order on hold, which will disable editing and other functionality while on hold.
|
33
|
+
def place_on_hold(order_id, reason = '')
|
34
|
+
$lender_api_client.put("/order/#{order_id}/hold", {reason: reason})
|
35
|
+
end
|
36
|
+
|
37
|
+
def remove_from_hold(order_id)
|
38
|
+
$lender_api_client.put("/order/#{order_id}/unhold")
|
39
|
+
end
|
40
|
+
|
41
|
+
def sample_data(loan_id, product_id)
|
42
|
+
order_params_manually = {
|
43
|
+
'allocation_type': 'manually',
|
44
|
+
'loan': loan_id,
|
45
|
+
'priority': 'Rush',
|
46
|
+
'products': [product_id],
|
47
|
+
'due_date': (Time.now + 60*60*24*30).strftime("%Y-%m-%d %H:%M:%S"),
|
48
|
+
'additional_fees': [
|
49
|
+
{
|
50
|
+
'description': 'Large yard',
|
51
|
+
'amount': '50'
|
52
|
+
},
|
53
|
+
{
|
54
|
+
'description': 'Outside regular locations',
|
55
|
+
'amount': '20'
|
56
|
+
}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
order_params_automatically = {
|
60
|
+
'allocation_type': 'automatically',
|
61
|
+
'loan': loan_id,
|
62
|
+
'priority': 'Rush',
|
63
|
+
'products': [product_id],
|
64
|
+
'due_date': (Time.now + 60*60*24*30).strftime("%Y-%m-%d %H:%M:%S"),
|
65
|
+
'additional_fees': [
|
66
|
+
{
|
67
|
+
'description': 'Large yard',
|
68
|
+
'amount': '50'
|
69
|
+
},
|
70
|
+
{
|
71
|
+
'description': 'Outside regular locations',
|
72
|
+
'amount': '20'
|
73
|
+
}
|
74
|
+
]
|
75
|
+
}
|
76
|
+
{:manual_allocation_type => order_params_manually, :auto_allocation_type => order_params_automatically}
|
20
77
|
end
|
21
78
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Product
|
2
|
+
def initialize
|
3
|
+
@model = 'product'
|
4
|
+
end
|
5
|
+
# retrieves all products.
|
6
|
+
def all(params = {})
|
7
|
+
$lender_api_client.get("/#{@model}s", params)
|
8
|
+
end
|
9
|
+
|
10
|
+
# retrieves a specific product by id.
|
11
|
+
def find(id)
|
12
|
+
$lender_api_client.get("/#{@model}/#{id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
# creates a product and returns the ID of the created product.
|
16
|
+
def create(product_params)
|
17
|
+
$lender_api_client.post("/#{@model}", product_params)
|
18
|
+
end
|
19
|
+
|
20
|
+
# edits a product and returns the ID of the edited product.
|
21
|
+
def edit(id, product_params)
|
22
|
+
$lender_api_client.put("/#{@model}/#{id}", product_params)
|
23
|
+
end
|
24
|
+
# deletes a specific product. If an order or a loan is associated with this product the reference will not be broken.
|
25
|
+
def delete(id)
|
26
|
+
$lender_api_client.delete("/#{@model}/#{id}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def sample_data
|
30
|
+
s = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
|
31
|
+
{
|
32
|
+
'product_name': "Product_#{s[1...5]}",
|
33
|
+
'amount': '100.00',
|
34
|
+
'inspection_type': 'interior',
|
35
|
+
'requested_forms': '1004MC, BPO'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class SchedulePaymentApp
|
2
|
+
|
3
|
+
def send_payment_app(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '')
|
4
|
+
payment_params = payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname, lastname)
|
5
|
+
$lender_api_client.post('/consumer/payment', payment_params)
|
6
|
+
end
|
7
|
+
|
8
|
+
def send_scheduling_app(consumer_emails, order_id)
|
9
|
+
$lender_api_client.post("/consumer/scheduling", {consumer_emails: consumer_emails, order_id: order_id})
|
10
|
+
end
|
11
|
+
|
12
|
+
# @param [String] order_id
|
13
|
+
# @param [String] link_type : payment/schedule/both
|
14
|
+
# @param [String] consumer_id
|
15
|
+
def consumer_app_link(order_id, consumer_id, link_type)
|
16
|
+
$lender_api_client.get("/#{order_id}/#{consumer_id}/#{link_type}")
|
17
|
+
end
|
18
|
+
|
19
|
+
def payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '')
|
20
|
+
|
21
|
+
attributes = {
|
22
|
+
consumer_email: consumer_email,
|
23
|
+
order_id: order_id,
|
24
|
+
user_type: user_type,
|
25
|
+
payment_type: payment_type,
|
26
|
+
amount: amount
|
27
|
+
}
|
28
|
+
|
29
|
+
attributes.merge!({firstname: firstname, lastname: lastname, paid: false}) if user_type == 'manual'
|
30
|
+
attributes
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Submission
|
2
|
+
def initialize
|
3
|
+
@model = 'submission'
|
4
|
+
end
|
5
|
+
# retrieves all submissions associated with an order.
|
6
|
+
def all(order_id)
|
7
|
+
$lender_api_client.get("/order-submissions/#{order_id}")
|
8
|
+
end
|
9
|
+
|
10
|
+
# retrieves one of the three forms that are associated with an order submission.
|
11
|
+
def download_submission_doc(order_id, version, report_type)
|
12
|
+
$lender_api_client.get("/order-submission/#{order_id}/#{version}/#{report_type}")
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
class User
|
2
|
+
def initialize
|
3
|
+
@model = 'user'
|
4
|
+
end
|
5
|
+
|
6
|
+
# returns a list of all the users in the requesting lender.
|
7
|
+
def all(params = {})
|
8
|
+
$lender_api_client.get("/#{@model}s", params)
|
9
|
+
end
|
10
|
+
|
11
|
+
# takes a user ID as a URL parameter and returns a user object.
|
12
|
+
def find(user_id)
|
13
|
+
$lender_api_client.get("/#{@model}s/#{user_id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
# invites a user to the reggora platform
|
17
|
+
def invite(email, role, firstname, lastname, phone_number)
|
18
|
+
invite_params = invite_params(email, role, firstname, lastname, phone_number)
|
19
|
+
$lender_api_client.post("/#{@model}s/invite", invite_params)
|
20
|
+
end
|
21
|
+
|
22
|
+
# creates a user to the reggora platform.
|
23
|
+
def create(user_params)
|
24
|
+
$lender_api_client.post("/#{@model}s", user_params)
|
25
|
+
end
|
26
|
+
|
27
|
+
# updates a user's information.
|
28
|
+
# No fields are required and only the supplied fields will be updated on the user.
|
29
|
+
def edit(user_id, user_params)
|
30
|
+
$lender_api_client.put("/#{@model}s/#{user_id}", user_params)
|
31
|
+
end
|
32
|
+
|
33
|
+
def delete(user_id)
|
34
|
+
$lender_api_client.delete("/#{@model}s/#{user_id}")
|
35
|
+
end
|
36
|
+
|
37
|
+
def user_attributes(email, role, firstname, lastname, phone_number, branch_id = '', nmls_id = '', matched_users = [])
|
38
|
+
{
|
39
|
+
email: email,
|
40
|
+
role: role,
|
41
|
+
firstname: firstname,
|
42
|
+
lastname: lastname,
|
43
|
+
phone_number: phone_number,
|
44
|
+
branch_id: branch_id,
|
45
|
+
nmls_id: nmls_id,
|
46
|
+
matched_users: matched_users
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def invite_params(email, role, firstname, lastname, phone_number)
|
51
|
+
{
|
52
|
+
email: email,
|
53
|
+
role: role,
|
54
|
+
firstname: firstname,
|
55
|
+
lastname: lastname,
|
56
|
+
phone_number: phone_number
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def query_params(ordering = '-created', offset = 0, limit = 0, search = '')
|
61
|
+
{
|
62
|
+
ordering: ordering,
|
63
|
+
offset: offset,
|
64
|
+
limit: limit,
|
65
|
+
search: search
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def sample_data
|
70
|
+
s = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
|
71
|
+
{
|
72
|
+
email: "fake#{s[1...4]}@reggora.com",
|
73
|
+
role: "Admin",
|
74
|
+
firstname: "Fake",
|
75
|
+
lastname: "Person#{s[1...4]}",
|
76
|
+
phone_number: "#{rand(100000...99999)}",
|
77
|
+
branch_id: '',
|
78
|
+
nmls_id: '',
|
79
|
+
matched_users: []
|
80
|
+
}
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class Vendor
|
2
|
+
def initialize
|
3
|
+
@model = 'vendor'
|
4
|
+
end
|
5
|
+
|
6
|
+
# returns all the vendors associated with the requesting lender.
|
7
|
+
def all(offset = 0, limit = 0)
|
8
|
+
$lender_api_client.get("/#{@model}s", {offset: offset, limit: limit})
|
9
|
+
end
|
10
|
+
|
11
|
+
# takes a vendor ID as a URL parameter and returns the corresponding vendor.
|
12
|
+
def find(vendor_id)
|
13
|
+
$lender_api_client.get("/#{@model}/#{vendor_id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
# returns the vendors associated with the requesting lender filtered by zip code.
|
17
|
+
def find_by_zone(zones, offset = 0, limit = 0)
|
18
|
+
$lender_api_client.post("/#{@model}s/by_zone", {zones: zones}, {offset: offset, limit: limit})
|
19
|
+
end
|
20
|
+
|
21
|
+
# returns the vendors associated with the requesting lender filtered by branch.
|
22
|
+
def find_by_branch(branch_id)
|
23
|
+
$lender_api_client.get("/#{@model}s/branch", {branch_id: branch_id})
|
24
|
+
end
|
25
|
+
|
26
|
+
# adds a vendor to your lender.
|
27
|
+
def invite(firm_name, firstname, lastname, email, phone)
|
28
|
+
invite_params = vendor_params(firm_name, firstname, lastname, email, phone)
|
29
|
+
$lender_api_client.post("/#{@model}", {}, invite_params)
|
30
|
+
end
|
31
|
+
|
32
|
+
# edits a vendor. Only the fields that are in the request body will be updated.
|
33
|
+
def edit(vendor_id, edit_vendor_params)
|
34
|
+
$lender_api_client.put("/#{@model}/#{vendor_id}", edit_vendor_params)
|
35
|
+
end
|
36
|
+
|
37
|
+
# removes a vendor from your lender panel.
|
38
|
+
def delete(vendor_id)
|
39
|
+
$lender_api_client.delete("/#{@model}/#{vendor_id}")
|
40
|
+
end
|
41
|
+
|
42
|
+
def vendor_params(firm_name = "", firstname = "", lastname = "", phone = "")
|
43
|
+
{
|
44
|
+
firm_name: firm_name,
|
45
|
+
firstname: firstname,
|
46
|
+
lastname: lastname,
|
47
|
+
phone: phone
|
48
|
+
}
|
49
|
+
end
|
50
|
+
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: 0.
|
4
|
+
version: 1.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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,9 +52,23 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mime-types
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.1'
|
69
|
+
description: https://sandbox.reggora.io/
|
56
70
|
email:
|
57
|
-
-
|
71
|
+
- development@reggora.com
|
58
72
|
executables: []
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
@@ -63,16 +77,22 @@ files:
|
|
63
77
|
- lib/reggora/Adapters/api_client.rb
|
64
78
|
- lib/reggora/Adapters/lender_api_client.rb
|
65
79
|
- lib/reggora/Adapters/requests.rb
|
80
|
+
- lib/reggora/Entity/Lender/evault.rb
|
66
81
|
- lib/reggora/Entity/Lender/loan.rb
|
67
82
|
- lib/reggora/Entity/Lender/order.rb
|
68
|
-
|
83
|
+
- lib/reggora/Entity/Lender/product.rb
|
84
|
+
- lib/reggora/Entity/Lender/schedule_payment_app.rb
|
85
|
+
- lib/reggora/Entity/Lender/submission.rb
|
86
|
+
- lib/reggora/Entity/Lender/user.rb
|
87
|
+
- lib/reggora/Entity/Lender/vendor.rb
|
88
|
+
homepage: https://rubygems.org/gems/reggora
|
69
89
|
licenses:
|
70
90
|
- MIT
|
71
91
|
metadata:
|
72
92
|
allowed_push_host: https://rubygems.org/gems/
|
73
|
-
homepage_uri: https://rubygems.org/gems/
|
74
|
-
source_code_uri: https://github.com/
|
75
|
-
changelog_uri: https://github.com/
|
93
|
+
homepage_uri: https://rubygems.org/gems/reggora
|
94
|
+
source_code_uri: https://github.com/Reggora/reggora-ruby
|
95
|
+
changelog_uri: https://github.com/Reggora/reggora-ruby/blob/master/CHANGELOG.md
|
76
96
|
post_install_message:
|
77
97
|
rdoc_options: []
|
78
98
|
require_paths:
|
@@ -88,8 +108,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
108
|
- !ruby/object:Gem::Version
|
89
109
|
version: '0'
|
90
110
|
requirements: []
|
91
|
-
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.5.2.3
|
92
113
|
signing_key:
|
93
114
|
specification_version: 4
|
94
|
-
summary:
|
115
|
+
summary: Ruby Client for Reggora Lender/Vendor API
|
95
116
|
test_files: []
|