-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coupon.type to enum #182
Merged
Merged
Coupon.type to enum #182
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9ae079c
Coupon type to enum
d053a54
Add new API version V20181016
7209bdf
CouponApi with only parameters object
588f9ed
Rewrite CouponApi with modern standards
4bb6ea9
code review
9d3a218
Introduce MethodNotAllowedException
560a1ed
Factory to generate SimpleDateFormats with predefined formats
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
cloudesire-api-client/src/main/java/com/cloudesire/platform/apiclient/ClientDate.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.cloudesire.platform.apiclient; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
|
||
abstract class ClientDate | ||
{ | ||
protected final Date date; | ||
|
||
ClientDate( Date date ) | ||
{ | ||
this.date = date; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
final SimpleDateFormat dateFormat = getDateFormat(); | ||
return dateFormat.format( date ); | ||
} | ||
|
||
public abstract SimpleDateFormat getDateFormat(); | ||
|
||
public Date getDate() | ||
{ | ||
return date; | ||
} | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,10 @@ | |
|
||
abstract class BaseQuery extends HashMap<String, Object> | ||
{ | ||
@Override | ||
public Object put( String key, Object value ) | ||
{ | ||
if ( value == null ) return super.remove( key ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔝 |
||
return super.put( key, value ); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...re-api-client/src/main/java/com/cloudesire/platform/apiclient/query/CouponFetchQuery.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.cloudesire.platform.apiclient.query; | ||
|
||
import com.cloudesire.platform.apiclient.ISO8601Date; | ||
import com.liberologico.cloudesire.cmw.model.enums.CouponType; | ||
|
||
public class CouponFetchQuery extends PageRequestQuery | ||
{ | ||
private static final String TYPE = "type"; | ||
private static final String PRODUCT = "product"; | ||
private static final String CREATED_AFTER = "createdAfter"; | ||
private static final String UNUSED = "unused"; | ||
private static final String REUSABLE = "reusable"; | ||
|
||
public CouponFetchQuery setType( CouponType type ) | ||
{ | ||
put( TYPE, type.toString() ); | ||
return this; | ||
} | ||
|
||
public CouponFetchQuery setProduct( Integer product ) | ||
{ | ||
put( PRODUCT, product ); | ||
return this; | ||
} | ||
|
||
public CouponFetchQuery setCreatedAfter( ISO8601Date creation ) | ||
{ | ||
put( CREATED_AFTER, creation ); | ||
return this; | ||
} | ||
|
||
public CouponFetchQuery setUnused( Boolean unused ) | ||
{ | ||
put( UNUSED, unused ); | ||
return this; | ||
} | ||
|
||
public CouponFetchQuery setReusable( Boolean reusable ) | ||
{ | ||
put( REUSABLE, reusable ); | ||
return this; | ||
} | ||
} |
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
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
52 changes: 52 additions & 0 deletions
52
...re-api-client/src/main/java/com/cloudesire/platform/apiclient/query/CouponTrialQuery.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.cloudesire.platform.apiclient.query; | ||
|
||
import com.cloudesire.platform.apiclient.ISO8601DateTime; | ||
import com.liberologico.cloudesire.cmw.model.enums.CouponType; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public class CouponTrialQuery extends BaseQuery | ||
{ | ||
private static final String TYPE = "type"; | ||
private static final String PRODUCT_VERSION = "productVersion"; | ||
private static final String PRODUCT = "product"; | ||
private static final String EXPIRATION_DATE = "expirationDate"; | ||
private static final String DAYS = "days"; | ||
private static final String PLAFOND = "plafond"; | ||
|
||
public CouponTrialQuery() | ||
{ | ||
put( TYPE, CouponType.EXTENDED_TRIAL.toString() ); | ||
} | ||
|
||
public CouponTrialQuery setProductVersion( Integer productVersion ) | ||
{ | ||
put( PRODUCT_VERSION, productVersion ); | ||
return this; | ||
} | ||
|
||
public CouponTrialQuery setProduct( Integer product ) | ||
{ | ||
put( PRODUCT, product ); | ||
return this; | ||
} | ||
|
||
public CouponTrialQuery setExpiration( ISO8601DateTime expiration ) | ||
{ | ||
put( EXPIRATION_DATE, expiration ); | ||
return this; | ||
} | ||
|
||
public CouponTrialQuery setDays( Integer days ) | ||
{ | ||
put( DAYS, days ); | ||
return this; | ||
} | ||
|
||
public CouponTrialQuery setPlafond( BigDecimal number ) | ||
{ | ||
put( PLAFOND, number ); | ||
return this; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DateRepresentation
?AbstractDateDeserializer
?