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