-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 1.21.0 - api completeness changes * Additional order tests * changelog * update readme
- Loading branch information
Showing
13 changed files
with
360 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* Patch API V1 | ||
* The core API used to integrate with Patch's service | ||
* | ||
* Contact: engineering@usepatch.com | ||
*/ | ||
|
||
import ApiClient from '../ApiClient'; | ||
|
||
class Inventory { | ||
constructor(vintageYear, amountAvailable, price, currency, unit) { | ||
Inventory.initialize( | ||
this, | ||
vintageYear, | ||
amountAvailable, | ||
price, | ||
currency, | ||
unit | ||
); | ||
} | ||
|
||
static initialize(obj, vintageYear, amountAvailable, price, currency, unit) { | ||
obj['vintage_year'] = vintageYear; | ||
obj['amount_available'] = amountAvailable; | ||
obj['price'] = price; | ||
obj['currency'] = currency; | ||
obj['unit'] = unit; | ||
} | ||
|
||
static constructFromObject(data, obj) { | ||
if (data) { | ||
obj = obj || new Inventory(); | ||
|
||
if (data.hasOwnProperty('vintage_year')) { | ||
obj['vintage_year'] = ApiClient.convertToType( | ||
data['vintage_year'], | ||
'Number' | ||
); | ||
} | ||
|
||
if (data.hasOwnProperty('amount_available')) { | ||
obj['amount_available'] = ApiClient.convertToType( | ||
data['amount_available'], | ||
'Number' | ||
); | ||
} | ||
|
||
if (data.hasOwnProperty('price')) { | ||
obj['price'] = ApiClient.convertToType(data['price'], 'Number'); | ||
} | ||
|
||
if (data.hasOwnProperty('currency')) { | ||
obj['currency'] = ApiClient.convertToType(data['currency'], 'String'); | ||
} | ||
|
||
if (data.hasOwnProperty('unit')) { | ||
obj['unit'] = ApiClient.convertToType(data['unit'], 'String'); | ||
} | ||
} | ||
return obj; | ||
} | ||
} | ||
|
||
Inventory.prototype['vintage_year'] = undefined; | ||
|
||
Inventory.prototype['amount_available'] = undefined; | ||
|
||
Inventory.prototype['price'] = undefined; | ||
|
||
Inventory.prototype['currency'] = undefined; | ||
|
||
Inventory.prototype['unit'] = undefined; | ||
|
||
export default Inventory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* Patch API V1 | ||
* The core API used to integrate with Patch's service | ||
* | ||
* Contact: engineering@usepatch.com | ||
*/ | ||
|
||
import ApiClient from '../ApiClient'; | ||
import OrderInventoryProject from './OrderInventoryProject'; | ||
|
||
class OrderInventory { | ||
constructor(project, vintageYear, amount, unit, price, currency) { | ||
OrderInventory.initialize( | ||
this, | ||
project, | ||
vintageYear, | ||
amount, | ||
unit, | ||
price, | ||
currency | ||
); | ||
} | ||
|
||
static initialize(obj, project, vintageYear, amount, unit, price, currency) { | ||
obj['project'] = project; | ||
obj['vintage_year'] = vintageYear; | ||
obj['amount'] = amount; | ||
obj['unit'] = unit; | ||
obj['price'] = price; | ||
obj['currency'] = currency; | ||
} | ||
|
||
static constructFromObject(data, obj) { | ||
if (data) { | ||
obj = obj || new OrderInventory(); | ||
|
||
if (data.hasOwnProperty('project')) { | ||
obj['project'] = ApiClient.convertToType( | ||
data['project'], | ||
OrderInventoryProject | ||
); | ||
} | ||
|
||
if (data.hasOwnProperty('vintage_year')) { | ||
obj['vintage_year'] = ApiClient.convertToType( | ||
data['vintage_year'], | ||
'Number' | ||
); | ||
} | ||
|
||
if (data.hasOwnProperty('amount')) { | ||
obj['amount'] = ApiClient.convertToType(data['amount'], 'Number'); | ||
} | ||
|
||
if (data.hasOwnProperty('unit')) { | ||
obj['unit'] = ApiClient.convertToType(data['unit'], 'String'); | ||
} | ||
|
||
if (data.hasOwnProperty('price')) { | ||
obj['price'] = ApiClient.convertToType(data['price'], 'Number'); | ||
} | ||
|
||
if (data.hasOwnProperty('currency')) { | ||
obj['currency'] = ApiClient.convertToType(data['currency'], 'String'); | ||
} | ||
} | ||
return obj; | ||
} | ||
} | ||
|
||
OrderInventory.prototype['project'] = undefined; | ||
|
||
OrderInventory.prototype['vintage_year'] = undefined; | ||
|
||
OrderInventory.prototype['amount'] = undefined; | ||
|
||
OrderInventory.prototype['unit'] = undefined; | ||
|
||
OrderInventory.prototype['price'] = undefined; | ||
|
||
OrderInventory.prototype['currency'] = undefined; | ||
|
||
export default OrderInventory; |
Oops, something went wrong.