cloud_events 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "base64"
4
3
  require "json"
5
4
 
6
5
  module CloudEvents
@@ -38,21 +37,21 @@ module CloudEvents
38
37
  # @raise [CloudEvents::SpecVersionError] if an unsupported specversion is
39
38
  # found.
40
39
  #
41
- def decode_event content: nil, content_type: nil, data_decoder: nil, **_other_kwargs
40
+ def decode_event(content: nil, content_type: nil, data_decoder: nil, **_other_kwargs)
42
41
  return nil unless content && content_type&.media_type == "application" && content_type&.subtype_format == "json"
43
42
  case content_type.subtype_base
44
43
  when "cloudevents"
45
- event = decode_hash_structure ::JSON.parse(content), charset: charset_of(content), data_decoder: data_decoder
44
+ event = decode_hash_structure(::JSON.parse(content), charset: charset_of(content), data_decoder: data_decoder)
46
45
  { event: event }
47
46
  when "cloudevents-batch"
48
- charset = charset_of content
47
+ charset = charset_of(content)
49
48
  batch = Array(::JSON.parse(content)).map do |structure|
50
- decode_hash_structure structure, charset: charset, data_decoder: data_decoder
49
+ decode_hash_structure(structure, charset: charset, data_decoder: data_decoder)
51
50
  end
52
51
  { event_batch: batch }
53
52
  end
54
53
  rescue ::JSON::JSONError
55
- raise FormatSyntaxError, "JSON syntax error"
54
+ raise(FormatSyntaxError, "JSON syntax error")
56
55
  end
57
56
 
58
57
  ##
@@ -78,25 +77,25 @@ module CloudEvents
78
77
  # @return [nil] if declining the request.
79
78
  # @raise [CloudEvents::FormatSyntaxError] if the JSON could not be parsed
80
79
  #
81
- def encode_event event: nil, event_batch: nil, data_encoder: nil, sort: false, **_other_kwargs
80
+ def encode_event(event: nil, event_batch: nil, data_encoder: nil, sort: false, **_other_kwargs)
82
81
  if event && !event_batch
83
- structure = encode_hash_structure event, data_encoder: data_encoder
84
- structure = sort_keys structure if sort
82
+ structure = encode_hash_structure(event, data_encoder: data_encoder)
83
+ structure = sort_keys(structure) if sort
85
84
  subtype = "cloudevents"
86
85
  elsif event_batch && !event
87
86
  structure = event_batch.map do |elem|
88
- structure_elem = encode_hash_structure elem, data_encoder: data_encoder
87
+ structure_elem = encode_hash_structure(elem, data_encoder: data_encoder)
89
88
  sort ? sort_keys(structure_elem) : structure_elem
90
89
  end
91
90
  subtype = "cloudevents-batch"
92
91
  else
93
92
  return nil
94
93
  end
95
- content = ::JSON.dump structure
96
- content_type = ContentType.new "application/#{subtype}+json; charset=#{charset_of content}"
94
+ content = ::JSON.dump(structure)
95
+ content_type = ContentType.new("application/#{subtype}+json; charset=#{charset_of(content)}")
97
96
  { content: content, content_type: content_type }
98
97
  rescue ::JSON::JSONError
99
- raise FormatSyntaxError, "JSON syntax error"
98
+ raise(FormatSyntaxError, "JSON syntax error")
100
99
  end
101
100
 
102
101
  ##
@@ -120,17 +119,17 @@ module CloudEvents
120
119
  # @raise [CloudEvents::SpecVersionError] if an unsupported specversion is
121
120
  # found.
122
121
  #
123
- def decode_data spec_version: nil, content: nil, content_type: nil, **_other_kwargs
122
+ def decode_data(spec_version: nil, content: nil, content_type: nil, **_other_kwargs)
124
123
  return nil unless spec_version
125
124
  return nil unless content
126
- return nil unless json_content_type? content_type
125
+ return nil unless json_content_type?(content_type)
127
126
  unless spec_version =~ /^0\.3|1(\.|$)/
128
- raise SpecVersionError, "Unrecognized specversion: #{spec_version}"
127
+ raise(SpecVersionError, "Unrecognized specversion: #{spec_version}")
129
128
  end
130
- data = ::JSON.parse content
129
+ data = ::JSON.parse(content)
131
130
  { data: data, content_type: content_type }
132
131
  rescue ::JSON::JSONError
133
- raise FormatSyntaxError, "JSON syntax error"
132
+ raise(FormatSyntaxError, "JSON syntax error")
134
133
  end
