Skip to content

Instantly share code, notes, and snippets.

View monospacesoftware's full-sized avatar

Paul Cowan monospacesoftware

View GitHub Profile
@monospacesoftware
monospacesoftware / SalesForceClient.java
Created November 7, 2020 15:14
How to use Spring Boot WebClient to access an OAuth2 password protected REST API
package com.foo;
@Slf4j
@Service
public class SalesForceClient {
private final WebClient webClient;
public SalesForceService(@Qualifier("salesForceWebClient") WebClient webClient) {
this.webClient = webClient;
int x = 0;
try {
x = Integer.parseInt(strVal);
} catch (NumberFormatException e) {
x = defaultVal;
}
@staticmethod
def to_bool(val: any) -> bool:
return val in [True, 1, '1', 'True', 'T', 'true', 't', 'Yes' 'Y', 'yes', 'y']
commit 8d0f31224615e1dff506cf7d91cd1105be2a7be7
Author: John Doe <jd@developer.com>
Date: Tue Dec 12 16:34:37 2017 -0500
Issue873: adding user schema validation
def update_item_status(self, incoming_data):
if 'id' not in incoming_data or 'status' not in incoming_data:
return
new_status = incoming_data['status']
for item in self.items:
if item.id != incoming_data['id'] or item.status == new_status:
continue
item.status = new_status
print(f"item {item.id} set {new_status}")
def update_item_status(self, incoming_data):
if 'id' in incoming_data:
if 'status' in incoming_data:
new_status = incoming_data['status']
for item in self.items:
if item.id == incoming_data['id']:
if item.status != new_status:
print(f"item {item.id} set {new_status}")
item.status = new_status
commit 8d0f31224615e1dff506cf7d91cd1105be2a7be7
Merge: e8ba40df 71076e0d
Author: John Doe <jd@developer.com>
Date: Tue Dec 12 16:34:37 2017 -0500
Merge branch 'master' of https://github.com/monospacesoftware/quickstart
commit 8d0f31224615e1dff506cf7d91cd1105be2a7be7
Author: John Doe <jd@developer.com>
Date: Tue Dec 12 16:34:37 2017 -0500
Issue873 fix
import logging
class DataManager:
def __init__(self, endpoint):
self.logger = logging.getLogger(f"{__name__}.{self.__class__.__name__}")
self.endpoint = endpoint
def connect(self):
self.logger.info(f"Connecting to {self.endpoint}")
import logging
class DataManager:
def __init__(self, endpoint):
self.logger = logging.getLogger(__name__)
self.endpoint = endpoint
def connect(self):
self.logger.info("DataManager connecting")