forked from guibranco/BancosBrasileiros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kotlin.kt
58 lines (40 loc) · 1.27 KB
/
kotlin.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// To parse the JSON, install Klaxon and do:
//
// val bank = Bank.fromJson(jsonString)
package br.com.stracini.guilherme.bancosbrasileiros
import com.beust.klaxon.*
private val klaxon = Klaxon()
class Bank(elements: Collection<BankElement>) : ArrayList<BankElement>(elements) {
public fun toJson() = klaxon.toJsonString(this)
companion object {
public fun fromJson(json: String) = Bank(klaxon.parseArray<BankElement>(json)!!)
}
}
data class BankElement (
@Json(name = "COMPE")
val compe: String,
@Json(name = "ISPB")
val ispb: String,
@Json(name = "Document")
val document: String,
@Json(name = "LongName")
val longName: String,
@Json(name = "ShortName")
val shortName: String,
@Json(name = "Network")
val network: String,
@Json(name = "Type")
val type: String,
@Json(name = "PixType")
val pixType: String,
@Json(name = "Url")
val url: String? = null,
@Json(name = "DateOperationStarted")
val dateOperationStarted: String
@Json(name = "DatePixStarted")
val datePixStarted: String
@Json(name = "DateRegistered")
val dateRegistered: String,
@Json(name = "DateUpdated")
val dateUpdated: String
)