44
55namespace Simplify . Web . Postman
66{
7+ /// <summary>
8+ /// Provides postman collection to file exporter
9+ /// </summary>
10+ /// <seealso cref="ICollectionExporter" />
711 public class FileCollectionExporter : ICollectionExporter
812 {
9- private const string GenerationFolderPath = "postman" ;
10- private const string CollectionFileNamePostfix = ".postman_collection" ;
11-
1213 private readonly CollectionModelSerializer _serializer ;
1314 private readonly IEnvironment _environment ;
14- private readonly string _projectAssemblyName ;
15-
16- public FileCollectionExporter ( CollectionModelSerializer serializer , IEnvironment environment , string projectAssemblyName )
15+ private readonly PostmanGenerationSettings _settings ;
16+
17+ /// <summary>
18+ /// Initializes a new instance of the <see cref="FileCollectionExporter"/> class.
19+ /// </summary>
20+ /// <param name="serializer">The serializer.</param>
21+ /// <param name="environment">The environment.</param>
22+ /// <param name="settings">The settings.</param>
23+ public FileCollectionExporter ( CollectionModelSerializer serializer , IEnvironment environment , PostmanGenerationSettings settings )
1724 {
1825 _serializer = serializer ;
1926 _environment = environment ;
20- _projectAssemblyName = projectAssemblyName ;
27+ _settings = settings ;
2128 }
2229
30+ /// <summary>
31+ /// Exports the specified model.
32+ /// </summary>
33+ /// <param name="model">The model.</param>
2334 public void Export ( CollectionModel model )
2435 {
2536 var folderPath = GenerateExportFolderPath ( ) ;
@@ -30,14 +41,14 @@ public void Export(CollectionModel model)
3041 File . WriteAllText ( GenerateCollectionFilePath ( folderPath ) , _serializer . Serialize ( model ) ) ;
3142 }
3243
33- public string GenerateExportFolderPath ( )
44+ private string GenerateExportFolderPath ( )
3445 {
35- return Path . Combine ( _environment . SitePhysicalPath , GenerationFolderPath ) ;
46+ return Path . Combine ( _environment . SitePhysicalPath , _settings . GenerationFolderPath ) ;
3647 }
3748
38- public string GenerateCollectionFilePath ( string folderPath )
49+ private string GenerateCollectionFilePath ( string folderPath )
3950 {
40- return Path . Combine ( folderPath , _projectAssemblyName + CollectionFileNamePostfix + ".json" ) ;
51+ return Path . Combine ( folderPath , _settings . CollectionFileName + _settings . CollectionFileNamePostfix + ".json" ) ;
4152 }
4253 }
4354}
0 commit comments