diff --git a/README.md b/README.md index 172f186..6e76857 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,13 @@ Welcome to your new gem! In this directory, you'll find the files you need to be TODO: Delete this and the text above, and describe your gem +## Enverus API Documentation + +The endpoints that are used in this gem are not publicly documented as Enverus has built +a API specific for FundThrough. + +[Documentation for V1 and V2](https://docs.google.com/document/d/1hclQzZH_VeItW4xC8e68RhdD70dWn6l7/edit?usp=sharing&ouid=104023789344514089935&rtpof=true&sd=true) + ## Installation Add this line to your application's Gemfile: diff --git a/lib/open_invoice/client.rb b/lib/open_invoice/client.rb index ac22c87..97385cb 100644 --- a/lib/open_invoice/client.rb +++ b/lib/open_invoice/client.rb @@ -31,9 +31,5 @@ def supplier def buyer @buyer ||= ::OpenInvoice::Entities::Buyer.new(supplier_uuid) end - - def payment - @buyer ||= ::OpenInvoice::Entities::Payment.new(supplier_uuid) - end end end diff --git a/lib/open_invoice/configure.rb b/lib/open_invoice/configure.rb index f5c1e2e..ac1caa5 100644 --- a/lib/open_invoice/configure.rb +++ b/lib/open_invoice/configure.rb @@ -6,6 +6,8 @@ module Configure attr_writer(*KEYS) + VERSION_2 = "v2".freeze + def configure yield self self diff --git a/lib/open_invoice/entities/buyer.rb b/lib/open_invoice/entities/buyer.rb index b723dc6..fa24301 100644 --- a/lib/open_invoice/entities/buyer.rb +++ b/lib/open_invoice/entities/buyer.rb @@ -2,7 +2,7 @@ module OpenInvoice module Entities class Buyer < Base def index(opts = {}) - request(:get, "/supplier/#{supplier_uuid}/buyers", opts) + request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{supplier_uuid}/buyers", opts) end end end diff --git a/lib/open_invoice/entities/invoice.rb b/lib/open_invoice/entities/invoice.rb index 7e98ef3..77777bd 100644 --- a/lib/open_invoice/entities/invoice.rb +++ b/lib/open_invoice/entities/invoice.rb @@ -4,15 +4,15 @@ module OpenInvoice module Entities class Invoice < Base def index(opts = {}) - request(:get, "/supplier/#{supplier_uuid}/invoices/page", opts) + request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{supplier_uuid}/invoices/page", opts) end def attachments(invoice_id, opts = {}) - request(:get, "/supplier/#{supplier_uuid}/invoices/#{invoice_id}/attachments", opts) + request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{supplier_uuid}/invoices/#{invoice_id}/attachments", opts) end def download_attachment(invoice_id, attachment_id, file_path, opts) - attachment_url = "/supplier/#{@supplier_uuid}/invoices/#{invoice_id}/attachments/#{attachment_id}" + attachment_url = "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{@supplier_uuid}/invoices/#{invoice_id}/attachments/#{attachment_id}" dirname = File.dirname(file_path) opts[:stream_body] = true FileUtils.mkdir_p(dirname) unless File.directory?(dirname) @@ -39,7 +39,7 @@ def download_attachment(invoice_id, attachment_id, file_path, opts) end def history(invoice_id, opts = {}) - request(:get, "/supplier/#{@supplier_uuid}/invoices/#{invoice_id}/history", opts) + request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{@supplier_uuid}/invoices/#{invoice_id}/history", opts) end end end diff --git a/lib/open_invoice/entities/payment.rb b/lib/open_invoice/entities/payment.rb deleted file mode 100644 index b3987ca..0000000 --- a/lib/open_invoice/entities/payment.rb +++ /dev/null @@ -1,9 +0,0 @@ -module OpenInvoice - module Entities - class Payment < Base - def index(opts = {}) - request(:get, "/supplier/#{supplier_uuid}/payment", opts) - end - end - end -end diff --git a/lib/open_invoice/entities/supplier.rb b/lib/open_invoice/entities/supplier.rb index b3e2d94..d2e6148 100644 --- a/lib/open_invoice/entities/supplier.rb +++ b/lib/open_invoice/entities/supplier.rb @@ -2,7 +2,7 @@ module OpenInvoice module Entities class Supplier < Base def index(opts = {}) - request(:get, "/supplier/#{supplier_uuid}", opts) + request(:get, "/#{OpenInvoice::Configure::VERSION_2}/supplier/#{supplier_uuid}", opts) end end end diff --git a/lib/open_invoice/entities/user.rb b/lib/open_invoice/entities/user.rb index c8ec9b2..030b6f7 100644 --- a/lib/open_invoice/entities/user.rb +++ b/lib/open_invoice/entities/user.rb @@ -8,7 +8,7 @@ def initialize(user_uuid) end def get - request(:get, "/users/#{user_uuid}") + request(:get, "/#{OpenInvoice::Configure::VERSION_2}/users/#{user_uuid}") end end end