Example #1
0
        public void AssociationCreateFindAndDelete()
        {
            var fileId = FindAFileId();
            var objectId = FindAnInvoiceId();

            Assert.DoesNotThrow(() =>
            {
                var toCreate = new Association
                {
                    FileId = fileId,
                    ObjectId = objectId,
                    ObjectGroup = ObjectGroupType.Invoice
                };
                var created = Api.Associations.Create(toCreate);
                Debug.WriteLine("Created {0}", created);
            });

            Assert.DoesNotThrow(() =>
            {
                var found = Api.Associations.Find(fileId, objectId);
                Debug.WriteLine("Found {0}", found);
            });

            Assert.DoesNotThrow(() =>
            {
                var toDelete = new Association
                {
                    FileId = fileId,
                    ObjectId = objectId,
                    ObjectGroup = ObjectGroupType.Invoice
                };
                Api.Associations.Delete(toDelete);
                Debug.WriteLine("Deleted {0}", toDelete);
            });
        }
 public void Delete(Association association)
 {
     var endpoint = string.Format("files.xro/1.0/Files/{0}/Associations/{1}", association.FileId,
         association.ObjectId);
     HandleAssociationResponse(Client.Client.Delete(endpoint));
 }
 public Association Create(Association association)
 {
     var endpoint = string.Format("files.xro/1.0/Files/{0}/Associations", association.FileId);
     var resp = Client.Client.Post(endpoint, Client.JsonMapper.To(association), "application/json");
     return HandleAssociationResponse(resp);
 }