Skip to content

Commit 2219a4b

Browse files
authored
Update to 2.1.1 for issuance_type and disclaimers (#88)
1 parent b4c8085 commit 2219a4b

File tree

7 files changed

+101
-4
lines changed

7 files changed

+101
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.1.1] - 2023-04-18
9+
10+
### Added
11+
12+
- Adds `issuance_type` to `project` responses
13+
- Adds `disclaimers` to `project` responses
14+
815
## [2.1.0] - 2023-04-04
916

1017
### Added

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@patch-technology/patch",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Node.js wrapper for the Patch API",
55
"license": "MIT",
66
"repository": {

src/ApiClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ApiClient {
1616
};
1717

1818
this.defaultHeaders = {
19-
'User-Agent': 'patch-node/2.1.0',
19+
'User-Agent': 'patch-node/2.1.1',
2020
'Patch-Version': 2
2121
};
2222

src/model/Disclaimer.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Patch API V2
3+
* The core API used to integrate with Patch's service
4+
*
5+
* Contact: [email protected]
6+
*/
7+
8+
import ApiClient from '../ApiClient';
9+
10+
class Disclaimer {
11+
constructor(header, severity) {
12+
Disclaimer.initialize(this, header, severity);
13+
}
14+
15+
static initialize(obj, header, severity) {
16+
obj['header'] = header;
17+
obj['severity'] = severity;
18+
}
19+
20+
static constructFromObject(data, obj) {
21+
if (data) {
22+
obj = obj || new Disclaimer();
23+
24+
if (data.hasOwnProperty('body')) {
25+
obj['body'] = ApiClient.convertToType(data['body'], 'String');
26+
}
27+
28+
if (data.hasOwnProperty('header')) {
29+
obj['header'] = ApiClient.convertToType(data['header'], 'String');
30+
}
31+
32+
if (data.hasOwnProperty('severity')) {
33+
obj['severity'] = ApiClient.convertToType(data['severity'], 'String');
34+
}
35+
36+
if (data.hasOwnProperty('link_text')) {
37+
obj['link_text'] = ApiClient.convertToType(data['link_text'], 'String');
38+
}
39+
40+
if (data.hasOwnProperty('link_destination')) {
41+
obj['link_destination'] = ApiClient.convertToType(
42+
data['link_destination'],
43+
'String'
44+
);
45+
}
46+
}
47+
return obj;
48+
}
49+
}
50+
51+
Disclaimer.prototype['body'] = undefined;
52+
53+
Disclaimer.prototype['header'] = undefined;
54+
55+
Disclaimer.prototype['severity'] = undefined;
56+
57+
Disclaimer.prototype['link_text'] = undefined;
58+
59+
Disclaimer.prototype['link_destination'] = undefined;
60+
61+
export default Disclaimer;

src/model/Project.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
import ApiClient from '../ApiClient';
9+
import Disclaimer from './Disclaimer';
910
import Highlight from './Highlight';
1011
import Inventory from './Inventory';
1112
import Photo from './Photo';
@@ -100,6 +101,13 @@ class Project {
100101
obj['state'] = ApiClient.convertToType(data['state'], 'String');
101102
}
102103

104+
if (data.hasOwnProperty('issuance_type')) {
105+
obj['issuance_type'] = ApiClient.convertToType(
106+
data['issuance_type'],
107+
'String'
108+
);
109+
}
110+
103111
if (data.hasOwnProperty('latitude')) {
104112
obj['latitude'] = ApiClient.convertToType(data['latitude'], 'Number');
105113
}
@@ -152,6 +160,12 @@ class Project {
152160
Inventory
153161
]);
154162
}
163+
164+
if (data.hasOwnProperty('disclaimers')) {
165+
obj['disclaimers'] = ApiClient.convertToType(data['disclaimers'], [
166+
Disclaimer
167+
]);
168+
}
155169
}
156170
return obj;
157171
}
@@ -171,6 +185,8 @@ Project.prototype['country'] = undefined;
171185

172186
Project.prototype['state'] = undefined;
173187

188+
Project.prototype['issuance_type'] = undefined;
189+
174190
Project.prototype['latitude'] = undefined;
175191

176192
Project.prototype['longitude'] = undefined;
@@ -193,4 +209,6 @@ Project.prototype['highlights'] = undefined;
193209

194210
Project.prototype['inventory'] = undefined;
195211

212+
Project.prototype['disclaimers'] = undefined;
213+
196214
export default Project;

test/integration/projects.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ describe('Project Integration', function () {
4747
expect(inventory[0].price).to.be.a('number');
4848
expect(inventory[0].currency).to.be.a('string');
4949
expect(inventory[0].unit).to.be.a('string');
50+
51+
const issuance_type = projectResponse.data.issuance_type;
52+
expect(issuance_type).to.be.a('string');
53+
54+
const disclaimers = projectResponse.data.disclaimers;
55+
expect(disclaimers).to.be.a('array');
56+
expect(disclaimers[0].header).to.be.a('string');
57+
expect(disclaimers[0].body).to.be.a('string');
58+
expect(disclaimers[0].severity).to.be.a('string');
59+
expect(disclaimers[0].link_text).to.be.a('string');
60+
expect(disclaimers[0].link_destination).to.be.a('string');
5061
});
5162

5263
it('supports fetching a single project in a different language', async function () {

0 commit comments

Comments
 (0)