1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.technical.webflow
21 
22 import java.net.URI
23 
24 import com.typesafe.config.Config
25 import org.make.api.ConfigComponent
26 
27 class WebflowConfiguration(config: Config) {
28   val apiUrl: URI = new URI(config.getString("api-url"))
29   val token: String = config.getString("token")
30   val httpBufferSize: Int = config.getInt("http-buffer-size")
31   val blogUrl: URI = new URI(config.getString("blog-url"))
32   val rateLimitPerMinute: Int = config.getInt("rate-limit-per-minute")
33   val collectionsIds: Map[String, String] = Map(
34     "FR" -> config.getString("collections-ids.fr"),
35     "GB" -> config.getString("collections-ids.gb"),
36     "DE" -> config.getString("collections-ids.de"),
37     "BE" -> config.getString("collections-ids.be")
38   )
39 }
40 
41 trait WebflowConfigurationComponent {
42   def webflowConfiguration: WebflowConfiguration
43 }
44 
45 trait DefaultWebflowConfigurationComponent extends WebflowConfigurationComponent { this: ConfigComponent =>
46   override lazy val webflowConfiguration: WebflowConfiguration =
47     new WebflowConfiguration(config.getConfig("make-api.webflow"))
48 }
Line Stmt Id Pos Tree Symbol Tests Code
28 18535 950 - 977 Apply com.typesafe.config.Config.getString WebflowConfiguration.this.config.getString("api-url")
28 18471 942 - 978 Apply java.net.URI.<init> new java.net.URI(WebflowConfiguration.this.config.getString("api-url"))
29 18578 1001 - 1026 Apply com.typesafe.config.Config.getString WebflowConfiguration.this.config.getString("token")
30 18546 1055 - 1088 Apply com.typesafe.config.Config.getInt WebflowConfiguration.this.config.getInt("http-buffer-size")
31 18487 1118 - 1146 Apply com.typesafe.config.Config.getString WebflowConfiguration.this.config.getString("blog-url")
31 18419 1110 - 1147 Apply java.net.URI.<init> new java.net.URI(WebflowConfiguration.this.config.getString("blog-url"))
32 18525 1180 - 1218 Apply com.typesafe.config.Config.getInt WebflowConfiguration.this.config.getInt("rate-limit-per-minute")
33 18475 1263 - 1478 Apply scala.collection.MapFactory.apply scala.Predef.Map.apply[String, String](scala.Predef.ArrowAssoc[String]("FR").->[String](WebflowConfiguration.this.config.getString("collections-ids.fr")), scala.Predef.ArrowAssoc[String]("GB").->[String](WebflowConfiguration.this.config.getString("collections-ids.gb")), scala.Predef.ArrowAssoc[String]("DE").->[String](WebflowConfiguration.this.config.getString("collections-ids.de")), scala.Predef.ArrowAssoc[String]("BE").->[String](WebflowConfiguration.this.config.getString("collections-ids.be")))
34 18501 1272 - 1276 Literal <nosymbol> "FR"
34 18443 1280 - 1318 Apply com.typesafe.config.Config.getString WebflowConfiguration.this.config.getString("collections-ids.fr")
34 18533 1272 - 1318 Apply scala.Predef.ArrowAssoc.-> scala.Predef.ArrowAssoc[String]("FR").->[String](WebflowConfiguration.this.config.getString("collections-ids.fr"))
35 18577 1332 - 1370 Apply com.typesafe.config.Config.getString WebflowConfiguration.this.config.getString("collections-ids.gb")
35 18549 1324 - 1370 Apply scala.Predef.ArrowAssoc.-> scala.Predef.ArrowAssoc[String]("GB").->[String](WebflowConfiguration.this.config.getString("collections-ids.gb"))
35 18470 1324 - 1328 Literal <nosymbol> "GB"
36 18424 1384 - 1422 Apply com.typesafe.config.Config.getString WebflowConfiguration.this.config.getString("collections-ids.de")
36 18489 1376 - 1380 Literal <nosymbol> "DE"
36 18524 1376 - 1422 Apply scala.Predef.ArrowAssoc.-> scala.Predef.ArrowAssoc[String]("DE").->[String](WebflowConfiguration.this.config.getString("collections-ids.de"))
37 18532 1428 - 1474 Apply scala.Predef.ArrowAssoc.-> scala.Predef.ArrowAssoc[String]("BE").->[String](WebflowConfiguration.this.config.getString("collections-ids.be"))
37 18435 1436 - 1474 Apply com.typesafe.config.Config.getString WebflowConfiguration.this.config.getString("collections-ids.be")
37 18500 1428 - 1432 Literal <nosymbol> "BE"