File tree Expand file tree Collapse file tree 3 files changed +26
-11
lines changed Expand file tree Collapse file tree 3 files changed +26
-11
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @imagination-media/magento-api-rest" ,
3
- "version" : " 3.0.5 " ,
3
+ "version" : " 3.0.6 " ,
4
4
"description" : " Magento API wrapper" ,
5
5
"main" : " lib/index.js" ,
6
6
"files" : [" lib" ],
Original file line number Diff line number Diff line change @@ -12,14 +12,7 @@ class MagentoApi {
12
12
* Constructor
13
13
* @param params object
14
14
*/
15
- constructor ( params :{
16
- url : string ,
17
- consumerKey : string ,
18
- consumerSecret : string ,
19
- accessToken : string ,
20
- tokenSecret : string ,
21
- magentoVersion ?: string | null | undefined ,
22
- } ) {
15
+ constructor ( params : MagentoApiParams ) {
23
16
this . url = params . url ;
24
17
this . consumerKey = params . consumerKey ;
25
18
this . consumerSecret = params . consumerSecret ;
@@ -120,11 +113,33 @@ class MagentoApi {
120
113
console . error ( error ) ;
121
114
}
122
115
}
116
+
117
+ /**
118
+ * Set the default values for the Magento API
119
+ * @param params object
120
+ */
121
+ _setDefaults ( params : MagentoApiParams ) {
122
+ this . url = params . url ;
123
+ this . consumerKey = params . consumerKey ;
124
+ this . consumerSecret = params . consumerSecret ;
125
+ this . accessToken = params . accessToken ;
126
+ this . tokenSecret = params . tokenSecret ;
127
+ this . magentoVersion = params . magentoVersion ;
128
+ }
123
129
}
124
130
125
131
interface Header {
126
132
'Content-Type' : string ,
127
133
'Authorization' : string
128
134
}
129
135
136
+ interface MagentoApiParams {
137
+ url : string ,
138
+ consumerKey : string ,
139
+ consumerSecret : string ,
140
+ accessToken : string ,
141
+ tokenSecret : string ,
142
+ magentoVersion ?: string | null | undefined ,
143
+ }
144
+
130
145
export default MagentoApi ;
You can’t perform that action at this time.
0 commit comments