-
- All Implemented Interfaces:
-
android.os.Parcelable,java.io.Serializable,java.lang.Cloneable
public class MenigaChallenge implements Serializable, Cloneable, Parcelable
Copyright 2017 Meniga Iceland Inc.
-
-
Field Summary
Fields Modifier and Type Field Description protected UUIDidprotected DateTimeacceptedDateprotected LongtopicIdprotected Stringtitleprotected Stringdescriptionprotected ChallengeTypetypeprotected DateTimepublishDateprotected DateTimestartDateprotected DateTimeendDateprotected DateTimeparentEndDateprotected DateTimeparentStartDateprotected List<Long>categoryIdsprotected IntegertargetPercentageprotected MenigaDecimaltargetAmountprotected MenigaDecimalspentAmountprotected StringiconUrlprotected ChallengeIntervalrecurringIntervalprotected CustomChallengeColorcustomChallengeColorprotected LongparentTopicIdpublic final static Parcelable.Creator<MenigaChallenge>CREATOR
-
Method Summary
Modifier and Type Method Description intdescribeContents()voidwriteToParcel(Parcel dest, int flags)booleanequals(Object o)inthashCode()booleanisAccepted()DateTimegetMostValidStartDate()DateTimegetMostValidEndDate()static voidsetOperator(MenigaChallengesOperations operator)Sets the api operator for doing api calls MenigaChallengeclone()StringtoString()voidmerge(MenigaChallenge other)Merges another MenigaChallenge object into this. static Result<List<MenigaChallenge>>fetch()Gets all challenges - expired, suggested, accepted and disabled. static Result<MenigaChallenge>fetch(UUID id)Gets a challenge by its unique id. Result<MenigaChallenge>refresh()Refreshes this instance with fresh new data from the server (if there have been any changes that is). static Result<List<MenigaChallenge>>fetch(boolean includeExpired, boolean excludeSuggested, boolean excludeAccepted)Gets challenges based on provided parameters. static Result<List<MenigaChallenge>>fetch(FetchChallengeFilter filter)Gets all challenges matching the filter provided. Result<Void>update()Updates the instance on the server. static Result<Void>delete(UUID id)Delete the instance by id on the server. Result<Void>delete()Delete the instance on the server. Result<MenigaChallenge>accept(MenigaDecimal targetAmount)Marks the challenges object as accepted Result<Void>disable()Pauses previously accepted challenge. Result<Void>enable()Resumes previously disabled challenge. static Result<MenigaChallenge>create(String title, String description, DateTime startDate, DateTime endDate, List<Long> categoryIds, MenigaDecimal targetAmount, CustomChallengeColor color)Creates a new custom challenge object with a default value for iconId static Result<MenigaChallenge>create(String title, String description, DateTime startDate, DateTime endDate, List<Long> categoryIds, MenigaDecimal targetAmount, CustomChallengeColor color, ChallengeInterval interval)Creates a new custom challenge object with a default value for iconId static Result<MenigaChallenge>create(String title, String description, DateTime startDate, DateTime endDate, List<Long> categoryIds, MenigaDecimal targetAmount, Long iconId, CustomChallengeColor color)Creates a new custom challenge object static Result<MenigaChallenge>create(String title, String description, DateTime startDate, DateTime endDate, List<Long> categoryIds, MenigaDecimal targetAmount, Long iconId, CustomChallengeColor color, ChallengeInterval interval)Creates a new custom challenge object with a recurring interval static Result<MenigaChallenge>create(NewChallenge challenge)Creates a new custom challenge object with a recurring interval Result<List<MenigaChallenge>>history(int page, int numPerPage)Fetches previous completed instances of this challenge, if it was a recurring challenge UUIDgetId()DateTimegetAcceptedDate()LonggetTopicId()StringgetTitle()StringgetDescription()ChallengeTypegetType()DateTimegetPublishDate()DateTimegetStartDate()DateTimegetEndDate()DateTimegetParentEndDate()DateTimegetParentStartDate()List<Long>getCategoryIds()IntegergetTargetPercentage()MenigaDecimalgetTargetAmount()MenigaDecimalgetSpentAmount()StringgetIconUrl()ChallengeIntervalgetRecurringInterval()CustomChallengeColorgetCustomChallengeColor()LonggetParentTopicId()voidsetTitle(String titleIn)voidsetDescription(String desc)voidsetType(ChallengeType type)voidsetStartDate(DateTime starts)voidsetEndDate(DateTime ends)voidsetCategoryIds(List<Long> ids)voidsetTargetAmount(MenigaDecimal amt)voidsetIconUrl(String url)voidsetCustomChallengeColor(CustomChallengeColor color)-
-
Method Detail
-
describeContents
int describeContents()
-
writeToParcel
void writeToParcel(Parcel dest, int flags)
-
hashCode
int hashCode()
-
isAccepted
boolean isAccepted()
-
getMostValidStartDate
DateTime getMostValidStartDate()
-
getMostValidEndDate
DateTime getMostValidEndDate()
-
setOperator
static void setOperator(MenigaChallengesOperations operator)
Sets the api operator for doing api calls
- Parameters:
operator- An object that implements the MenigaMerchantOperations interface for carrying out api operations on this class.
-
clone
MenigaChallenge clone()
-
merge
void merge(MenigaChallenge other)
Merges another MenigaChallenge object into this. Replaces null fields on this object withfields from other if the field in other is not null
- Parameters:
other- The other MenigaChallenge object to merge with this one
-
fetch
static Result<List<MenigaChallenge>> fetch()
Gets all challenges - expired, suggested, accepted and disabled.
-
fetch
static Result<MenigaChallenge> fetch(UUID id)
Gets a challenge by its unique id.
- Parameters:
id- The id of the challenge to getChallenge
-
refresh
Result<MenigaChallenge> refresh()
Refreshes this instance with fresh new data from the server (if there have been any changes that is).
-
fetch
@Deprecated() static Result<List<MenigaChallenge>> fetch(boolean includeExpired, boolean excludeSuggested, boolean excludeAccepted)
Gets challenges based on provided parameters.
- Parameters:
includeExpired- if true includes expired challengesexcludeSuggested- if true excludes suggested challengesexcludeAccepted- if true excludes accepted challenges
-
fetch
static Result<List<MenigaChallenge>> fetch(FetchChallengeFilter filter)
Gets all challenges matching the filter provided.
- Parameters:
filter- query filter
-
update
Result<Void> update()
Updates the instance on the server. All fields that have a setter can be updated
-
accept
Result<MenigaChallenge> accept(MenigaDecimal targetAmount)
Marks the challenges object as accepted
-
create
@Deprecated() static Result<MenigaChallenge> create(String title, String description, DateTime startDate, DateTime endDate, List<Long> categoryIds, MenigaDecimal targetAmount, CustomChallengeColor color)
Creates a new custom challenge object with a default value for iconId
- Parameters:
title- Title of the challengedescription- Description of the challangestartDate- Time period start for when the challenge startsendDate- Time period end for when the challenge startscategoryIds- Category ids that this challenge applies totargetAmount- The budget target amount for the challengecolor- Color of the challenge being created
-
create
@Deprecated() static Result<MenigaChallenge> create(String title, String description, DateTime startDate, DateTime endDate, List<Long> categoryIds, MenigaDecimal targetAmount, CustomChallengeColor color, ChallengeInterval interval)
Creates a new custom challenge object with a default value for iconId
- Parameters:
title- Title of the challengedescription- Description of the challangestartDate- Time period start for when the challenge startsendDate- Time period end for when the challenge startscategoryIds- Category ids that this challenge applies totargetAmount- The budget target amount for the challengecolor- Color of the challenge being created
-
create
@Deprecated() static Result<MenigaChallenge> create(String title, String description, DateTime startDate, DateTime endDate, List<Long> categoryIds, MenigaDecimal targetAmount, Long iconId, CustomChallengeColor color)
Creates a new custom challenge object
- Parameters:
title- Title of the challengedescription- Description of the challangestartDate- Time period start for when the challenge startsendDate- Time period end for when the challenge startscategoryIds- Category ids that this challenge applies totargetAmount- The budget target amount for the challengeiconId- Id of the icon associated with the challengecolor- Color of the challenge being created
-
create
@Deprecated() static Result<MenigaChallenge> create(String title, String description, DateTime startDate, DateTime endDate, List<Long> categoryIds, MenigaDecimal targetAmount, Long iconId, CustomChallengeColor color, ChallengeInterval interval)
Creates a new custom challenge object with a recurring interval
- Parameters:
title- Title of the challengedescription- Description of the challangestartDate- Time period start for when the challenge startsendDate- Time period end for when the challenge startscategoryIds- Category ids that this challenge applies totargetAmount- The budget target amount for the challengeiconId- Id of the icon associated with the challengecolor- Color of the challenge being createdinterval- The interval between repeats, e.g.
-
create
static Result<MenigaChallenge> create(NewChallenge challenge)
Creates a new custom challenge object with a recurring interval
- Parameters:
challenge- new challenge data
-
history
Result<List<MenigaChallenge>> history(int page, int numPerPage)
Fetches previous completed instances of this challenge, if it was a recurring challenge
- Parameters:
page- The page to fetch if the number of results are more than numPerPagenumPerPage- The number of challenges per page
-
getAcceptedDate
DateTime getAcceptedDate()
-
getTopicId
Long getTopicId()
-
getDescription
String getDescription()
-
getType
ChallengeType getType()
-
getPublishDate
DateTime getPublishDate()
-
getStartDate
DateTime getStartDate()
-
getEndDate
DateTime getEndDate()
-
getParentEndDate
DateTime getParentEndDate()
-
getParentStartDate
DateTime getParentStartDate()
-
getCategoryIds
List<Long> getCategoryIds()
-
getTargetPercentage
Integer getTargetPercentage()
-
getTargetAmount
MenigaDecimal getTargetAmount()
-
getSpentAmount
MenigaDecimal getSpentAmount()
-
getIconUrl
String getIconUrl()
-
getRecurringInterval
ChallengeInterval getRecurringInterval()
-
getCustomChallengeColor
CustomChallengeColor getCustomChallengeColor()
-
getParentTopicId
Long getParentTopicId()
-
setDescription
void setDescription(String desc)
-
setType
void setType(ChallengeType type)
-
setStartDate
void setStartDate(DateTime starts)
-
setEndDate
void setEndDate(DateTime ends)
-
setCategoryIds
void setCategoryIds(List<Long> ids)
-
setTargetAmount
void setTargetAmount(MenigaDecimal amt)
-
setIconUrl
void setIconUrl(String url)
-
setCustomChallengeColor
void setCustomChallengeColor(CustomChallengeColor color)
-
-
-
-