DEV: Adds methods from invite controller (#235)

DEV: Adds methods from invite controller (#235)

diff --git a/examples/invite_users.rb b/examples/invite_users.rb
index cb70af1..ae5d711 100644
--- a/examples/invite_users.rb
+++ b/examples/invite_users.rb
@@ -14,6 +14,9 @@ invite = client.invite_user(email: "name@example.com", group_ids: "41,42")
 #update invite
 client.update_invite(invite["id"], email: "namee@example.com")
 
+# resend invite
+client.resend_invite("namee@example.com")
+
 # invite to a topic
 client.invite_user_to_topic(email: "foo@bar.com", topic_id: 1)
 
@@ -23,5 +26,11 @@ client.invite_user_to_topic(email: "foo@bar.com", group_ids: "1,2,3", topic_id: 
 # retrieve invite
 puts client.retrieve_invite(email: "foo@bar.com")
 
+# resend all invites
+client.resend_all_invites
+
+# destroy invite
+client.destroy_invite(invite["id"])
+
 # destroy all expired invites
 client.destroy_all_expired_invites
diff --git a/lib/discourse_api/api/invite.rb b/lib/discourse_api/api/invite.rb
index 9145b42..75cfdbb 100644
--- a/lib/discourse_api/api/invite.rb
+++ b/lib/discourse_api/api/invite.rb
@@ -67,6 +67,18 @@ module DiscourseApi
       def destroy_all_expired_invites
         post("invites/destroy-all-expired")
       end
+
+      def resend_all_invites
+        post("invites/reinvite-all")
+      end
+
+      def resend_invite(email)
+        post("invites/reinvite", { "email": email })
+      end
+
+      def destroy_invite(invite_id)
+        delete("/invites", { id: invite_id })
+      end
     end
   end
 end
diff --git a/spec/discourse_api/api/invite_spec.rb b/spec/discourse_api/api/invite_spec.rb
index 1247d32..caad01c 100644
--- a/spec/discourse_api/api/invite_spec.rb
+++ b/spec/discourse_api/api/invite_spec.rb
@@ -70,4 +70,54 @@ describe DiscourseApi::API::Invite do
       expect(a_post(url)).to have_been_made
     end
   end
+
+  describe "#resend_all_invites" do
+    let(:url) { "#{host}/invites/reinvite-all" }
+
+    before do
+      stub_post(url)
+        .to_return(
+          body: '{"success": "OK"}',
+          headers: { content_type: "application/json" }
+        )
+    end
+
+    it "resends all invites" do
+      subject.resend_all_invites
+      expect(a_post(url)).to have_been_made
+    end
+  end
+
+  describe "#resend_invite" do
+    let(:url) { "#{host}/invites/reinvite" }
+
+    before do
+      stub_post(url)
+        .to_return(
+          body: '{"success": "OK"}',
+          headers: { content_type: "application/json" }
+        )
+    end
+
+    it "resends invite" do
+      subject.resend_invite("foo@bar.com")
+      expect(a_post(url)).to have_been_made
+    end
+  end
+
+  describe "#destroy_invite" do
+    let(:url) { "#{host}/invites?id=27" }
+
+    before do
+      stub_delete(url).to_return(
+        body: '{"success": "OK"}',
+        headers: { content_type: "application/json" }
+      )
+    end
+
+    it "destroys the invite" do
+      subject.destroy_invite(27)
+      expect(a_delete(url)).to have_been_made
+    end
+  end
 end

GitHub sha: deff9d3b

This commit appears in #235 which was approved by blake. It was merged by blake.