From 931677d19fc5d1ae571277330bc81799d27e5f77 Mon Sep 17 00:00:00 2001 From: Brendan Asselstine Date: Wed, 27 Jul 2016 10:27:56 -0700 Subject: [PATCH] The Document endpoint was consuming the loop_view_id, not the loop_id --- lib/dotloop/document.rb | 10 ++++++---- spec/dotloop/document_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/dotloop/document.rb b/lib/dotloop/document.rb index d449c23..2b27a3d 100644 --- a/lib/dotloop/document.rb +++ b/lib/dotloop/document.rb @@ -6,18 +6,20 @@ def initialize(client:) @client = client end - def all(profile_id:, loop_id:) - @client.get("/profile/#{profile_id.to_i}/loop/#{loop_id.to_i}/document").map do |document_attrs| + def all(profile_id:, loop_view_id:) + @client.get("/profile/#{profile_id.to_i}/loop/#{loop_view_id.to_i}/document").map do |document_attrs| doc = Dotloop::Models::Document.new(document_attrs) doc.client = client doc end end - def get(profile_id:, loop_id:, document_id:, document_name:) + def get(profile_id:, loop_view_id:, document_id:, document_name:) document_name = CGI.escape(document_name) StringIO.new( - @client.raw("/profile/#{profile_id.to_i}/loop/#{loop_id.to_i}/document/#{document_id}/#{document_name}.pdf") + @client.raw( + "/profile/#{profile_id.to_i}/loop/#{loop_view_id.to_i}/document/#{document_id}/#{document_name}.pdf" + ) ) end end diff --git a/spec/dotloop/document_spec.rb b/spec/dotloop/document_spec.rb index f3ee83c..b18755f 100644 --- a/spec/dotloop/document_spec.rb +++ b/spec/dotloop/document_spec.rb @@ -17,7 +17,7 @@ describe '#all' do it 'should return a list of documents' do dotloop_mock(:documents) - documents = subject.all(profile_id: 1_234, loop_id: 76_046) + documents = subject.all(profile_id: 1_234, loop_view_id: 76_046) expect(documents).to_not be_empty expect(documents).to all(be_a(Dotloop::Models::Document)) expect(documents.first).to have_attributes( @@ -38,7 +38,7 @@ it 'should get pdf data' do dotloop_pdf document = subject.get(profile_id: 1_234, - loop_id: 76_046, + loop_view_id: 76_046, document_id: 561_622, document_name: 'AgencyDisclosureStatementSeller') expect(document.string).to eq(disclosure_file_data)