Skip to content

Commit 2670b33

Browse files
committed
Update README to reflect 1.0.0 changes (closes #88)
1 parent 7934caa commit 2670b33

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ val refererParser = "com.snowplowanalytics" %% "scala-referer-parser" % "0.6.0"
2121

2222
### Usage
2323

24-
All effects within the Scala implementation are wrapped in `Sync` from [cats-effect][cats-effect]. In these examples we use `IO`, but anything that implements `Sync` can be used.
24+
You can provide wrappers for effects, such as `Sync`, `Eval` or `Id` from [cats-effect][cats-effect]. In the examples below we use `IO`.
2525

2626
```scala
27-
import com.snowplowanalytics.refererparser.Parser
27+
import com.snowplowanalytics.refererparser._
2828
import cats.effect.IO
2929
import cats.data.EitherT
3030
import java.net.URI
@@ -36,14 +36,14 @@ val referersJsonPath = "/opt/referers/referers.json"
3636

3737
// We use EitherT to handle exceptions. The IO routine will short circuit if an exception is returned.
3838
val io: EitherT[IO, Exception, Unit] = for {
39-
// We can instantiate a new Parse instance with Parse.create
40-
parser <- EitherT(Parser.create[IO](referersJsonPath))
39+
// We can instantiate a new Parser instance with Parser.create
40+
parser <- EitherT(CreateParser[IO].create(referersJsonPath))
4141

4242
// Referer is a sealed hierarchy of different referer types
4343
referer1 <- EitherT.fromOption[IO](parser.parse(refererUrl, pageUrl),
4444
new Exception("No parseable referer"))
4545
_ <- EitherT.right(IO { println(referer1) })
46-
// => SearchReferer(Google, Some(gateway oracle cards denise linn))
46+
// => SearchReferer(SearchMedium,Google,Some(gateway oracle cards denise linn))
4747

4848
// You can provide a list of domains which should be considered internal
4949
referer2 <- EitherT.fromOption[IO](parser.parse(
@@ -52,8 +52,7 @@ val io: EitherT[IO, Exception, Unit] = for {
5252
List("www.subdomain1.snowplowanalytics.com", "www.subdomain2.snowplowanalytics.com")
5353
), new Exception("No parseable referer"))
5454
_ <- EitherT.right(IO { println(referer2) })
55-
// => InternalReferer
56-
55+
// => InternalReferer(InternalMedium)
5756

5857
// Various overloads are available for common cases, for instance
5958
maybeReferer1 = parser.parse("https://www.bing.com/search?q=snowplow")

0 commit comments

Comments
 (0)