mirror of
https://github.com/jlengrand/OpenGraphKt.git
synced 2026-03-10 08:31:23 +00:00
Adds isValid method in data class
This commit is contained in:
@@ -6,19 +6,12 @@ plugins {
|
||||
group = "nl.lengrand"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
val ksoupVersion = "0.2.3"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// implementation("com.fleeksoft.ksoup:ksoup:$ksoupVersion")
|
||||
//// implementation("com.fleeksoft.ksoup:ksoup-kotlinx:$ksoupVersion")
|
||||
// implementation("com.fleeksoft.ksoup:ksoup-okio:$ksoupVersion")
|
||||
// implementation("com.fleeksoft.ksoup:ksoup-network:$ksoupVersion")
|
||||
implementation("org.jsoup:jsoup:1.20.1")
|
||||
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
|
||||
@@ -19,5 +19,4 @@ class DocumentFetcher {
|
||||
fun fromFile() : Document {
|
||||
TODO()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ data class OpenGraphTag(
|
||||
)
|
||||
|
||||
data class OpenGraph(
|
||||
|
||||
// Tags can have multiple values for the same property, so we cannot use a Map.
|
||||
val rawTags: Elements,
|
||||
val tags: List<OpenGraphTag>,
|
||||
@@ -19,7 +20,11 @@ data class OpenGraph(
|
||||
val url: String? = null,
|
||||
|
||||
// TODO : Continue with more
|
||||
)
|
||||
){
|
||||
fun isValid(): Boolean {
|
||||
return title != null && type != null && image != null && url != null
|
||||
}
|
||||
}
|
||||
|
||||
class Parser {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user