jsonapi-materializer 1.0.0.rc.pre.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14826b51b72821c5b68caf6eb65a67d8e9a672f680a011347514c3e5eb465057
4
- data.tar.gz: 111c74912b0a39e80fe1624a306c00e558c9f3824fae5ed0f8b741c6c8660629
3
+ metadata.gz: 88cac5be67d5c5dda8a916b3acfea19f26c2c45ca6c3d5607b9fd61266df48e9
4
+ data.tar.gz: 943e3e1514ba0e6755f477b2ea078b16943131548e51b0764b7592dace815570
5
5
  SHA512:
6
- metadata.gz: a70fabbfa801253c3dfe818550e0c18c6d23893edc1823b18e249ece6dcdf5ed24d7b8f18d3b136ed4c102531287f3f221caa3a7ed803c130fe038dcaeb7ff8c
7
- data.tar.gz: 5fa1f66e4f9e141a9e058532fba8a318b45a57b0c270d1b4d20744d2bdfe07f4b1833d1302f83aeb467ae9a19371d24f702d8e8a13e6d160d76131f1940a21a0
6
+ metadata.gz: 15fc3d7edec734219328b0ac196d4d2ac2fcae51b0ffa398b1e87bf5626ec248882a0b022ccb6228fcac50e5da639a0747838d3ca538184c3a87905160abde1b
7
+ data.tar.gz: e94e167e03eb5aebb129ed1508442af0ec64ca01858cc7cc9a5d10545d94eba7d5fdcfa31b73d89aaa10aa01324ede6e5aa0e3a4066f7b15bcf4b28d8d0a5e8c
data/LICENSE ADDED
@@ -0,0 +1,440 @@
1
+ HIPPOCRATIC LICENSE
2
+
3
+ Version 3.0, October 2021
4
+
5
+ https://firstdonoharm.dev/version/3/0/full.txt
6
+
7
+ TERMS AND CONDITIONS
8
+
9
+ TERMS AND CONDITIONS FOR USE, COPY, MODIFICATION, PREPARATION OF DERIVATIVE
10
+ WORK, REPRODUCTION, AND DISTRIBUTION:
11
+
12
+ 1. DEFINITIONS:
13
+
14
+ This section defines certain terms used throughout this license agreement.
15
+
16
+ 1.1. “License” means the terms and conditions, as stated herein, for use, copy,
17
+ modification, preparation of derivative work, reproduction, and distribution of
18
+ Software (as defined below).
19
+
20
+ 1.2. “Licensor” means the copyright and/or patent owner or entity authorized by
21
+ the copyright and/or patent owner that is granting the License.
22
+
23
+ 1.3. “Licensee” means the individual or entity exercising permissions granted by
24
+ this License, including the use, copy, modification, preparation of derivative
25
+ work, reproduction, and distribution of Software (as defined below).
26
+
27
+ 1.4. “Software” means any copyrighted work, including but not limited to
28
+ software code, authored by Licensor and made available under this License.
29
+
30
+ 1.5. “Supply Chain” means the sequence of processes involved in the production
31
+ and/or distribution of a commodity, good, or service offered by the Licensee.
32
+
33
+ 1.6. “Supply Chain Impacted Party” or “Supply Chain Impacted Parties” means any
34
+ person(s) directly impacted by any of Licensee’s Supply Chain, including the
35
+ practices of all persons or entities within the Supply Chain prior to a good or
36
+ service reaching the Licensee.
37
+
38
+ 1.7. “Duty of Care” is defined by its use in tort law, delict law, and/or
39
+ similar bodies of law closely related to tort and/or delict law, including
40
+ without limitation, a requirement to act with the watchfulness, attention,
41
+ caution, and prudence that a reasonable person in the same or similar
42
+ circumstances would use towards any Supply Chain Impacted Party.
43
+
44
+ 1.8. “Worker” is defined to include any and all permanent, temporary, and agency
45
+ workers, as well as piece-rate, salaried, hourly paid, legal young (minors),
46
+ part-time, night, and migrant workers.
47
+
48
+ 2. INTELLECTUAL PROPERTY GRANTS:
49
+
50
+ This section identifies intellectual property rights granted to a Licensee.
51
+
52
+ 2.1. Grant of Copyright License: Subject to the terms and conditions of this
53
+ License, Licensor hereby grants to Licensee a worldwide, non-exclusive,
54
+ no-charge, royalty-free copyright license to use, copy, modify, prepare
55
+ derivative work, reproduce, or distribute the Software, Licensor authored
56
+ modified software, or other work derived from the Software.
57
+
58
+ 2.2. Grant of Patent License: Subject to the terms and conditions of this
59
+ License, Licensor hereby grants Licensee a worldwide, non-exclusive, no-charge,
60
+ royalty-free patent license to make, have made, use, offer to sell, sell,
61
+ import, and otherwise transfer Software.
62
+
63
+ 3. ETHICAL STANDARDS:
64
+
65
+ This section lists conditions the Licensee must comply with in order to have
66
+ rights under this License.
67
+
68
+ The rights granted to the Licensee by this License are expressly made subject to
69
+ the Licensee’s ongoing compliance with the following conditions:
70
+
71
+ * 3.1. The Licensee SHALL NOT, whether directly or indirectly, through agents
72
+ or assigns:
73
+
74
+ * 3.1.1. Infringe upon any person’s right to life or security of person,
75
+ engage in extrajudicial killings, or commit murder, without lawful cause
76
+ (See Article 3, United Nations Universal Declaration of Human Rights;
77
+ Article 6, International Covenant on Civil and Political Rights)
78
+
79
+ * 3.1.2. Hold any person in slavery, servitude, or forced labor (See Article
80
+ 4, United Nations Universal Declaration of Human Rights; Article 8,
81
+ International Covenant on Civil and Political Rights);
82
+
83
+ * 3.1.3. Contribute to the institution of slavery, slave trading, forced
84
+ labor, or unlawful child labor (See Article 4, United Nations Universal
85
+ Declaration of Human Rights; Article 8, International Covenant on Civil and
86
+ Political Rights);
87
+
88
+ * 3.1.4. Torture or subject any person to cruel, inhumane, or degrading
89
+ treatment or punishment (See Article 5, United Nations Universal
90
+ Declaration of Human Rights; Article 7, International Covenant on Civil and
91
+ Political Rights);
92
+
93
+ * 3.1.5. Discriminate on the basis of sex, gender, sexual orientation, race,
94
+ ethnicity, nationality, religion, caste, age, medical disability or
95
+ impairment, and/or any other like circumstances (See Article 7, United
96
+ Nations Universal Declaration of Human Rights; Article 2, International
97
+ Covenant on Economic, Social and Cultural Rights; Article 26, International
98
+ Covenant on Civil and Political Rights);
99
+
100
+ * 3.1.6. Prevent any person from exercising his/her/their right to seek an
101
+ effective remedy by a competent court or national tribunal (including
102
+ domestic judicial systems, international courts, arbitration bodies, and
103
+ other adjudicating bodies) for actions violating the fundamental rights
104
+ granted to him/her/them by applicable constitutions, applicable laws, or by
105
+ this License (See Article 8, United Nations Universal Declaration of Human
106
+ Rights; Articles 9 and 14, International Covenant on Civil and Political
107
+ Rights);
108
+
109
+ * 3.1.7. Subject any person to arbitrary arrest, detention, or exile (See
110
+ Article 9, United Nations Universal Declaration of Human Rights; Article 9,
111
+ International Covenant on Civil and Political Rights);
112
+
113
+ * 3.1.8. Subject any person to arbitrary interference with a person’s
114
+ privacy, family, home, or correspondence without the express written
115
+ consent of the person (See Article 12, United Nations Universal Declaration
116
+ of Human Rights; Article 17, International Covenant on Civil and Political
117
+ Rights);
118
+
119
+ * 3.1.9. Arbitrarily deprive any person of his/her/their property (See
120
+ Article 17, United Nations Universal Declaration of Human Rights);
121
+
122
+ * 3.1.10. Forcibly remove indigenous peoples from their lands or territories
123
+ or take any action with the aim or effect of dispossessing indigenous
124
+ peoples from their lands, territories, or resources, including without
125
+ limitation the intellectual property or traditional knowledge of indigenous
126
+ peoples, without the free, prior, and informed consent of indigenous
127
+ peoples concerned (See Articles 8 and 10, United Nations Declaration on the
128
+ Rights of Indigenous Peoples);
129
+
130
+ * 3.1.11. Fossil Fuel Divestment: Be an individual or entity, or a
131
+ representative, agent, affiliate, successor, attorney, or assign of an
132
+ individual or entity, on the FFI Solutions Carbon Underground 200 list
133
+ [https://www.ffisolutions.com/research-analytics-index-solutions/research-screening/the-carbon-underground-200/?cn-reloaded=1];
134
+
135
+ * 3.1.12. Ecocide: Commit ecocide:
136
+
137
+ * 3.1.12.1. For the purpose of this section, “ecocide” means unlawful or
138
+ wanton acts committed with knowledge that there is a substantial
139
+ likelihood of severe and either widespread or long-term damage to the
140
+ environment being caused by those acts;
141
+
142
+ * 3.1.12.2. For the purpose of further defining ecocide and the terms
143
+ contained in the previous paragraph:
144
+
145
+ * 3.1.12.2.1. “Wanton” means with reckless disregard for damage which
146
+ would be clearly excessive in relation to the social and economic
147
+ benefits anticipated;
148
+
149
+ * 3.1.12.2.2. “Severe” means damage which involves very serious adverse
150
+ changes, disruption, or harm to any element of the environment,
151
+ including grave impacts on human life or natural, cultural, or
152
+ economic resources;
153
+
154
+ * 3.1.12.2.3. “Widespread” means damage which extends beyond a limited
155
+ geographic area, crosses state boundaries, or is suffered by an entire
156
+ ecosystem or species or a large number of human beings;
157
+
158
+ * 3.1.12.2.4. “Long-term” means damage which is irreversible or which
159
+ cannot be redressed through natural recovery within a reasonable
160
+ period of time; and
161
+
162
+ * 3.1.12.2.5. “Environment” means the earth, its biosphere, cryosphere,
163
+ lithosphere, hydrosphere, and atmosphere, as well as outer space
164
+
165
+ (See Section II, Independent Expert Panel for the Legal Definition of
166
+ Ecocide, Stop Ecocide Foundation and the Promise Institute for Human
167
+ Rights at UCLA School of Law, June 2021);
168
+
169
+ * 3.1.13. Extractive Industries: Be an individual or entity, or a
170
+ representative, agent, affiliate, successor, attorney, or assign of an
171
+ individual or entity, that engages in fossil fuel or mineral exploration,
172
+ extraction, development, or sale;
173
+
174
+ * 3.1.14. Boycott / Divestment / Sanctions: Be an individual or entity, or a
175
+ representative, agent, affiliate, successor, attorney, or assign of an
176
+ individual or entity, identified by the Boycott, Divestment, Sanctions
177
+ (“BDS”) movement on its website (https://bdsmovement.net/
178
+ [https://bdsmovement.net/] and
179
+ https://bdsmovement.net/get-involved/what-to-boycott
180
+ [https://bdsmovement.net/get-involved/what-to-boycott]) as a target for
181
+ boycott;
182
+
183
+ * 3.1.15. Taliban: Be an individual or entity that:
184
+
185
+ * 3.1.15.1. engages in any commercial transactions with the Taliban; or
186
+
187
+ * 3.1.15.2. is a representative, agent, affiliate, successor, attorney, or
188
+ assign of the Taliban;
189
+
190
+ * 3.1.16. Myanmar: Be an individual or entity that:
191
+
192
+ * 3.1.16.1. engages in any commercial transactions with the
193
+ Myanmar/Burmese military junta; or
194
+
195
+ * 3.1.16.2. is a representative, agent, affiliate, successor, attorney, or
196
+ assign of the Myanmar/Burmese government;
197
+
198
+ * 3.1.17. Xinjiang Uygur Autonomous Region: Be an individual or entity, or a
199
+ representative, agent, affiliate, successor, attorney, or assign of any
200
+ individual or entity, that does business in, purchases goods from, or
201
+ otherwise benefits from goods produced in the Xinjiang Uygur Autonomous
202
+ Region of China;
203
+
204
+ * 3.1.18. US Tariff Act: Be an individual or entity:
205
+
206
+ * 3.1.18.1. which U.S. Customs and Border Protection (CBP) has currently
207
+ issued a Withhold Release Order (WRO) or finding against based on
208
+ reasonable suspicion of forced labor; or
209
+
210
+ * 3.1.18.2. that is a representative, agent, affiliate, successor,
211
+ attorney, or assign of an individual or entity that does business with
212
+ an individual or entity which currently has a WRO or finding from CBP
213
+ issued against it based on reasonable suspicion of forced labor;
214
+
215
+ * 3.1.19. Mass Surveillance: Be a government agency or multinational
216
+ corporation, or a representative, agent, affiliate, successor, attorney,
217
+ or assign of a government or multinational corporation, which participates
218
+ in mass surveillance programs;
219
+
220
+ * 3.1.20. Military Activities: Be an entity or a representative, agent,
221
+ affiliate, successor, attorney, or assign of an entity which conducts
222
+ military activities;
223
+
224
+ * 3.1.21. Law Enforcement: Be an individual or entity, or a or a
225
+ representative, agent, affiliate, successor, attorney, or assign of an
226
+ individual or entity, that provides good or services to, or otherwise
227
+ enters into any commercial contracts with, any local, state, or federal
228
+ law enforcement agency;
229
+
230
+ * 3.1.22. Media: Be an individual or entity, or a or a representative,
231
+ agent, affiliate, successor, attorney, or assign of an individual or
232
+ entity, that broadcasts messages promoting killing, torture, or other
233
+ forms of extreme violence;
234
+
235
+ * 3.1.23. Interfere with Workers' free exercise of the right to organize and
236
+ associate (See Article 20, United Nations Universal Declaration of Human
237
+ Rights; C087 - Freedom of Association and Protection of the Right to
238
+ Organise Convention, 1948 (No. 87), International Labour Organization;
239
+ Article 8, International Covenant on Economic, Social and Cultural Rights);
240
+ and
241
+
242
+ * 3.1.24. Harm the environment in a manner inconsistent with local, state,
243
+ national, or international law.
244
+
245
+ * 3.2. The Licensee SHALL:
246
+
247
+ * 3.2.1. Social Auditing: Only use social auditing mechanisms that adhere to
248
+ Worker-Driven Social Responsibility Network’s Statement of Principles
249
+ (https://wsr-network.org/what-is-wsr/statement-of-principles/
250
+ [https://wsr-network.org/what-is-wsr/statement-of-principles/]) over
251
+ traditional social auditing mechanisms, to the extent the Licensee uses
252
+ any social auditing mechanisms at all;
253
+
254
+ * 3.2.2. Workers on Board of Directors: Ensure that if the Licensee has a
255
+ Board of Directors, 30% of Licensee’s board seats are held by Workers paid
256
+ no more than 200% of the compensation of the lowest paid Worker of the
257
+ Licensee;
258
+
259
+ * 3.2.3. Supply Chain: Provide clear, accessible supply chain data to the
260
+ public in accordance with the following conditions:
261
+
262
+ * 3.2.3.1. All data will be on Licensee’s website and/or, to the extent
263
+ Licensee is a representative, agent, affiliate, successor, attorney,
264
+ subsidiary, or assign, on Licensee’s principal’s or parent’s website or
265
+ some other online platform accessible to the public via an internet
266
+ search on a common internet search engine; and
267
+
268
+ * 3.2.3.2. Data published will include, where applicable, manufacturers,
269
+ top tier suppliers, subcontractors, cooperatives, component parts
270
+ producers, and farms;
271
+
272
+ * 3.2.4. Provide equal pay for equal work where the performance of such work
273
+ requires equal skill, effort, and responsibility, and which are performed
274
+ under similar working conditions, except where such payment is made
275
+ pursuant to:
276
+
277
+ * 3.2.4.1. A seniority system;
278
+
279
+ * 3.2.4.2. A merit system;
280
+
281
+ * 3.2.4.3. A system which measures earnings by quantity or quality of
282
+ production; or
283
+
284
+ * 3.2.4.4. A differential based on any other factor other than sex, gender,
285
+ sexual orientation, race, ethnicity, nationality, religion, caste, age,
286
+ medical disability or impairment, and/or any other like circumstances
287
+ (See 29 U.S.C.A. § 206(d)(1); Article 23, United Nations Universal
288
+ Declaration of Human Rights; Article 7, International Covenant on
289
+ Economic, Social and Cultural Rights; Article 26, International Covenant
290
+ on Civil and Political Rights); and
291
+
292
+ * 3.2.5. Allow for reasonable limitation of working hours and periodic
293
+ holidays with pay (See Article 24, United Nations Universal Declaration of
294
+ Human Rights; Article 7, International Covenant on Economic, Social and
295
+ Cultural Rights).
296
+
297
+ 4. SUPPLY CHAIN IMPACTED PARTIES:
298
+
299
+ This section identifies additional individuals or entities that a Licensee could
300
+ harm as a result of violating the Ethical Standards section, the condition that
301
+ the Licensee must voluntarily accept a Duty of Care for those individuals or
302
+ entities, and the right to a private right of action that those individuals or
303
+ entities possess as a result of violations of the Ethical Standards section.
304
+
305
+ 4.1. In addition to the above Ethical Standards, Licensee voluntarily accepts a
306
+ Duty of Care for Supply Chain Impacted Parties of this License, including
307
+ individuals and communities impacted by violations of the Ethical Standards. The
308
+ Duty of Care is breached when a provision within the Ethical Standards section
309
+ is violated by a Licensee, one of its successors or assigns, or by an individual
310
+ or entity that exists within the Supply Chain prior to a good or service
311
+ reaching the Licensee.
312
+
313
+ 4.2. Breaches of the Duty of Care, as stated within this section, shall create a
314
+ private right of action, allowing any Supply Chain Impacted Party harmed by the
315
+ Licensee to take legal action against the Licensee in accordance with applicable
316
+ negligence laws, whether they be in tort law, delict law, and/or similar bodies
317
+ of law closely related to tort and/or delict law, regardless if Licensee is
318
+ directly responsible for the harms suffered by a Supply Chain Impacted Party.
319
+ Nothing in this section shall be interpreted to include acts committed by
320
+ individuals outside of the scope of his/her/their employment.
321
+
322
+ 5. NOTICE: This section explains when a Licensee must notify others of the
323
+ License.
324
+
325
+ 5.1. Distribution of Notice: Licensee must ensure that everyone who receives a
326
+ copy of or uses any part of Software from Licensee, with or without changes,
327
+ also receives the License and the copyright notice included with Software (and
328
+ if included by the Licensor, patent, trademark, and attribution notice).
329
+ Licensee must ensure that License is prominently displayed so that any
330
+ individual or entity seeking to download, copy, use, or otherwise receive any
331
+ part of Software from Licensee is notified of this License and its terms and
332
+ conditions. Licensee must cause any modified versions of the Software to carry
333
+ prominent notices stating that Licensee changed the Software.
334
+
335
+ 5.2. Modified Software: Licensee is free to create modifications of the Software
336
+ and distribute only the modified portion created by Licensee, however, any
337
+ derivative work stemming from the Software or its code must be distributed
338
+ pursuant to this License, including this Notice provision.
339
+
340
+ 5.3. Recipients as Licensees: Any individual or entity that uses, copies,
341
+ modifies, reproduces, distributes, or prepares derivative work based upon the
342
+ Software, all or part of the Software’s code, or a derivative work developed by
343
+ using the Software, including a portion of its code, is a Licensee as defined
344
+ above and is subject to the terms and conditions of this License.
345
+
346
+ 6. REPRESENTATIONS AND WARRANTIES:
347
+
348
+ 6.1. Disclaimer of Warranty: TO THE FULL EXTENT ALLOWED BY LAW, THIS SOFTWARE
349
+ COMES “AS IS,” WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, AND LICENSOR SHALL NOT
350
+ BE LIABLE TO ANY PERSON OR ENTITY FOR ANY DAMAGES OR OTHER LIABILITY ARISING
351
+ FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THIS LICENSE, UNDER ANY
352
+ LEGAL CLAIM.
353
+
354
+ 6.2. Limitation of Liability: LICENSEE SHALL HOLD LICENSOR HARMLESS AGAINST ANY
355
+ AND ALL CLAIMS, DEBTS, DUES, LIABILITIES, LIENS, CAUSES OF ACTION, DEMANDS,
356
+ OBLIGATIONS, DISPUTES, DAMAGES, LOSSES, EXPENSES, ATTORNEYS' FEES, COSTS,
357
+ LIABILITIES, AND ALL OTHER CLAIMS OF EVERY KIND AND NATURE WHATSOEVER, WHETHER
358
+ KNOWN OR UNKNOWN, ANTICIPATED OR UNANTICIPATED, FORESEEN OR UNFORESEEN, ACCRUED
359
+ OR UNACCRUED, DISCLOSED OR UNDISCLOSED, ARISING OUT OF OR RELATING TO LICENSEE’S
360
+ USE OF THE SOFTWARE. NOTHING IN THIS SECTION SHOULD BE INTERPRETED TO REQUIRE
361
+ LICENSEE TO INDEMNIFY LICENSOR, NOR REQUIRE LICENSOR TO INDEMNIFY LICENSEE.
362
+
363
+ 7. TERMINATION
364
+
365
+ 7.1. Violations of Ethical Standards or Breaching Duty of Care: If Licensee
366
+ violates the Ethical Standards section or Licensee, or any other person or
367
+ entity within the Supply Chain prior to a good or service reaching the Licensee,
368
+ breaches its Duty of Care to Supply Chain Impacted Parties, Licensee must remedy
369
+ the violation or harm caused by Licensee within 30 days of being notified of the
370
+ violation or harm. If Licensee fails to remedy the violation or harm within 30
371
+ days, all rights in the Software granted to Licensee by License will be null and
372
+ void as between Licensor and Licensee.
373
+
374
+ 7.2. Failure of Notice: If any person or entity notifies Licensee in writing
375
+ that Licensee has not complied with the Notice section of this License, Licensee
376
+ can keep this License by taking all practical steps to comply within 30 days
377
+ after the notice of noncompliance. If Licensee does not do so, Licensee’s
378
+ License (and all rights licensed hereunder) will end immediately.
379
+
380
+ 7.3. Judicial Findings: In the event Licensee is found by a civil, criminal,
381
+ administrative, or other court of competent jurisdiction, or some other
382
+ adjudicating body with legal authority, to have committed actions which are in
383
+ violation of the Ethical Standards or Supply Chain Impacted Party sections of
384
+ this License, all rights granted to Licensee by this License will terminate
385
+ immediately.
386
+
387
+ 7.4. Patent Litigation: If Licensee institutes patent litigation against any
388
+ entity (including a cross-claim or counterclaim in a suit) alleging that the
389
+ Software, all or part of the Software’s code, or a derivative work developed
390
+ using the Software, including a portion of its code, constitutes direct or
391
+ contributory patent infringement, then any patent license, along with all other
392
+ rights, granted to Licensee under this License will terminate as of the date
393
+ such litigation is filed.
394
+
395
+ 7.5. Additional Remedies: Termination of the License by failing to remedy harms
396
+ in no way prevents Licensor or Supply Chain Impacted Party from seeking
397
+ appropriate remedies at law or in equity.
398
+
399
+ 8. MISCELLANEOUS:
400
+
401
+ 8.1. Conditions: Sections 3, 4.1, 5.1, 5.2, 7.1, 7.2, 7.3, and 7.4 are
402
+ conditions of the rights granted to Licensee in the License.
403
+
404
+ 8.2. Equitable Relief: Licensor and any Supply Chain Impacted Party shall be
405
+ entitled to equitable relief, including injunctive relief or specific
406
+ performance of the terms hereof, in addition to any other remedy to which they
407
+ are entitled at law or in equity.
408
+
409
+ 8.3. Copyleft: Modified software, source code, or other derivative work must be
410
+ licensed, in its entirety, under the exact same conditions as this License.
411
+
412
+ 8.4. Severability: If any term or provision of this License is determined to be
413
+ invalid, illegal, or unenforceable by a court of competent jurisdiction, any
414
+ such determination of invalidity, illegality, or unenforceability shall not
415
+ affect any other term or provision of this License or invalidate or render
416
+ unenforceable such term or provision in any other jurisdiction. If the
417
+ determination of invalidity, illegality, or unenforceability by a court of
418
+ competent jurisdiction pertains to the terms or provisions contained in the
419
+ Ethical Standards section of this License, all rights in the Software granted to
420
+ Licensee shall be deemed null and void as between Licensor and Licensee.
421
+
422
+ 8.5. Section Titles: Section titles are solely written for organizational
423
+ purposes and should not be used to interpret the language within each section.
424
+
425
+ 8.6. Citations: Citations are solely written to provide context for the source
426
+ of the provisions in the Ethical Standards.
427
+
428
+ 8.7. Section Summaries: Some sections have a brief italicized description which
429
+ is provided for the sole purpose of briefly describing the section and should
430
+ not be used to interpret the terms of the License.
431
+
432
+ 8.8. Entire License: This is the entire License between the Licensor and
433
+ Licensee with respect to the claims released herein and that the consideration
434
+ stated herein is the only consideration or compensation to be paid or exchanged
435
+ between them for this License. This License cannot be modified or amended except
436
+ in a writing signed by Licensor and Licensee.
437
+
438
+ 8.9. Successors and Assigns: This License shall be binding upon and inure to the
439
+ benefit of the Licensor’s and Licensee’s respective heirs, successors, and
440
+ assigns.
data/README.md CHANGED
@@ -1,10 +1,6 @@
1
1
  # jsonapi-materializer
2
2
 
3
- - [![Build](http://img.shields.io/travis-ci/krainboltgreene/jsonapi-materializer.rb.svg?style=flat-square)](https://travis-ci.org/krainboltgreene/jsonapi-materializer.rb)
4
- - [![Downloads](http://img.shields.io/gem/dtv/jsonapi-materializer.svg?style=flat-square)](https://rubygems.org/gems/jsonapi-materializer)
5
- - [![Version](http://img.shields.io/gem/v/jsonapi-materializer.svg?style=flat-square)](https://rubygems.org/gems/jsonapi-materializer)
6
-
7
- jsonapi-materializer is a way to turn data objects (for example, active record models) into json:api responses. Largely the library doesn't care *what* it's given, as long as it responds to certain calls.
3
+ jsonapi-materializer is a way to turn data objects (for example, active record models) into json:api responses. Largely the library doesn't care *what* it's given, as long as it responds to certain calls. I'm already using jsonapi-materializer and it's sister project jsonapi-realizer in a gem of that allows http json services to be discoverable: [jsonapi-home](https://github.com/krainboltgreene/jsonapi-home.rb).
8
4
 
9
5
 
10
6
  ## Using
@@ -15,13 +11,6 @@ Lets say we have a simple rails application setup for our project. We'll define
15
11
  class Account < ApplicationRecord
16
12
  has_many(:articles)
17
13
  has_many(:comments)
18
-
19
- def self.schema
20
- ActiveRecord::Migration.create_table(:accounts, :force => true) do |table|
21
- table.text(:name, :null => false)
22
- table.timestamps(:null => false)
23
- end
24
- end
25
14
  end
26
15
  ```
27
16
 
@@ -126,70 +115,6 @@ There is *nothing* specific about rails for this library, it can be used in any
126
115
  0. A place to store the configuration at boot (rails initializers)
127
116
 
128
117
 
129
- ### policies (aka pundit)
130
-
131
- If you're using some sort of policy logic like pundit you'll have the ability to pass it as a context to the materializer:
132
-
133
- ``` ruby
134
- class AccountsController < ApplicationController
135
- def show
136
- context = {
137
- :policy => policy
138
- }
139
- render(
140
- :json => AccountMaterializer::Resource.new(:object => object, :context => context)
141
- )
142
- end
143
- end
144
- ```
145
-
146
- And now the use of that context object:
147
-
148
- ``` ruby
149
- class AccountMaterializer
150
- include(JSONAPI::Materializer::Resource)
151
-
152
- type(:accounts)
153
-
154
- has_many(:reviews, :class_name => "ReviewMaterializer")
155
-
156
- has(:name, :visible => :readable_attribute?)
157
-
158
- private def readable_attribute?(attribute)
159
- context.policy.read_attribute?(attribute.from)
160
- end
161
- end
162
- ```
163
-
164
- You'll notice that context is an object, not a hash, when referenced on the materializer. That's because we give you the ability to enforce the context for saftey:
165
-
166
- ``` ruby
167
-
168
- class AccountMaterializer
169
- include(JSONAPI::Materializer::Resource)
170
-
171
- type(:accounts)
172
-
173
- has_many(:reviews, :class_name => "ReviewMaterializer")
174
-
175
- has(:name, :visible => :readable_attribute?)
176
-
177
- context.validates_presence_of(:policy)
178
-
179
- private def readable_attribute?(attribute)
180
- context.policy.read_attribute?(attribute.from)
181
- end
182
- end
183
- ```
184
-
185
- These are just aliases for ActiveModel::Validations.
186
-
187
-
188
- ### Sister Projects
189
-
190
- I'm already using jsonapi-materializer. and it's sister project [jsonapi-realizer](https://github.com/krainboltgreene/jsonapi-realizer.rb) in a new gem of mine that allows services to be discoverable: [jsonapi-home](https://github.com/krainboltgreene/jsonapi-home.rb).
191
-
192
-
193
118
  ## Installing
194
119
 
195
120
  Add this line to your application's Gemfile:
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env rake
2
+ # frozen_string_literal: true
2
3
 
3
4
  require("bundler/gem_tasks")
4
5
  require("rspec/core/rake_task")
@@ -9,4 +10,4 @@ RSpec::Core::RakeTask.new(:spec) do |let|
9
10
  end
10
11
 
11
12
  desc("Default: run tests")
12
- task(:default => :spec)
13
+ task(default: :spec)
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module JSONAPI
2
4
  module Materializer
3
5
  module Collection
4
- SELF_TEMPLATE = "{origin}/{type}".freeze
6
+ SELF_TEMPLATE = "{origin}/{type}"
5
7
 
6
8
  extend(ActiveSupport::Concern)
7
9
  include(ActiveModel::Model)
@@ -10,31 +12,30 @@ module JSONAPI
10
12
  attr_writer(:selects)
11
13
  attr_writer(:includes)
12
14
  attr_writer(:pagination)
13
- attr_accessor(:context)
14
15
 
15
- delegate(:first_page?, :to => :object)
16
- delegate(:prev_page, :to => :object)
17
- delegate(:total_pages, :to => :object)
18
- delegate(:next_page, :to => :object)
19
- delegate(:last_page?, :to => :object)
20
- delegate(:limit_value, :to => :object)
16
+ delegate(:first_page?, to: :object)
17
+ delegate(:prev_page, to: :object)
18
+ delegate(:total_pages, to: :object)
19
+ delegate(:next_page, to: :object)
20
+ delegate(:last_page?, to: :object)
21
+ delegate(:limit_value, to: :object)
21
22
 
22
23
  def as_json(*)
23
24
  {
24
- :links => {
25
- :first => unless total_pages.zero? || first_page? then links_pagination.expand(:offset => 1, :limit => limit_value).to_s end,
26
- :prev => unless total_pages.zero? || first_page? then links_pagination.expand(:offset => prev_page, :limit => limit_value).to_s end,
27
- :self => unless total_pages.zero? then links_self end,
28
- :next => unless total_pages.zero? || last_page? then links_pagination.expand(:offset => next_page, :limit => limit_value).to_s end,
29
- :last => unless total_pages.zero? || last_page? then links_pagination.expand(:offset => total_pages, :limit => limit_value).to_s end
25
+ links: {
26
+ first: (links_pagination.expand(offset: 1, limit: limit_value).to_s unless total_pages.zero? || first_page?),
27
+ prev: (links_pagination.expand(offset: prev_page, limit: limit_value).to_s unless total_pages.zero? || first_page?),
28
+ self: (links_self unless total_pages.zero?),
29
+ next: (links_pagination.expand(offset: next_page, limit: limit_value).to_s unless total_pages.zero? || last_page?),
30
+ last: (links_pagination.expand(offset: total_pages, limit: limit_value).to_s unless total_pages.zero? || last_page?)
30
31
  }.compact,
31
- :data => resources,
32
- :included => included
32
+ data: resources,
33
+ included:
33
34
  }.transform_values(&:presence).compact
34
35
  end
35
36
 
36
37
  private def materializers
37
- @materializers ||= object.map {|subobject| self.class.parent.new(:object => subobject, :selects => selects, :includes => includes, :context => context)}
38
+ @materializers ||= object.map { |subobject| self.class.module_parent.new(object: subobject, selects:, includes:) }
38
39
  end
39
40
 
40
41
  private def links_pagination
@@ -50,11 +51,11 @@ module JSONAPI
50
51
  end
51
52
 
52
53
  private def origin
53
- self.class.parent.instance_variable_get(:@origin)
54
+ self.class.module_parent.instance_variable_get(:@origin)
54
55
  end
55
56
 
56
57
  private def type
57
- self.class.parent.instance_variable_get(:@type)
58
+ self.class.module_parent.instance_variable_get(:@type)
58
59
  end
59
60
 
60
61
  private def resources
@@ -74,7 +75,7 @@ module JSONAPI
74
75
  includes.flat_map do |path|
75
76
  path.reduce(materializer) do |subject, key|
76
77
  if subject.is_a?(Array)
77
- subject.map {|related_subject| related_subject.relation(key).for(related_subject)}
78
+ subject.map { |related_subject| related_subject.relation(key).for(related_subject) }
78
79
  else
79
80
  subject.relation(key).for(subject)
80
81
  end
@@ -82,6 +83,7 @@ module JSONAPI
82
83
  end
83
84
  end.uniq.map(&:as_data)
84
85
  end
86
+ # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
85
87
  end
86
88
  end
87
89
  end