Skip to content

Commit

Permalink
Readme changes, Tier -> PromotionTier, demo keys changed
Browse files Browse the repository at this point in the history
  • Loading branch information
szandrzej committed Apr 18, 2018
1 parent 5fdf046 commit ebcd128
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -185,7 +185,7 @@ client.validations()
### [Redeem Promotions]

```java
client.redemptions().redeem(Tier tier, RedemptionContext context)
client.redemptions().redeem(PromotionTier promotionTier, RedemptionContext context)
```

#### Listing vouchers API
Expand Down Expand Up @@ -289,7 +289,7 @@ For example to set the button background color to light green:
Bug reports and pull requests are welcome through [GitHub Issues](https://github.com/voucherifyio/voucherify-android-sdk/issues).

## Changelog
- **2018-04-16** - `2.0.0` - New SDK API
- **2018-04-16** - `2.0.0` - Adjusted API for Validation and Redemption
- **2018-04-05** - `1.1.0` - Added API for Promotions and Vouchers Listing
- **2017-01-02** - `1.0.0` - Unify API with other voucherify SDKs.
- **2016-09-20** - `0.6.0` - Redeem a voucher.
Expand Down
Expand Up @@ -33,8 +33,8 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);

voucherifyClient = new VoucherifyAndroidClient.Builder(
"c7306167-294a-4c06-aa5b-d81ee8155a00",
"07bca261-3bd3-49cc-a58a-8ffce2d20d1b")
"011240bf-d5fc-4ef1-9e82-11eb68c43bf5",
"9e2230c5-71fb-460a-91c6-fbee64707a20")
.withCustomTrackingId("demo-android")
.setLogLevel(HttpLoggingInterceptor.Level.BODY)
.build();
Expand Down
@@ -1,13 +1,13 @@
package io.voucherify.android.client.model;

public class Tier {
public class PromotionTier {

public static Tier create(String id) {
return new Tier(id);
public static PromotionTier create(String id) {
return new PromotionTier(id);
}
private String id;

public Tier(String id) {
public PromotionTier(String id) {
this.id = id;
}

Expand Down
Expand Up @@ -7,7 +7,7 @@
import io.voucherify.android.client.api.VoucherifyApi;
import io.voucherify.android.client.callback.VoucherifyCallback;
import io.voucherify.android.client.exception.VoucherifyError;
import io.voucherify.android.client.model.Tier;
import io.voucherify.android.client.model.PromotionTier;
import io.voucherify.android.client.model.RedemptionContext;
import io.voucherify.android.client.model.VoucherRedemptionResult;
import io.voucherify.android.client.utils.RxUtils;
Expand All @@ -33,9 +33,9 @@ ExtRxJava createRxJavaExtension() {
return new ExtRxJava();
}

public VoucherRedemptionResult redeem(Tier tier, RedemptionContext redemptionContext)
public VoucherRedemptionResult redeem(PromotionTier promotionTier, RedemptionContext redemptionContext)
throws IOException {
return api.redeemPromotion(tier.getId(), redemptionContext, trackingId).execute().body();
return api.redeemPromotion(promotionTier.getId(), redemptionContext, trackingId).execute().body();
}

public VoucherRedemptionResult redeem(String code) throws IOException {
Expand Down Expand Up @@ -68,11 +68,11 @@ public VoucherRedemptionResult method() throws IOException {
}

public Observable<VoucherRedemptionResult> redeem(
final Tier tier, final RedemptionContext redemptionContext) {
final PromotionTier promotionTier, final RedemptionContext redemptionContext) {
return RxUtils.defer(new RxUtils.DefFunc<VoucherRedemptionResult>() {
@Override
public VoucherRedemptionResult method() throws IOException {
return Redemption.this.redeem(tier, redemptionContext);
return Redemption.this.redeem(promotionTier, redemptionContext);
}
});
}
Expand All @@ -92,10 +92,10 @@ public void redeem(String code,
RxUtils.subscribe(scheduler, rx().redeem(code, redemptionContext), callback);
}

public void redeem(Tier tier, final RedemptionContext redemptionContext,
public void redeem(PromotionTier promotionTier, final RedemptionContext redemptionContext,
VoucherifyCallback<VoucherRedemptionResult,
VoucherifyError> callback) {
RxUtils.subscribe(scheduler, rx().redeem(tier, redemptionContext), callback);
RxUtils.subscribe(scheduler, rx().redeem(promotionTier, redemptionContext), callback);
}
}
}

0 comments on commit ebcd128

Please sign in to comment.