Skip to content

Commit 4dd1e78

Browse files
Merge pull request #136 from alexanderjordanbaker/UrlSelectionMethod
Update BaseAppStoreServerAPIClient to move URL selection to a method
2 parents 7c8b5c2 + 9af9a6d commit 4dd1e78

File tree

7 files changed

+24
-20
lines changed

7 files changed

+24
-20
lines changed

.github/workflows/ci-prb.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: sudo -E env "PATH=$PATH" bash -c "ulimit -l 65536 && ulimit -a && ./gradlew --no-daemon --parallel clean test"
3232
- name: Upload Test Results
3333
if: always()
34-
uses: actions/upload-artifact@v3
34+
uses: actions/upload-artifact@v4
3535
with:
3636
name: test-results-${{ matrix.os }}-${{ matrix.java }}
3737
path: '**/build/test-results/test/TEST-*.xml'

.github/workflows/ci-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
./gradlew --no-daemon --parallel publish"
3434
- name: Upload Test Results
3535
if: always()
36-
uses: actions/upload-artifact@v3
36+
uses: actions/upload-artifact@v4
3737
with:
3838
name: test-results-${{ matrix.os }}-${{ matrix.java }}
3939
path: '**/build/test-results/test/TEST-*.xml'

.github/workflows/ci-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
|| exit 1) || exit 0"
3939
- name: Upload Test Results
4040
if: always()
41-
uses: actions/upload-artifact@v3
41+
uses: actions/upload-artifact@v4
4242
with:
4343
name: test-results-${{ matrix.os }}-${{ matrix.java }}
4444
path: '**/build/test-results/test/TEST-*.xml'

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## Version 3.3.0
4+
- Update BaseAppStoreServerAPIClient to move URL selection to a method
5+
36
## Version 3.2.0
47
- Incorporate caching of validated certificate chains to prevent repetitive OCSP fetches [https://github.com/apple/app-store-server-library-java/pull/127]
58

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The Java server library for the [App Store Server API](https://developer.apple.c
1515

1616
### Gradle
1717
```groovy
18-
implementation 'com.apple.itunes.storekit:app-store-server-library:3.2.0'
18+
implementation 'com.apple.itunes.storekit:app-store-server-library:3.3.0'
1919
2020
```
2121

@@ -24,7 +24,7 @@ implementation 'com.apple.itunes.storekit:app-store-server-library:3.2.0'
2424
<dependency>
2525
<groupId>com.apple.itunes.storekit</groupId>
2626
<artifactId>app-store-server-library</artifactId>
27-
<version>3.2.0</version>
27+
<version>3.3.0</version>
2828
</dependency>
2929
```
3030

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=3.2.0
1+
version=3.3.0
22
group=com.apple.itunes.storekit

src/main/java/com/apple/itunes/storekit/client/BaseAppStoreServerAPIClient.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public abstract class BaseAppStoreServerAPIClient {
4141
private static final String PRODUCTION_URL = "https://api.storekit.itunes.apple.com";
4242
private static final String SANDBOX_URL = "https://api.storekit-sandbox.itunes.apple.com";
4343
private static final String LOCAL_TESTING_URL = "https://local-testing-base-url";
44-
private static final String USER_AGENT = "app-store-server-library/java/3.2.0";
44+
private static final String USER_AGENT = "app-store-server-library/java/3.3.0";
4545
private static final String JSON = "application/json; charset=utf-8";
4646

4747
private final BearerTokenAuthenticatorInterface bearerTokenAuthenticator;
@@ -55,29 +55,30 @@ public BaseAppStoreServerAPIClient(String signingKey, String keyId, String issue
5555

5656
public BaseAppStoreServerAPIClient(BearerTokenAuthenticatorInterface bearerTokenAuthenticator, Environment environment) {
5757
this.bearerTokenAuthenticator = bearerTokenAuthenticator;
58+
this.url = getUrlForEnvironment(environment);
59+
this.objectMapper = new ObjectMapper();
60+
objectMapper.setVisibility(objectMapper.getSerializationConfig().getDefaultVisibilityChecker()
61+
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
62+
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
63+
.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE)
64+
.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
65+
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE));
66+
}
67+
68+
protected String getUrlForEnvironment(Environment environment) {
5869
switch (environment) {
5970
case XCODE:
6071
throw new IllegalArgumentException("Xcode is not a supported environment for an AppStoreServerAPIClient");
6172
case PRODUCTION:
62-
this.url = PRODUCTION_URL;
63-
break;
73+
return PRODUCTION_URL;
6474
case LOCAL_TESTING:
65-
this.url = LOCAL_TESTING_URL;
66-
break;
75+
return LOCAL_TESTING_URL;
6776
case SANDBOX:
68-
this.url = SANDBOX_URL;
69-
break;
77+
return SANDBOX_URL;
7078
default:
7179
// This switch statement is exhaustive
7280
throw new IllegalStateException();
7381
}
74-
this.objectMapper = new ObjectMapper();
75-
objectMapper.setVisibility(objectMapper.getSerializationConfig().getDefaultVisibilityChecker()
76-
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
77-
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
78-
.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE)
79-
.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
80-
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE));
8182
}
8283

8384
/**

0 commit comments

Comments
 (0)