135
134
 
136
135
  ##
@@ -155,15 +154,15 @@ module CloudEvents
155
154
  # @return [Hash] if accepting the request.
156
155
  # @return [nil] if declining the request.
157
156
  #
158
- def encode_data spec_version: nil, data: UNSPECIFIED, content_type: nil, sort: false, **_other_kwargs
157
+ def encode_data(spec_version: nil, data: UNSPECIFIED, content_type: nil, sort: false, **_other_kwargs)
159
158
  return nil unless spec_version
160
159
  return nil if data == UNSPECIFIED
161
- return nil unless json_content_type? content_type
160
+ return nil unless json_content_type?(content_type)
162
161
  unless spec_version =~ /^0\.3|1(\.|$)/
163
- raise SpecVersionError, "Unrecognized specversion: #{spec_version}"
162
+ raise(SpecVersionError, "Unrecognized specversion: #{spec_version}")
164
163
  end
165
- data = sort_keys data if sort
166
- content = ::JSON.dump data
164
+ data = sort_keys(data) if sort
165
+ content = ::JSON.dump(data)
167
166
  { content: content, content_type: content_type }
168
167
  end
169
168
 
@@ -178,15 +177,15 @@ module CloudEvents
178
177
  # non-JSON content types.
179
178
  # @return [CloudEvents::Event]
180
179
  #
181
- def decode_hash_structure structure, charset: nil, data_decoder: nil
180
+ def decode_hash_structure(structure, charset: nil, data_decoder: nil)
182
181
  spec_version = structure["specversion"].to_s
183
182
  case spec_version
184
183
  when "0.3"
185
- decode_hash_structure_v0 structure, charset
184
+ decode_hash_structure_v0(structure, charset)
186
185
  when /^1(\.|$)/
187
- decode_hash_structure_v1 structure, charset, spec_version, data_decoder
186
+ decode_hash_structure_v1(structure, charset, spec_version, data_decoder)
188
187
  else
189
- raise SpecVersionError, "Unrecognized specversion: #{spec_version}"
188
+ raise(SpecVersionError, "Unrecognized specversion: #{spec_version}")
190
189
  end
191
190
  end
192
191
 
@@ -199,33 +198,33 @@ module CloudEvents
199
198
  # non-JSON content types.
200
199
  # @return [String] The hash structure.
201
200
  #
202
- def encode_hash_structure event, data_encoder: nil
201
+ def encode_hash_structure(event, data_encoder: nil)
203
202
  case event
204
203
  when Event::V0
205
- encode_hash_structure_v0 event
204
+ encode_hash_structure_v0(event)
206
205
  when Event::V1
207
- encode_hash_structure_v1 event, data_encoder
206
+ encode_hash_structure_v1(event, data_encoder)
208
207
  else
209
- raise SpecVersionError, "Unrecognized event type: #{event.class}"
208
+ raise(SpecVersionError, "Unrecognized event type: #{event.class}")
210
209
  end
211
210
  end
212
211
 
213
212
  private
214
213
 
215
- def json_content_type? content_type
214
+ def json_content_type?(content_type)
216
215
  content_type&.subtype_base == "json" || content_type&.subtype_format == "json"
217
216
  end
218
217
 
219
- def sort_keys obj
220
- return obj unless obj.is_a? ::Hash
218
+ def sort_keys(obj)
219
+ return obj unless obj.is_a?(::Hash)
221
220
  result = {}
222
221
  obj.keys.sort.each do |key|
223
- result[key] = sort_keys obj[key]
222
+ result[key] = sort_keys(obj[key])
224
223
  end
225
224
  result
226
225
  end
227
226
 
228
- def charset_of str
227
+ def charset_of(str)
229
228
  encoding = str.encoding
230
229
  if encoding == ::Encoding::ASCII_8BIT
231
230
  "binary"
@@ -234,29 +233,29 @@ module CloudEvents
234
233
  end
235
234
  end
236
235
 
237
- def decode_hash_structure_v0 structure, charset
238
- unless structure.key? "datacontenttype"
236
+ def decode_hash_structure_v0(structure, charset)
237
+ unless structure.key?("datacontenttype")
239
238
  structure = structure.dup
240
239
  content_type = "application/json"
241
240
  content_type = "#{content_type}; charset=#{charset}" if charset
242
241
  structure["datacontenttype"] = content_type
243
242
  end
244
- Event::V0.new attributes: structure
243
+ Event::V0.new(attributes: structure)
245
244
  end
246
245
 
