From 9555ffd0e3ddd4370c96e0d85a1744b5c707b4a7 Mon Sep 17 00:00:00 2001 From: Brendan Asselstine Date: Thu, 4 Aug 2016 14:00:02 -0700 Subject: [PATCH] Added Participant to Client and change Participant#all(loop_id) to Participant#all(loop_view_id) --- lib/dotloop/client.rb | 4 ++++ lib/dotloop/participant.rb | 4 ++-- spec/dotloop/client_spec.rb | 6 ++++++ spec/dotloop/participant_spec.rb | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/dotloop/client.rb b/lib/dotloop/client.rb index 1f8aa8c..0e536c7 100644 --- a/lib/dotloop/client.rb +++ b/lib/dotloop/client.rb @@ -36,6 +36,10 @@ def Document @document ||= Dotloop::Document.new(client: self) end + def Participant + @participant ||= Dotloop::Participant.new(client: self) + end + def self.snakify(hash) if hash.is_a? Array hash.map(&:to_snake_keys) diff --git a/lib/dotloop/participant.rb b/lib/dotloop/participant.rb index c9c849a..cadc77f 100644 --- a/lib/dotloop/participant.rb +++ b/lib/dotloop/participant.rb @@ -6,8 +6,8 @@ def initialize(client:) @client = client end - def all(profile_id:, loop_id:) - @client.get("/profile/#{profile_id.to_i}/loop/#{loop_id.to_i}/participant").map do |participant_attrs| + def all(profile_id:, loop_view_id:) + @client.get("/profile/#{profile_id.to_i}/loop/#{loop_view_id.to_i}/participant").map do |participant_attrs| Dotloop::Models::Participant.new(participant_attrs) end end diff --git a/spec/dotloop/client_spec.rb b/spec/dotloop/client_spec.rb index 8d76879..d9e081a 100644 --- a/spec/dotloop/client_spec.rb +++ b/spec/dotloop/client_spec.rb @@ -100,4 +100,10 @@ expect(subject.Document).to be_a(Dotloop::Document) end end + + describe '#Participant' do + it 'should return a Participant object' do + expect(subject.Participant).to be_a(Dotloop::Participant) + end + end end diff --git a/spec/dotloop/participant_spec.rb b/spec/dotloop/participant_spec.rb index c760444..4f63367 100644 --- a/spec/dotloop/participant_spec.rb +++ b/spec/dotloop/participant_spec.rb @@ -17,7 +17,7 @@ describe '#all' do it 'should return a list of participants' do dotloop_mock(:participants) - participants = subject.all(profile_id: 1_234, loop_id: 76_046) + participants = subject.all(profile_id: 1_234, loop_view_id: 76_046) expect(participants).to_not be_empty expect(participants).to all(be_a(Dotloop::Models::Participant)) expect(participants.first).to have_attributes(