Skip to content

Commit

Permalink
Added missing 'Ability' field to the card model object
Browse files Browse the repository at this point in the history
  • Loading branch information
r0adkll committed Feb 6, 2018
1 parent fb12ebc commit 6014f5d
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

This is the Pokémon TCG SDK Kotlin implementation. It is a wrapper around the Pokémon TCG API of [pokemontcg.io](http://pokemontcg.io)

## Installation
## Installation [![Download](https://api.bintray.com/packages/r0adkll/pokemon-tcg-sdk-kotlin/pokemon-tcg-sdk-kotlin/images/download.svg) ](https://bintray.com/r0adkll/pokemon-tcg-sdk-kotlin/pokemon-tcg-sdk-kotlin/_latestVersion)

Add this line to your `dependencies {...}` block in your `build.gradle` file

```groovy
compile 'io.pokemontcg:pokemon-tcg-sdk-kotlin:1.0.8'
compile 'io.pokemontcg:pokemon-tcg-sdk-kotlin:{latest}'
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply from: 'tools/dependencies.gradle'

buildscript {
ext.kotlin_version = '1.1.51'
ext.kotlin_version = '1.2.21'
repositories {
google()
jcenter()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
org.gradle.jvmargs=-Xmx1536m

GROUP=io.pokemontcg
VERSION_NAME=1.0.8
VERSION_NAME=1.0.9
VERSION_DESC="Kotlin PokemonTCG SDK"

POM_YEAR=2017
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ internal object ModelMapper {
model.text,
model.attacks?.map { to(it) },
model.weaknesses?.map { to(it) },
model.resistances?.map { to(it) }
model.resistances?.map { to(it) },
model.ability?.let { to(it) }
)
}


fun to(model: AbilityModel): Ability {
return Ability(model.name, model.text, model.type)
}


fun to(model: AttackModel): Attack {
return Attack(
model.cost?.map { Type.find(it) },
Expand Down
10 changes: 9 additions & 1 deletion library/src/main/kotlin/io/pokemontcg/internal/api/models.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ internal class CardModel(
val text: List<String>?,
val attacks: List<AttackModel>?,
val weaknesses: List<EffectModel>?,
val resistances: List<EffectModel>?
val resistances: List<EffectModel>?,
val ability: AbilityModel?
)


Expand All @@ -51,6 +52,13 @@ internal class CardSetModel(
)


internal class AbilityModel(
val name: String,
val text: String,
val type: String
)


internal class AttackModel(
val cost: List<String>?,
val name: String,
Expand Down
8 changes: 8 additions & 0 deletions library/src/main/kotlin/io/pokemontcg/model/Ability.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.pokemontcg.model


data class Ability(
val name: String,
val text: String,
val type: String
)
3 changes: 2 additions & 1 deletion library/src/main/kotlin/io/pokemontcg/model/Card.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ data class Card(
val text: List<String>?,
val attacks: List<Attack>?,
val weaknesses: List<Effect>?,
val resistances: List<Effect>?
val resistances: List<Effect>?,
val ability: Ability?
)

0 comments on commit 6014f5d

Please sign in to comment.