247
- def decode_hash_structure_v1 structure, charset, spec_version, data_decoder
246
+ def decode_hash_structure_v1(structure, charset, spec_version, data_decoder)
248
247
  unless structure.key?("data") || structure.key?("data_base64")
249
- return Event::V1.new set_attributes: structure
248
+ return Event::V1.new(set_attributes: structure)
250
249
  end
251
250
  structure = structure.dup
252
- content, content_type = retrieve_content_from_data_fields structure, charset
253
- populate_data_fields_from_content structure, content, content_type, spec_version, data_decoder
254
- Event::V1.new set_attributes: structure
251
+ content, content_type = retrieve_content_from_data_fields(structure, charset)
252
+ populate_data_fields_from_content(structure, content, content_type, spec_version, data_decoder)
253
+ Event::V1.new(set_attributes: structure)
255
254
  end
256
255
 
257
- def retrieve_content_from_data_fields structure, charset
258
- if structure.key? "data_base64"
259
- content = ::Base64.decode64 structure.delete "data_base64"
256
+ def retrieve_content_from_data_fields(structure, charset)
257
+ if structure.key?("data_base64")
258
+ content = structure.delete("data_base64").unpack1("m")
260
259
  content_type = structure["datacontenttype"] || "application/octet-stream"
261
260
  else
262
261
  content = structure["data"]
@@ -266,60 +265,60 @@ module CloudEvents
266
265
  [content, ContentType.new(content_type)]
267
266
  end
268
267
 
269
- def populate_data_fields_from_content structure, content, content_type, spec_version, data_decoder
270
- if json_content_type? content_type
271
- structure["data_encoded"] = ::JSON.dump content
268
+ def populate_data_fields_from_content(structure, content, content_type, spec_version, data_decoder)
269
+ if json_content_type?(content_type)
270
+ structure["data_encoded"] = ::JSON.dump(content)
272
271
  structure["data"] = content
273
272
  else
274
273
  structure["data_encoded"] = content = content.to_s
275
- result = data_decoder&.decode_data spec_version: spec_version, content: content, content_type: content_type
274
+ result = data_decoder&.decode_data(spec_version: spec_version, content: content, content_type: content_type)
276
275
  if result
277
276
  structure["data"] = result[:data]
278
277
  content_type = result[:content_type]
279
278
  else
280
- structure.delete "data"
279
+ structure.delete("data")
281
280
  end
282
281
  end
283
282
  structure["datacontenttype"] = content_type
284
283
  end
285
284
 
286
- def encode_hash_structure_v0 event
285
+ def encode_hash_structure_v0(event)
287
286
  structure = event.to_h
288
287
  structure["datacontenttype"] ||= "application/json"
289
288
  structure
290
289
  end
291
290
 
292
- def encode_hash_structure_v1 event, data_encoder
291
+ def encode_hash_structure_v1(event, data_encoder)
293
292
  structure = event.to_h
294
293
  return structure unless structure.key?("data") || structure.key?("data_encoded")
295
294
  content_type = event.data_content_type
296
295
  if content_type.nil? || json_content_type?(content_type)
297
- encode_data_fields_for_json_content structure, event
296
+ encode_data_fields_for_json_content(structure, event)
298
297
  else
299
- encode_data_fields_for_other_content structure, event, data_encoder
298
+ encode_data_fields_for_other_content(structure, event, data_encoder)
300
299
  end
301
300
  structure
302
301
  end
303
302
 
304
- def encode_data_fields_for_json_content structure, event
305
- structure["data"] = ::JSON.parse event.data unless event.data_decoded?
306
- structure.delete "data_encoded"
303
+ def encode_data_fields_for_json_content(structure, event)
304
+ structure["data"] = ::JSON.parse(event.data) unless event.data_decoded?
305
+ structure.delete("data_encoded")
307
306
  structure["datacontenttype"] ||= "application/json"
308
307
  end
309
308
 
310
- def encode_data_fields_for_other_content structure, event, data_encoder
311
- data_encoded = structure.delete "data_encoded"
309
+ def encode_data_fields_for_other_content(structure, event, data_encoder)
310
+ data_encoded = structure.delete("data_encoded")
312
311
  unless data_encoded
313
- result = data_encoder&.encode_data spec_version: event.spec_version,
312
+ result = data_encoder&.encode_data(spec_version: event.spec_version,
314
313
  data: event.data,
315
- content_type: event.data_content_type
316
- raise UnsupportedFormatError, "Unable to encode data of media type #{event.data_content_type}" unless result
314
+ content_type: event.data_content_type)
315
+ raise(UnsupportedFormatError, "Unable to encode data of media type #{event.data_content_type}") unless result
317
316
  data_encoded = result[:content]
