Skip to content

Commit

Permalink
Add send_invite to Vendor API
Browse files Browse the repository at this point in the history
  • Loading branch information
groeneman committed Nov 17, 2015
1 parent 95c330d commit 7bb8bb3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rubill/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def self.void_received_payment(id)
execute("/VoidARPayment.json", id: id)
end

def self.send_vendor_invite(vendorId, email)
execute("/SendVendorInvite.json", vendorId: vendorId, email: email)
end

def execute
Session.instance.execute(self)
end
Expand Down
4 changes: 4 additions & 0 deletions lib/rubill/vendor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ def bills
Query::Filter.new("vendorId", "=", id),
])
end

def send_invite(email)
Query.send_vendor_invite(id, email)
end
end
end
14 changes: 14 additions & 0 deletions spec/query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,19 @@ module Rubill
described_class.pay_bills(options)
end
end

describe ".send_vendor_invite" do
let(:url) { "/SendVendorInvite.json" }
let(:query) { double(execute: true) }
let(:vendor_id) { '1234' }
let(:email) { '[email protected]' }
let(:options) { Hash[vendorId: '1234', email: '[email protected]'] }

it "creates a new Query object and executes it" do
expect(described_class).to receive(:new).with(url, options) { query }
expect(query).to receive(:execute)
described_class.send_vendor_invite(vendor_id, email)
end
end
end
end

0 comments on commit 7bb8bb3

Please sign in to comment.