From 40deb3da1177bdec82a5f334fc7b18e6afbb7fb7 Mon Sep 17 00:00:00 2001 From: kherinwork Date: Tue, 26 Mar 2019 14:28:22 +0400 Subject: [PATCH 1/5] update deprecated methods --- .../src/classes/SharinPixDemoAttachmentUpload.cls | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls index 42c77a5..6d60f5d 100644 --- a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls +++ b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls @@ -12,10 +12,11 @@ public class SharinPixDemoAttachmentUpload { } @future (callout=true) - public static void upload_photo(string attachmentId, string caseId){ + public static void upload_photo(Id attachmentId, string caseId){ SharinPix.Client clientInstance = SharinPix.Client.getInstance(); - if (clientInstance!=null){ - clientInstance.upload_attachment(attachmentId, caseId); + SharinPix.Utils utilsInstance = new SharinPix.Utils(clientInstance); + if (clientInstance!=null && utilsInstance!=null){ + utilsInstance.uploadAttachment(attachmentId, caseId); } else { system.debug('### Error occurred'); From 02fe09e86decce7dba92008bbf0d06b5d3cf78ed Mon Sep 17 00:00:00 2001 From: kherinwork Date: Tue, 26 Mar 2019 16:12:21 +0400 Subject: [PATCH 2/5] reduced code --- .../src/classes/SharinPixDemoAttachmentUpload.cls | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls index 6d60f5d..54d1e77 100644 --- a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls +++ b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls @@ -13,9 +13,8 @@ public class SharinPixDemoAttachmentUpload { @future (callout=true) public static void upload_photo(Id attachmentId, string caseId){ - SharinPix.Client clientInstance = SharinPix.Client.getInstance(); - SharinPix.Utils utilsInstance = new SharinPix.Utils(clientInstance); - if (clientInstance!=null && utilsInstance!=null){ + SharinPix.Utils utilsInstance = SharinPix.Utils.getInstance(); + if (utilsInstance!=null){ utilsInstance.uploadAttachment(attachmentId, caseId); } else { From f46e803844f11e4a46f76e7fbbc317302c18a9e5 Mon Sep 17 00:00:00 2001 From: kherinwork Date: Fri, 29 Mar 2019 14:23:11 +0400 Subject: [PATCH 3/5] added correct singleton method --- demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls index 54d1e77..3f0e318 100644 --- a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls +++ b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls @@ -13,7 +13,7 @@ public class SharinPixDemoAttachmentUpload { @future (callout=true) public static void upload_photo(Id attachmentId, string caseId){ - SharinPix.Utils utilsInstance = SharinPix.Utils.getInstance(); + SharinPix.Utils utilsInstance = new SharinPix.Utils(SharinPix.Client.getInstance()); if (utilsInstance!=null){ utilsInstance.uploadAttachment(attachmentId, caseId); } From 3fc2c1676f01dfc4e5ad7f21dd48c4d2f854376e Mon Sep 17 00:00:00 2001 From: kherinwork Date: Mon, 1 Apr 2019 11:30:25 +0400 Subject: [PATCH 4/5] used default constructor --- demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls index 3f0e318..91c0f50 100644 --- a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls +++ b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls @@ -13,7 +13,7 @@ public class SharinPixDemoAttachmentUpload { @future (callout=true) public static void upload_photo(Id attachmentId, string caseId){ - SharinPix.Utils utilsInstance = new SharinPix.Utils(SharinPix.Client.getInstance()); + SharinPix.Utils utilsInstance = new SharinPix.Utils(); if (utilsInstance!=null){ utilsInstance.uploadAttachment(attachmentId, caseId); } From 5b798fee55de6dac9425eb1e5b4bef2ce5e254a2 Mon Sep 17 00:00:00 2001 From: kherinwork Date: Mon, 1 Apr 2019 14:47:18 +0400 Subject: [PATCH 5/5] renamed variable --- .../src/classes/SharinPixDemoAttachmentUpload.cls | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls index 91c0f50..ba29f15 100644 --- a/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls +++ b/demo-attachment/src/classes/SharinPixDemoAttachmentUpload.cls @@ -13,9 +13,9 @@ public class SharinPixDemoAttachmentUpload { @future (callout=true) public static void upload_photo(Id attachmentId, string caseId){ - SharinPix.Utils utilsInstance = new SharinPix.Utils(); - if (utilsInstance!=null){ - utilsInstance.uploadAttachment(attachmentId, caseId); + SharinPix.Utils utils = new SharinPix.Utils(); + if (utils!=null){ + utils.uploadAttachment(attachmentId, caseId); } else { system.debug('### Error occurred');