This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<SObject> getObjects (Set<Id> recordIds) { | |
Id dummyId = (new List<Id>(recordIds))[0]; | |
String objectName = Id.valueOf(dummyId).getSObjectType().getDescribe().getLocalName(); | |
Set<String> fields = Id.valueOf(dummyId).getSObjectType().getDescribe().fields.getMap().keySet(); | |
String query = 'SELECT '; | |
for (String f : fields) { | |
query += f + ', '; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The MIT License (MIT) | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to | |
* deal in the Software without restriction, including without limitation the | |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
* sell copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The MIT License (MIT) | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to | |
* deal in the Software without restriction, including without limitation the | |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
* sell copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Callout mock for the Google Drive API class | |
* | |
* Please note that the "generateRandomString" was not originally part of this class. I've added this method because there | |
* were lots of IDs hardcoded into the URL's inside the JSON responses. Those should not, in theory, affect the tests where | |
* this mock is used. | |
*/ | |
@IsTest | |
global class GoogleDriveCalloutMock implements HttpCalloutMock { | |
global HTTPResponse respond (HTTPRequest req) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class Telegram { | |
public static void sendMessage (String message, User user) { | |
sendMessage(message, user.TelegramId__c); | |
} | |
public static void sendMessage (String message, String telegram_id) { | |
HttpRequest req = new HttpRequest(); | |
req.setEndpoint('https://api.telegram.org/bot' + TelegramBot__c.getOrgDefaults().Token__c + '/sendMessage'); | |
req.setMethod('POST'); | |
req.setHeader('content-type', 'application/json'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from json import dumps | |
from xmljson import parker as pk | |
from xml.etree.ElementTree import fromstring | |
endpoint = 'http://webserviceurlhere/number' | |
xml = requests.get(endpoint).text | |
result = dumps(pk.data(fromstring(xml))) | |
print(result) |
NewerOlder