class Reggora::Order
Public Class Methods
new(client)
click to toggle source
# File lib/reggora/Entity/Lender/order.rb, line 3 def initialize(client) @model = 'order' @client = client end
Public Instance Methods
all(offset = 0, limit = 0, ordering = '-created', search = '', due_in = nil, loan_officer = [], filter = '')
click to toggle source
retrieves all orders (limit 10 at a time). Can be filtered with query parameters
# File lib/reggora/Entity/Lender/order.rb, line 9 def all(offset = 0, limit = 0, ordering = '-created', search = '', due_in = nil, loan_officer = [], filter = '') @client.get("/#{@model}s", {offset: offset, limit: limit, ordering: ordering, search: search, due_in: due_in, loan_officer: loan_officer, filter: filter}) end
cancel(id)
click to toggle source
cancels a specific order
# File lib/reggora/Entity/Lender/order.rb, line 29 def cancel(id) @client.delete("/#{@model}/#{id}/cancel") end
create(loan_params)
click to toggle source
creates an order and returns the ID of the created Order
# File lib/reggora/Entity/Lender/order.rb, line 19 def create(loan_params) @client.post("/#{@model}", loan_params) end
edit(id, loan_params)
click to toggle source
edits a order and returns the ID of the edited order
# File lib/reggora/Entity/Lender/order.rb, line 24 def edit(id, loan_params) @client.put("/#{@model}/#{id}", loan_params) end
find(id)
click to toggle source
retrieves a specific order by id
# File lib/reggora/Entity/Lender/order.rb, line 14 def find(id) @client.get("/#{@model}/#{id}") end
place_on_hold(order_id, reason = '')
click to toggle source
place an active order on hold, which will disable editing and other functionality while on hold.
# File lib/reggora/Entity/Lender/order.rb, line 34 def place_on_hold(order_id, reason = '') @client.put("/order/#{order_id}/hold", {reason: reason}) end
remove_from_hold(order_id)
click to toggle source
# File lib/reggora/Entity/Lender/order.rb, line 38 def remove_from_hold(order_id) @client.put("/order/#{order_id}/unhold") end
sample_data(loan_id, product_id, vendors)
click to toggle source
# File lib/reggora/Entity/Lender/order.rb, line 42 def sample_data(loan_id, product_id, vendors) order_params_manually = { 'allocation_type': 'manually', 'loan': loan_id, 'priority': 'Rush', 'products': [product_id], 'due_date': (Time.now + 60*60*24*30).strftime("%Y-%m-%d %H:%M:%S"), 'additional_fees': [ { 'description': 'Large yard', 'amount': '50' }, { 'description': 'Outside regular locations', 'amount': '20' } ], 'vendors': vendors } order_params_automatically = { 'allocation_type': 'automatically', 'loan': loan_id, 'priority': 'Rush', 'products': [product_id], 'due_date': (Time.now + 60*60*24*30).strftime("%Y-%m-%d %H:%M:%S"), 'additional_fees': [ { 'description': 'Large yard', 'amount': '50' }, { 'description': 'Outside regular locations', 'amount': '20' } ] } {:manual_allocation_type => order_params_manually, :auto_allocation_type => order_params_automatically} end