|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* SaaS Link plugin for Craft CMS 3.x |
|
4
|
|
|
* |
|
5
|
|
|
* @link https://workingconcept.com |
|
6
|
|
|
* @copyright Copyright (c) 2018 Working Concept Inc. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace workingconcept\saaslink\models; |
|
10
|
|
|
|
|
11
|
|
|
use workingconcept\saaslink\SaasLink; |
|
12
|
|
|
use craft\base\Model; |
|
13
|
|
|
|
|
14
|
|
|
class Settings extends Model |
|
15
|
|
|
{ |
|
16
|
|
|
// Constants |
|
17
|
|
|
// ========================================================================= |
|
18
|
|
|
|
|
19
|
|
|
const SUPPORTED_SERVICES = [ |
|
20
|
|
|
\workingconcept\saaslink\services\CapsuleService::class, |
|
21
|
|
|
\workingconcept\saaslink\services\HarvestService::class, |
|
22
|
|
|
\workingconcept\saaslink\services\TrelloService::class, |
|
23
|
|
|
]; |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
// Properties |
|
27
|
|
|
// ========================================================================= |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var array Services that are configured and ready to use. |
|
31
|
|
|
*/ |
|
32
|
|
|
public $enabledServices = []; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var string Harvest Personal Access Token. |
|
36
|
|
|
*/ |
|
37
|
|
|
public $harvestToken = ''; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var string Relevant Harvest account ID. |
|
41
|
|
|
*/ |
|
42
|
|
|
public $harvestAccountId = ''; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var string Harvest's customer base URL. (Will be grabbed+populated automatically.) |
|
46
|
|
|
*/ |
|
47
|
|
|
public $harvestBaseUrl = ''; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
public $trelloApiKey = ''; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var string |
|
56
|
|
|
*/ |
|
57
|
|
|
public $trelloApiToken = ''; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var string |
|
61
|
|
|
*/ |
|
62
|
|
|
public $trelloOrganizationId = ''; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @var string |
|
66
|
|
|
*/ |
|
67
|
|
|
public $capsuleToken = ''; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var string Capsule's customer base URL. (Will be grabbed+populated automatically.) |
|
71
|
|
|
*/ |
|
72
|
|
|
public $capsuleBaseUrl = ''; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @var string |
|
76
|
|
|
*/ |
|
77
|
|
|
public $fetchRelationshipTypesUri = 'saas-link/default/fetch-relationship-types'; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @var string |
|
81
|
|
|
*/ |
|
82
|
|
|
public $fetchTrelloOrganizationOptionsUri = 'saas-link/default/fetch-trello-organization-options'; |
|
83
|
|
|
|
|
84
|
|
|
|
|
85
|
|
|
// Public Methods |
|
86
|
|
|
// ========================================================================= |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Get an array with the class names of services this plugin supports. |
|
90
|
|
|
* |
|
91
|
|
|
* @return array |
|
92
|
|
|
*/ |
|
93
|
|
|
public function getSupportedServices(): array |
|
94
|
|
|
{ |
|
95
|
|
|
return self::SUPPORTED_SERVICES; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @inheritdoc |
|
100
|
|
|
*/ |
|
101
|
|
|
public function rules(): array |
|
102
|
|
|
{ |
|
103
|
|
|
return [ |
|
104
|
|
|
[[ |
|
105
|
|
|
'harvestToken', |
|
106
|
|
|
'harvestAccountId', |
|
107
|
|
|
'trelloApiKey', |
|
108
|
|
|
'trelloApiToken', |
|
109
|
|
|
'trelloOrganizationId', |
|
110
|
|
|
'capsuleToken', |
|
111
|
|
|
'harvestBaseUrl', |
|
112
|
|
|
'capsuleBaseUrl', |
|
113
|
|
|
], 'string'], |
|
114
|
|
|
]; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
} |
|
118
|
|
|
|