Class: Veryfi::Api::Document
- Inherits:
-
Object
- Object
- Veryfi::Api::Document
- Defined in:
- lib/veryfi/api/document.rb
Constant Summary collapse
- CATEGORIES =
[ "Advertising & Marketing", "Automotive", "Bank Charges & Fees", "Legal & Professional Services", "Insurance", "Meals & Entertainment", "Office Supplies & Software", "Taxes & Licenses", "Travel", "Rent & Lease", "Repairs & Maintenance", "Payroll", "Utilities", "Job Supplies", "Grocery" ].freeze
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #all(params = {}) ⇒ Object
- #delete(id) ⇒ Object
- #get(id, params = {}) ⇒ Object
-
#initialize(request) ⇒ Document
constructor
A new instance of Document.
- #process(raw_params) ⇒ Object
- #process_url(raw_params) ⇒ Object
- #update(id, params) ⇒ Object
Constructor Details
#initialize(request) ⇒ Document
Returns a new instance of Document.
28 29 30 |
# File 'lib/veryfi/api/document.rb', line 28 def initialize(request) @request = request end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
26 27 28 |
# File 'lib/veryfi/api/document.rb', line 26 def request @request end |
Instance Method Details
#all(params = {}) ⇒ Object
32 33 34 |
# File 'lib/veryfi/api/document.rb', line 32 def all(params = {}) request.get("/partner/documents/", params) end |
#delete(id) ⇒ Object
65 66 67 |
# File 'lib/veryfi/api/document.rb', line 65 def delete(id) request.delete("/partner/documents/#{id}") end |
#get(id, params = {}) ⇒ Object
57 58 59 |
# File 'lib/veryfi/api/document.rb', line 57 def get(id, params = {}) request.get("/partner/documents/#{id}", params) end |
#process(raw_params) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/veryfi/api/document.rb', line 36 def process(raw_params) params = setup_create_params(raw_params) file_content = File.read(params[:file_path]) file_data = Base64.encode64(file_content).gsub("\n", "") file_name = params[:file_name] || File.basename(params[:file_path], ".*") payload = params.reject { |k| k == :file_path }.merge( file_name: file_name, file_data: file_data ) request.post("/partner/documents/", payload) end |
#process_url(raw_params) ⇒ Object
51 52 53 54 55 |
# File 'lib/veryfi/api/document.rb', line 51 def process_url(raw_params) params = setup_create_params(raw_params) request.post("/partner/documents/", params) end |
#update(id, params) ⇒ Object
61 62 63 |
# File 'lib/veryfi/api/document.rb', line 61 def update(id, params) request.put("/partner/documents/#{id}", params) end |