reggora 2.0.0 → 2.1.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/Adapters/api_client.rb +20 -19
- data/lib/reggora/Adapters/requests.rb +84 -82
- data/lib/reggora/Entity/Lender/evault.rb +26 -24
- data/lib/reggora/Entity/Lender/loan.rb +42 -40
- data/lib/reggora/Entity/Lender/order.rb +70 -68
- data/lib/reggora/Entity/Lender/product.rb +35 -33
- data/lib/reggora/Entity/Lender/schedule_payment_app.rb +29 -27
- data/lib/reggora/Entity/Lender/submission.rb +15 -13
- data/lib/reggora/Entity/Lender/user.rb +73 -71
- data/lib/reggora/Entity/Lender/vendor.rb +51 -49
- metadata +26 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1b6c97d8faf68dad273af2855c54e55efdc38eb4b3b3d00c849b2fbab6b71887
|
4
|
+
data.tar.gz: 480f1f58cddebd5279f14fb0678d239a8f21f7681fa508cce32fb62b87792490
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7055f3dc38afdfe2b995f4864f9b9ee34614e1e8b9c95b2a779efda148ea9ab2a0be186a60d86a37d0b29c5d40e7564beb56776c3c2be0d0038c9e6de7cf52e
|
7
|
+
data.tar.gz: 1dd76c8630ff7f6974ce965c10122e26c2d4ed2d88fa724b1877d94de476c2e01aed23028972217490427906ce86e7d167e7e4d3a96e0ed17868dd9e8bed0bf1
|
@@ -1,27 +1,28 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'net/http'
|
3
3
|
require 'json'
|
4
|
-
|
5
|
-
class ApiClient
|
6
|
-
|
4
|
+
module Reggora
|
5
|
+
class ApiClient
|
6
|
+
$base_api_uri = 'https://sandbox.reggora.io/'
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
def self.authenticate(username, password, type)
|
9
|
+
body = {:username => username, :password => password}
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
11
|
+
response = Net::HTTP.post URI("#{$base_api_uri}#{type}/auth"), body.to_json
|
12
|
+
case response
|
13
|
+
when Net::HTTPSuccess then
|
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"
|
23
|
+
else
|
24
|
+
raise "Unknown error #{response}: #{response.inspect}"
|
25
|
+
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -1,100 +1,102 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
require 'mime/types'
|
2
|
+
module Reggora
|
3
|
+
class Requests
|
4
|
+
def initialize(auth_token, integration_token, type)
|
5
|
+
@uri = URI("#{$base_api_uri}#{type}")
|
6
|
+
@http = Net::HTTP.new(@uri.host, @uri.port)
|
7
|
+
@http.use_ssl = true
|
8
|
+
@header = {"Content-Type" => 'application/json', "Authorization" => "Bearer #{auth_token}", "integration" => integration_token}
|
9
|
+
end
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
11
|
+
def full_uri(path)
|
12
|
+
URI("#{@uri.to_s}#{path}")
|
13
|
+
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def get(url, params = {})
|
16
|
+
api_endpoint = full_uri url
|
17
|
+
api_endpoint.query = URI.encode_www_form(params) unless params.empty?
|
18
|
+
send_request Net::HTTP::Get.new(api_endpoint.request_uri, @header)
|
19
|
+
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
def post(url, params = {}, query_params = {})
|
22
|
+
api_endpoint = full_uri url
|
23
|
+
api_endpoint.query = URI.encode_www_form(query_params) unless query_params.empty?
|
24
|
+
request = Net::HTTP::Post.new(api_endpoint, @header)
|
25
|
+
request.body = params.to_json
|
26
|
+
send_request request
|
27
|
+
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def post_file(url, params)
|
30
|
+
api_endpoint = full_uri url
|
31
|
+
header = @header.dup
|
32
|
+
boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW"
|
33
|
+
header["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
request = Net::HTTP::Post.new(api_endpoint, header)
|
36
|
+
request.body = ""
|
37
|
+
params.each do |k, v|
|
38
|
+
if k.to_s == 'file'
|
39
|
+
mime_type = MIME::Types.type_for(v)
|
40
|
+
request.body += "--#{boundary}\r\nContent-Disposition: form-data; name=\"#{k.to_s}\"; filename=\"#{v}\"\r\nContent-Type: #{mime_type[0]}\r\n"
|
41
|
+
else
|
42
|
+
request.body += "--#{boundary}\r\nContent-Disposition: form-data; name=\"#{k.to_s}\"\r\n\r\n#{v}\r\n"
|
43
|
+
end
|
41
44
|
end
|
42
|
-
end
|
43
|
-
|
44
|
-
request.body += "\r\n\r\n--#{boundary}--"
|
45
45
|
|
46
|
-
|
46
|
+
request.body += "\r\n\r\n--#{boundary}--"
|
47
|
+
send_request request
|
47
48
|
|
48
|
-
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
def put(url, params = {})
|
52
|
+
api_endpoint = full_uri url
|
53
|
+
request = Net::HTTP::Put.new(api_endpoint, @header)
|
54
|
+
request.body = params.to_json
|
55
|
+
send_request request
|
56
|
+
end
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
def delete(url, params = {})
|
59
|
+
api_endpoint = full_uri url
|
60
|
+
request = Net::HTTP::Delete.new(api_endpoint, @header)
|
61
|
+
request.body = params.to_json
|
62
|
+
send_request request
|
63
|
+
end
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
def send_request(request)
|
66
|
+
begin
|
67
|
+
handle_response @http.request(request)
|
68
|
+
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPUnauthorized,
|
69
|
+
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Errno::ECONNREFUSED => e
|
70
|
+
raise e.inspect
|
71
|
+
end
|
70
72
|
end
|
71
|
-
end
|
72
73
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
74
|
+
def handle_response(response)
|
75
|
+
print "\n------ Response -----\n"
|
76
|
+
puts response.read_body
|
77
|
+
print "---------------------------"
|
78
|
+
case response
|
79
|
+
when Net::HTTPSuccess then
|
80
|
+
json_parse(response.read_body)
|
81
|
+
when Net::HTTPBadRequest then
|
82
|
+
res = json_parse(response.read_body)
|
83
|
+
raise res.inspect if res["error"].nil?
|
84
|
+
res
|
85
|
+
when Net::HTTPUnauthorized then
|
86
|
+
raise "Unauthorized."
|
87
|
+
when Net::HTTPInternalServerError then
|
88
|
+
raise "Internal server error"
|
89
|
+
else
|
90
|
+
raise "Unknown error #{response}: #{response.inspect}"
|
91
|
+
end
|
90
92
|
end
|
91
|
-
end
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
def json_parse(res)
|
95
|
+
begin
|
96
|
+
JSON.parse(res)
|
97
|
+
rescue JSON::ParserError
|
98
|
+
res
|
99
|
+
end
|
98
100
|
end
|
99
101
|
end
|
100
102
|
end
|
@@ -1,30 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module Reggora
|
2
|
+
class Evault
|
3
|
+
def initialize(client)
|
4
|
+
@model = 'evault'
|
5
|
+
@client = client
|
6
|
+
end
|
7
|
+
# returns an eVault object
|
8
|
+
def find(id)
|
9
|
+
@client.get("/evault/#{id}")
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
# returns a file object specified by the evault ID and the document ID
|
13
|
+
def document(evault_id, document_id)
|
14
|
+
@client.get("/evault/#{evault_id}/#{document_id}")
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# upload a document to an evault and returns the ID of the document
|
18
|
+
def upload_document(upload_params)
|
19
|
+
@client.post_file("/evault", upload_params)
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
# upload a P&S to an order and returns the ID of the P&S document
|
23
|
+
def upload_p_s(upload_params)
|
24
|
+
@client.post_file("/p_and_s", upload_params)
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
# delete a document from the evault
|
28
|
+
def delete_document(params)
|
29
|
+
@client.delete("/evault", params)
|
30
|
+
end
|
29
31
|
end
|
30
32
|
end
|
@@ -1,46 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module Reggora
|
2
|
+
class Loan
|
3
|
+
def initialize(client)
|
4
|
+
@model = 'loan'
|
5
|
+
@client = client
|
6
|
+
end
|
7
|
+
# retrieves all loans, and can take a number of query parameters
|
8
|
+
def all(offset = 0, limit = 0, ordering = '-created', loan_officer = [])
|
9
|
+
@client.get("/#{@model}s", {offset: offset, limit: limit, ordering: ordering, loan_officer: loan_officer})
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
# retrieves a specific loan by id
|
13
|
+
def find(id)
|
14
|
+
@client.get("/#{@model}/#{id}")
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# creates a loan and returns the ID of the created loan
|
18
|
+
def create(loan_params)
|
19
|
+
@client.post("/#{@model}", loan_params)
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
# edits a loan and returns the ID of the edited loan. Only the provided fields will be updated
|
23
|
+
def edit(id, loan_params)
|
24
|
+
@client.put("/#{@model}/#{id}", loan_params)
|
25
|
+
end
|
26
|
+
# deletes a specific loan
|
27
|
+
def delete(id)
|
28
|
+
@client.delete("/#{@model}/#{id}")
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
31
|
+
def sample_data
|
32
|
+
n = rand(10...100)
|
33
|
+
s = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
|
34
|
+
{
|
35
|
+
"loan_number": "#{3 * n}#{s[1...5]}#{n}",
|
36
|
+
"loan_officer": "5d4c4afdcfd7ff000a515085",
|
37
|
+
"appraisal_type": "Refinance",
|
38
|
+
"due_date": (Time.now + 60*60*24*30).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
39
|
+
"subject_property_address": "100 Mass Ave",
|
40
|
+
"subject_property_city": "Boston",
|
41
|
+
"subject_property_state": "MA",
|
42
|
+
"subject_property_zip": "02192",
|
43
|
+
"case_number": "10029MA",
|
44
|
+
"loan_type": "FHA"
|
45
|
+
}
|
46
|
+
end
|
45
47
|
end
|
46
48
|
end
|
@@ -1,78 +1,80 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module Reggora
|
2
|
+
class Order
|
3
|
+
def initialize(client)
|
4
|
+
@model = 'order'
|
5
|
+
@client = client
|
6
|
+
end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
# retrieves all orders (limit 10 at a time). Can be filtered with query parameters
|
9
|
+
def all(offset = 0, limit = 0, ordering = '-created', search = '', due_in = nil, loan_officer = [], filter = '')
|
10
|
+
@client.get("/#{@model}s", {offset: offset, limit: limit, ordering: ordering, search: search, due_in: due_in, loan_officer: loan_officer, filter: filter})
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
# retrieves a specific order by id
|
14
|
+
def find(id)
|
15
|
+
@client.get("/#{@model}/#{id}")
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
# creates an order and returns the ID of the created Order
|
19
|
+
def create(loan_params)
|
20
|
+
@client.post("/#{@model}", loan_params)
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
# edits a order and returns the ID of the edited order
|
24
|
+
def edit(id, loan_params)
|
25
|
+
@client.put("/#{@model}/#{id}", loan_params)
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
# cancels a specific order
|
29
|
+
def cancel(id)
|
30
|
+
@client.delete("/#{@model}/#{id}/cancel")
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
# place an active order on hold, which will disable editing and other functionality while on hold.
|
34
|
+
def place_on_hold(order_id, reason = '')
|
35
|
+
@client.put("/order/#{order_id}/hold", {reason: reason})
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
def remove_from_hold(order_id)
|
39
|
+
@client.put("/order/#{order_id}/unhold")
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
42
|
+
def sample_data(loan_id, product_id)
|
43
|
+
order_params_manually = {
|
44
|
+
'allocation_type': 'manually',
|
45
|
+
'loan': loan_id,
|
46
|
+
'priority': 'Rush',
|
47
|
+
'products': [product_id],
|
48
|
+
'due_date': (Time.now + 60*60*24*30).strftime("%Y-%m-%d %H:%M:%S"),
|
49
|
+
'additional_fees': [
|
50
|
+
{
|
51
|
+
'description': 'Large yard',
|
52
|
+
'amount': '50'
|
53
|
+
},
|
54
|
+
{
|
55
|
+
'description': 'Outside regular locations',
|
56
|
+
'amount': '20'
|
57
|
+
}
|
58
|
+
]
|
59
|
+
}
|
60
|
+
order_params_automatically = {
|
61
|
+
'allocation_type': 'automatically',
|
62
|
+
'loan': loan_id,
|
63
|
+
'priority': 'Rush',
|
64
|
+
'products': [product_id],
|
65
|
+
'due_date': (Time.now + 60*60*24*30).strftime("%Y-%m-%d %H:%M:%S"),
|
66
|
+
'additional_fees': [
|
67
|
+
{
|
68
|
+
'description': 'Large yard',
|
69
|
+
'amount': '50'
|
70
|
+
},
|
71
|
+
{
|
72
|
+
'description': 'Outside regular locations',
|
73
|
+
'amount': '20'
|
74
|
+
}
|
75
|
+
]
|
76
|
+
}
|
77
|
+
{:manual_allocation_type => order_params_manually, :auto_allocation_type => order_params_automatically}
|
78
|
+
end
|
77
79
|
end
|
78
80
|
end
|
@@ -1,39 +1,41 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module Reggora
|
2
|
+
class Product
|
3
|
+
def initialize(client)
|
4
|
+
@model = 'product'
|
5
|
+
@client = client
|
6
|
+
end
|
7
|
+
# retrieves all products.
|
8
|
+
def all(params = {})
|
9
|
+
@client.get("/#{@model}s", params)
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
# retrieves a specific product by id.
|
13
|
+
def find(id)
|
14
|
+
@client.get("/#{@model}/#{id}")
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# creates a product and returns the ID of the created product.
|
18
|
+
def create(product_params)
|
19
|
+
@client.post("/#{@model}", product_params)
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
# edits a product and returns the ID of the edited product.
|
23
|
+
def edit(id, product_params)
|
24
|
+
@client.put("/#{@model}/#{id}", product_params)
|
25
|
+
end
|
26
|
+
# deletes a specific product. If an order or a loan is associated with this product the reference will not be broken.
|
27
|
+
def delete(id)
|
28
|
+
@client.delete("/#{@model}/#{id}")
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
def sample_data
|
32
|
+
s = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
|
33
|
+
{
|
34
|
+
'product_name': "Product_#{s[1...5]}",
|
35
|
+
'amount': '100.00',
|
36
|
+
'inspection_type': 'interior',
|
37
|
+
'requested_forms': '1004MC, BPO'
|
38
|
+
}
|
39
|
+
end
|
38
40
|
end
|
39
41
|
end
|
@@ -1,35 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Reggora
|
2
|
+
class SchedulePaymentApp
|
3
|
+
def initialize(client)
|
4
|
+
@client = client
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def send_payment_app(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '')
|
8
|
+
payment_params = payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname, lastname)
|
9
|
+
@client.post('/consumer/payment', payment_params)
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def send_scheduling_app(consumer_emails, order_id)
|
13
|
+
@client.post("/consumer/scheduling", {consumer_emails: consumer_emails, order_id: order_id})
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
# @param [String] order_id
|
17
|
+
# @param [String] link_type : payment/schedule/both
|
18
|
+
# @param [String] consumer_id
|
19
|
+
def consumer_app_link(order_id, consumer_id, link_type)
|
20
|
+
@client.get("/#{order_id}/#{consumer_id}/#{link_type}")
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
+
def payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '')
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
attributes = {
|
26
|
+
consumer_email: consumer_email,
|
27
|
+
order_id: order_id,
|
28
|
+
user_type: user_type,
|
29
|
+
payment_type: payment_type,
|
30
|
+
amount: amount
|
31
|
+
}
|
31
32
|
|
32
|
-
|
33
|
-
|
33
|
+
attributes.merge!({firstname: firstname, lastname: lastname, paid: false}) if user_type == 'manual'
|
34
|
+
attributes
|
35
|
+
end
|
34
36
|
end
|
35
37
|
end
|
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module Reggora
|
2
|
+
class Submission
|
3
|
+
def initialize(client)
|
4
|
+
@model = 'submission'
|
5
|
+
@client = client
|
6
|
+
end
|
7
|
+
# retrieves all submissions associated with an order.
|
8
|
+
def all(order_id)
|
9
|
+
@client.get("/order-submissions/#{order_id}")
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
# retrieves one of the three forms that are associated with an order submission.
|
13
|
+
def download_submission_doc(order_id, version, report_type)
|
14
|
+
@client.get("/order-submission/#{order_id}/#{version}/#{report_type}")
|
15
|
+
end
|
14
16
|
end
|
15
|
-
end
|
17
|
+
end
|
@@ -1,83 +1,85 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module Reggora
|
2
|
+
class User
|
3
|
+
def initialize(client)
|
4
|
+
@model = 'user'
|
5
|
+
@client = client
|
6
|
+
end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
# returns a list of all the users in the requesting lender.
|
9
|
+
def all(params = {})
|
10
|
+
@client.get("/#{@model}s", params)
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
# takes a user ID as a URL parameter and returns a user object.
|
14
|
+
def find(user_id)
|
15
|
+
@client.get("/#{@model}s/#{user_id}")
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# invites a user to the reggora platform
|
19
|
+
def invite(email, role, firstname, lastname, phone_number)
|
20
|
+
invite_params = invite_params(email, role, firstname, lastname, phone_number)
|
21
|
+
@client.post("/#{@model}s/invite", invite_params)
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
# creates a user to the reggora platform.
|
25
|
+
def create(user_params)
|
26
|
+
@client.post("/#{@model}s", user_params)
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
# updates a user's information.
|
30
|
+
# No fields are required and only the supplied fields will be updated on the user.
|
31
|
+
def edit(user_id, user_params)
|
32
|
+
@client.put("/#{@model}s/#{user_id}", user_params)
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
def delete(user_id)
|
36
|
+
@client.delete("/#{@model}s/#{user_id}")
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
39
|
+
def user_attributes(email, role, firstname, lastname, phone_number, branch_id = '', nmls_id = '', matched_users = [])
|
40
|
+
{
|
41
|
+
email: email,
|
42
|
+
role: role,
|
43
|
+
firstname: firstname,
|
44
|
+
lastname: lastname,
|
45
|
+
phone_number: phone_number,
|
46
|
+
branch_id: branch_id,
|
47
|
+
nmls_id: nmls_id,
|
48
|
+
matched_users: matched_users
|
49
|
+
}
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
def invite_params(email, role, firstname, lastname, phone_number)
|
53
|
+
{
|
54
|
+
email: email,
|
55
|
+
role: role,
|
56
|
+
firstname: firstname,
|
57
|
+
lastname: lastname,
|
58
|
+
phone_number: phone_number
|
59
|
+
}
|
60
|
+
end
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
def query_params(ordering = '-created', offset = 0, limit = 0, search = '')
|
63
|
+
{
|
64
|
+
ordering: ordering,
|
65
|
+
offset: offset,
|
66
|
+
limit: limit,
|
67
|
+
search: search
|
68
|
+
}
|
69
|
+
end
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
71
|
+
def sample_data
|
72
|
+
s = (0...50).map { ('a'..'z').to_a[rand(26)] }.join
|
73
|
+
{
|
74
|
+
email: "fake#{s[1...4]}@reggora.com",
|
75
|
+
role: "Admin",
|
76
|
+
firstname: "Fake",
|
77
|
+
lastname: "Person#{s[1...4]}",
|
78
|
+
phone_number: "#{rand(100000...99999)}",
|
79
|
+
branch_id: '',
|
80
|
+
nmls_id: '',
|
81
|
+
matched_users: []
|
82
|
+
}
|
83
|
+
end
|
82
84
|
end
|
83
85
|
end
|
@@ -1,51 +1,53 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
1
|
+
module Reggora
|
2
|
+
class Vendor
|
3
|
+
def initialize(client)
|
4
|
+
@model = 'vendor'
|
5
|
+
@client = client
|
6
|
+
end
|
7
|
+
|
8
|
+
# returns all the vendors associated with the requesting lender.
|
9
|
+
def all(offset = 0, limit = 0)
|
10
|
+
@client.get("/#{@model}s", {offset: offset, limit: limit})
|
11
|
+
end
|
12
|
+
|
13
|
+
# takes a vendor ID as a URL parameter and returns the corresponding vendor.
|
14
|
+
def find(vendor_id)
|
15
|
+
@client.get("/#{@model}/#{vendor_id}")
|
16
|
+
end
|
17
|
+
|
18
|
+
# returns the vendors associated with the requesting lender filtered by zip code.
|
19
|
+
def find_by_zone(zones, offset = 0, limit = 0)
|
20
|
+
@client.post("/#{@model}s/by_zone", {zones: zones}, {offset: offset, limit: limit})
|
21
|
+
end
|
22
|
+
|
23
|
+
# returns the vendors associated with the requesting lender filtered by branch.
|
24
|
+
def find_by_branch(branch_id)
|
25
|
+
@client.get("/#{@model}s/branch", {branch_id: branch_id})
|
26
|
+
end
|
27
|
+
|
28
|
+
# adds a vendor to your lender.
|
29
|
+
def invite(firm_name, firstname, lastname, email, phone)
|
30
|
+
invite_params = vendor_params(firm_name, firstname, lastname, email, phone)
|
31
|
+
@client.post("/#{@model}", {}, invite_params)
|
32
|
+
end
|
33
|
+
|
34
|
+
# edits a vendor. Only the fields that are in the request body will be updated.
|
35
|
+
def edit(vendor_id, edit_vendor_params)
|
36
|
+
@client.put("/#{@model}/#{vendor_id}", edit_vendor_params)
|
37
|
+
end
|
38
|
+
|
39
|
+
# removes a vendor from your lender panel.
|
40
|
+
def delete(vendor_id)
|
41
|
+
@client.delete("/#{@model}/#{vendor_id}")
|
42
|
+
end
|
43
|
+
|
44
|
+
def vendor_params(firm_name = "", firstname = "", lastname = "", phone = "")
|
45
|
+
{
|
46
|
+
firm_name: firm_name,
|
47
|
+
firstname: firstname,
|
48
|
+
lastname: lastname,
|
49
|
+
phone: phone
|
50
|
+
}
|
51
|
+
end
|
50
52
|
end
|
51
53
|
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: 2.
|
4
|
+
version: 2.1.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-
|
11
|
+
date: 2019-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,47 +25,61 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.17'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '10.0'
|
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: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.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: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.12.2
|
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:
|
68
|
+
version: 0.12.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mime-types
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.1'
|
69
83
|
description: https://sandbox.reggora.io/
|
70
84
|
email:
|
71
85
|
- development@reggora.com
|
@@ -107,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
121
|
- !ruby/object:Gem::Version
|
108
122
|
version: '0'
|
109
123
|
requirements: []
|
110
|
-
|
111
|
-
rubygems_version: 2.5.2.3
|
124
|
+
rubygems_version: 3.0.6
|
112
125
|
signing_key:
|
113
126
|
specification_version: 4
|
114
127
|
summary: Ruby Client for Reggora Lender/Vendor API
|