Skip to content

Commit

Permalink
Added Participant to Client and change Participant#all(loop_id) to Pa…
Browse files Browse the repository at this point in the history
…rticipant#all(loop_view_id)
  • Loading branch information
asselstine committed Aug 4, 2016
1 parent c04b5b4 commit 9555ffd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/dotloop/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/dotloop/participant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions spec/dotloop/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/dotloop/participant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9555ffd

Please sign in to comment.