Skip to content

Commit 382bf43

Browse files
committed
Initial commit
0 parents  commit 382bf43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2796
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea
5+
.DS_Store
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
/out

LICENSE.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2019 Evolv Technology Solutions
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Ascend Java SDK
2+
3+
#### Vocabulary
4+
5+
**Participant:** The end user of the application, the individual who's actions are being recorded in the experiment.
6+
**Allocation:** The set of configurations that have been given to the participant, the values that are being
7+
experimented against.
8+
9+
### Client Initialization
10+
11+
1. Build an AscendConfig instance.
12+
```java
13+
AscendConfig config = AscendConfig.builder(<environment_id>).build();
14+
```
15+
16+
2. Initialize the AscendClient.
17+
```java
18+
AscendClient client = AscendClientFactory.init(config);
19+
```
20+
21+
### Confirm the Allocation
22+
23+
1. Once the client has been initialized, confirm the participant into the experiment.
24+
```java
25+
client.confirm();
26+
```
27+
*Note: After the client has initialized, it is important to confirm the participant into the experiment. This action
28+
records the participant's allocation and sends the info back to Ascend.*
29+
30+
### Value Retrieval
31+
32+
1. Retrieve values from Ascend.
33+
```java
34+
T value = client.get(<key_for_value>, <default_value>);
35+
```
36+
37+
*Note: The return value's type is decided by the provided default value's type. If there is an issue retrieving the
38+
requested value, the default value will be returned in its place. This method is blocking, it will wait until the
39+
allocation has been received.*
40+
41+
### Value Subscription
42+
43+
You may want to use a value from your allocation without blocking the execution of your application. If this is true, you can
44+
subscribe to a value and apply any actions as a result of it asynchronously.
45+
46+
1. Subscribe to a value from Ascend.
47+
```java
48+
client.subscribe(<key_for_value>, <default_value>, value -> {
49+
Your code...
50+
});
51+
```
52+
53+
*Note: The return value's type is decided by the provided default value's type. If there is an issue retrieving the
54+
requested value, the default value will be returned in its place. If you have a previous allocation stored the
55+
value will be retrieved and then your code will be executed. When the new allocation is retrieved if the value
56+
differs from the previously stored allocation then your code will be ran again with the new value. If your code
57+
results in an Exception it will be thrown.*
58+
59+
### Custom Events (optional)
60+
61+
Sometimes you may want to record certain events that occurred during the participant's session. An example of an event
62+
thats important to record is a "conversion" event. If you implemented the SDK in a shopping app, you could send the
63+
"conversion" event when the participant presses the checkout button.
64+
65+
1. Emit a custom event.
66+
```java
67+
client.emitEvent(<event_type>);
68+
```
69+
70+
AND / OR
71+
72+
2. Emit a custom event with an associated score.
73+
```java
74+
client.emitEvent(<event_type>, <score>);
75+
```
76+
77+
### Contaminate the Allocation (optional)
78+
79+
Sometimes it may be necessary to contaminate the participant's allocation. Meaning, that you may not want that participant's session to be recorded into the experiment.
80+
81+
1. Contaminate the participant's allocation.
82+
```java
83+
client.contaminate();
84+
```
85+
86+
### Custom Allocation Store (optional)
87+
88+
Once a participant has been allocated into an experiment you may want to retain the allocations they received. To do this, create a custom allocation store by implementing the AscendAllocationStore interface. You can supply the
89+
custom allocation store to the client when you build the AscendConfig.
90+
91+
1. Supply the allocation store to the client.
92+
```java
93+
AscendConfig config = AscendConfig.Builder(<environment_id>)
94+
.setAscendAllocationStore(<custom_store>)
95+
.build();
96+
AscendClient client = AscendClient.init(config);
97+
```
98+
99+
### Optional Configurations
100+
101+
There are several optional configurations available through the AscendConfig builder, check out the AscendConfig
102+
documentation to see what options are available.
103+
104+
### About Evolv and the Ascend Product
105+
106+
Evolv Delivers Autonomous Optimization Across Web & Mobile.
107+
108+
You can find out more by visiting: https://www.evolv.ai/

build.gradle

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
plugins {
2+
id 'java'
3+
id 'maven'
4+
id 'signing'
5+
}
6+
7+
group = "ai.evolv"
8+
archivesBaseName = "ascend-sdk"
9+
version = "0.5.0"
10+
11+
sourceCompatibility = 1.8
12+
13+
repositories {
14+
google()
15+
mavenCentral()
16+
}
17+
18+
ext.libraries = [:]
19+
20+
libraries.required = [
21+
'com.google.code.gson:gson:2.8.5',
22+
'org.slf4j:slf4j-api:1.7.26'
23+
]
24+
25+
libraries.optional = [
26+
'com.squareup.okhttp3:okhttp:3.14.0',
27+
'org.asynchttpclient:async-http-client:2.0.38'
28+
]
29+
30+
libraries.test = [
31+
'log4j:log4j:1.2.17',
32+
'org.apache.logging.log4j:log4j-slf4j-impl:2.11.2',
33+
'org.mockito:mockito-core:2.1.0',
34+
'junit:junit:4.12'
35+
]
36+
37+
dependencies {
38+
implementation libraries.required, libraries.optional, libraries.test
39+
testImplementation libraries.test
40+
}
41+
42+
task sourcesJar(type: Jar, dependsOn: classes) {
43+
classifier = 'sources'
44+
from sourceSets.main.allSource
45+
}
46+
47+
task javadocJar(type: Jar, dependsOn: javadoc) {
48+
classifier = 'javadoc'
49+
from javadoc.destinationDir
50+
}
51+
52+
artifacts {
53+
archives javadocJar
54+
archives sourcesJar
55+
}
56+
57+
signing {
58+
sign configurations.archives
59+
}
60+
61+
uploadArchives {
62+
repositories {
63+
mavenDeployer {
64+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
65+
66+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
67+
authentication(userName: ossrhUsername, password: ossrhPassword)
68+
}
69+
70+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
71+
authentication(userName: ossrhUsername, password: ossrhPassword)
72+
}
73+
74+
pom.project {
75+
name 'Ascend SDK'
76+
packaging 'jar'
77+
// optionally artifactId can be defined here
78+
description 'SDK to interact with the Ascend product.'
79+
url 'https://www.evolv.ai/ascend/'
80+
81+
scm {
82+
connection 'scm:git:git://github.com/evolv-ai/ascend-java-sdk.git'
83+
developerConnection 'scm:git:ssh:git@github.com:evolv-ai/ascend-java-sdk.git'
84+
url 'https://github.com/evolv-ai/ascend-java-sdk'
85+
}
86+
87+
licenses {
88+
license {
89+
name 'The Apache License, Version 2.0'
90+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
91+
}
92+
}
93+
94+
developers {
95+
developer {
96+
id 'frazerbayley'
97+
name 'Frazer Bayley'
98+
email 'frazer.bayley@evolv.ai'
99+
}
100+
}
101+
}
102+
}
103+
}
104+
}

gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
signing.keyId=
2+
signing.password=
3+
signing.secretKeyRingFile=
4+
5+
ossrhUsername=
6+
ossrhPassword=

gradle/wrapper/gradle-wrapper.jar

54.9 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Wed Apr 10 07:54:11 PDT 2019
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip

0 commit comments

Comments
 (0)