318
317
  structure["datacontenttype"] = result[:content_type].to_s
319
318
  end
320
319
  if data_encoded.encoding == ::Encoding::ASCII_8BIT
321
- structure["data_base64"] = ::Base64.encode64 data_encoded
322
- structure.delete "data"
320
+ structure["data_base64"] = [data_encoded].pack("m0")
321
+ structure.delete("data")
323
322
  else
324
323
  structure["data"] = data_encoded
325
324
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "base64"
4
3
  require "json"
5
4
 
6
5
  module CloudEvents
@@ -31,9 +30,9 @@ module CloudEvents
31
30
  # @return [Hash] if accepting the request.
32
31
  # @return [nil] if declining the request.
33
32
  #
34
- def decode_data content: nil, content_type: nil, **_other_kwargs
33
+ def decode_data(content: nil, content_type: nil, **_other_kwargs)
35
34
  return nil unless content
36
- return nil unless text_content_type? content_type
35
+ return nil unless text_content_type?(content_type)
37
36
  { data: content.to_s, content_type: content_type }
38
37
  end
39
38
 
@@ -57,17 +56,17 @@ module CloudEvents
57
56
  # @return [Hash] if accepting the request.
58
57
  # @return [nil] if declining the request.
59
58
  #
60
- def encode_data data: UNSPECIFIED, content_type: nil, **_other_kwargs
59
+ def encode_data(data: UNSPECIFIED, content_type: nil, **_other_kwargs)
61
60
  return nil if data == UNSPECIFIED
62
- return nil unless text_content_type? content_type
61
+ return nil unless text_content_type?(content_type)
63
62
  { content: data.to_s, content_type: content_type }
64
63
  end
65
64
 
66
65
  private
67
66
 
68
- def text_content_type? content_type
67
+ def text_content_type?(content_type)
69
68
  content_type&.media_type == "text" ||
70
- content_type&.media_type == "application" && content_type&.subtype == "octet-stream"
69
+ (content_type&.media_type == "application" && content_type&.subtype == "octet-stream")
71
70
  end
72
71
  end
73
72
  end
@@ -5,5 +5,5 @@ module CloudEvents
5
5
  # Version of the Ruby CloudEvents SDK
6
6
  # @return [String]
7
7
  #
8
- VERSION = "0.7.0"
8
+ VERSION = "0.8.0"
9
9
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-01-14 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: The official Ruby implementation of the CloudEvents Specification. Provides
14
13
  data types for events, and HTTP/JSON bindings for marshalling and unmarshalling
@@ -21,8 +20,10 @@ extra_rdoc_files: []
21
20
  files:
22
21
  - ".yardopts"
23
22
  - CHANGELOG.md
24
- - LICENSE.md
23
+ - CONTRIBUTING.md
24
+ - MAINTAINERS.md
25
25
  - README.md
26
+ - RELEASING.md
26
27
  - lib/cloud_events.rb
27
28
  - lib/cloud_events/content_type.rb
28
29
  - lib/cloud_events/errors.rb
@@ -41,11 +42,10 @@ homepage: https://github.com/cloudevents/sdk-ruby
41
42
  licenses:
42
43
  - Apache-2.0
43
44
  metadata:
44
- changelog_uri: https://cloudevents.github.io/sdk-ruby/v0.7.0/file.CHANGELOG.html
45
+ changelog_uri: https://cloudevents.github.io/sdk-ruby/v0.8.0/file.CHANGELOG.html
45
46
  source_code_uri: https://github.com/cloudevents/sdk-ruby
46
47
  bug_tracker_uri: https://github.com/cloudevents/sdk-ruby/issues
47
- documentation_uri: https://cloudevents.github.io/sdk-ruby/v0.7.0
48
- post_install_message:
48
+ documentation_uri: https://cloudevents.github.io/sdk-ruby/v0.8.0
49
49
  rdoc_options: []
50
50
  require_paths:
51
51
  - lib
@@ -53,15 +53,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: '2.5'
56
+ version: '2.7'
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  requirements: []
63
- rubygems_version: 3.1.6
64
- signing_key:
63
+ rubygems_version: 3.6.9
65
64
  specification_version: 4
66
65
  summary: Ruby SDK for CloudEvents
67
66
  test_files: []
data/LICENSE.md DELETED
@@ -1,202 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.