http-accept 2.1.1 → 2.2.1

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: b0a1b5bad9304a7296ab50835445a0d87011ca70c51ef2742a30a6283b9b04aa
4
- data.tar.gz: '09c9475e4cf64134875cccc3cce3b1cc9f065d0c26276245bae08f73bd6dd651'
3
+ metadata.gz: 744d60056b2386b45fad957f49be310a0672f276cb5528fbea605ca28759f332
4
+ data.tar.gz: 64a14c45a36902a23b639b0be824351ad89afb8a4f8dd8180e6b15d2539fe6ef
5
5
  SHA512:
6
- metadata.gz: d1c230965e9bd80b91c045565d6d3e055998842c4b5fe922759b8fc4b537aaf79af8493f98053f6a278d2d9176c2535d0a434fdf4fe7de479977ea390d72c21b
7
- data.tar.gz: 528eb0f94d1a79f9043fa039c27c618e0f1af573a7e98a5439b11b9e581f1e1677a3b24fa34961f5d9d0e4037c285380e52d2b926f611c2262e64ef4f6db75b3
6
+ metadata.gz: 72049ca8a11284d8e82e559c9481b5345b76bfbe5a8918fb226e19a1bbc24e99bac93d37170004e51b5c2477812ae54f1c83ac65a7babfef6b13f3370e64daa9
7
+ data.tar.gz: 411d59f42dc93540c9a33c7f1b99ee7b7c9ebef40c9841a452a58a857160fb1777521289b2e93cfa8e9b1d9c5465eb50c0e48cc98054ee0faf524e4a64c983d4
checksums.yaml.gz.sig ADDED
Binary file
data/lib/.DS_Store ADDED
Binary file
@@ -1,24 +1,8 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright (C) 2016, Matthew Kerwin <matthew@kerwin.net.au>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016, by Matthew Kerwin.
5
+ # Copyright, 2017-2024, by Samuel Williams.
22
6
 
23
7
  require 'strscan'
24
8
 
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
22
5
 
23
6
  require_relative 'media_types'
24
7
  require_relative 'quoted_string'
@@ -1,24 +1,8 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright (C) 2016, Matthew Kerwin <matthew@kerwin.net.au>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016, by Matthew Kerwin.
5
+ # Copyright, 2017-2024, by Samuel Williams.
22
6
 
23
7
  require 'strscan'
24
8
 
@@ -1,24 +1,8 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
5
+ # Copyright, 2021, by Khaled Hassan Hussein.
22
6
 
23
7
  require 'strscan'
24
8
 
@@ -32,7 +16,7 @@ module HTTP
32
16
  LOCALE = /\*|[A-Z]{1,8}(-[A-Z0-9]{1,8})*/i
33
17
 
34
18
  # https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.9
35
- QVALUE = /0(\.[0-9]{0,3})?|1(\.[0]{0,3})?/
19
+ QVALUE = /0(\.[0-9]{0,6})?|1(\.[0]{0,6})?/
36
20
 
37
21
  # https://greenbytes.de/tech/webdav/rfc7231.html#quality.values
38
22
  LANGUAGE_RANGE = /(?<locale>#{LOCALE})(\s*;\s*q=(?<q>#{QVALUE}))?/
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
22
5
 
23
6
  module HTTP
24
7
  module Accept
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
22
5
 
23
6
  require 'strscan'
24
7
 
@@ -38,6 +21,10 @@ module HTTP
38
21
 
39
22
  # A single entry in the Accept: header, which includes a mime type and associated parameters.
40
23
  MediaRange = Struct.new(:type, :subtype, :parameters) do
24
+ def initialize(type, subtype = '*', parameters = {})
25
+ super(type, subtype, parameters)
26
+ end
27
+
41
28
  def parameters_string
42
29
  return '' if parameters == nil or parameters.empty?
43
30
 
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
22
5
 
23
6
  module HTTP
24
7
  module Accept
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
22
5
 
23
6
  module HTTP
24
7
  module Accept
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
22
5
 
23
6
  module HTTP
24
7
  module Accept
@@ -1,27 +1,10 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
22
5
 
23
6
  module HTTP
24
7
  module Accept
25
- VERSION = "2.1.1"
8
+ VERSION = "2.2.1"
26
9
  end
27
10
  end
data/lib/http/accept.rb CHANGED
@@ -1,24 +1,9 @@
1
1
  # frozen_string_literal: true
2
- #
3
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2016-2024, by Samuel Williams.
5
+ # Copyright, 2016, by Matthew Kerwin.
6
+ # Copyright, 2017, by Andy Brody.
22
7
 
23
8
  require_relative 'accept/version'
24
9
 
data/license.md ADDED
@@ -0,0 +1,28 @@
1
+ # MIT License
2
+
3
+ Copyright, 2016-2024, by Samuel Williams.
4
+ Copyright, 2016, by Matthew Kerwin.
5
+ Copyright, 2016, by Alif Rachmawadi.
6
+ Copyright, 2017, by Andy Brody.
7
+ Copyright, 2019, by Robert Pritzkow.
8
+ Copyright, 2020, by Olle Jonsson.
9
+ Copyright, 2021, by Khaled Hassan Hussein.
10
+ Copyright, 2022, by Ian Oxley.
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
@@ -2,9 +2,7 @@
2
2
 
3
3
  Provides a robust set of parsers for dealing with HTTP `Accept`, `Accept-Language`, `Accept-Encoding`, `Accept-Charset` headers.
4
4
 
5
- [![Build Status](https://secure.travis-ci.org/socketry/http-accept.svg)](http://travis-ci.org/socketry/http-accept)
6
- [![Code Climate](https://codeclimate.com/github/socketry/http-accept.svg)](https://codeclimate.com/github/socketry/http-accept)
7
- [![Coverage Status](https://coveralls.io/repos/socketry/http-accept/badge.svg)](https://coveralls.io/r/socketry/http-accept)
5
+ [![Development Status](https://github.com/socketry/http-accept/workflows/Test/badge.svg)](https://github.com/socketry/http-accept/actions?workflow=Test)
8
6
 
9
7
  ## Motivation
10
8
 
@@ -18,17 +16,23 @@ I am concerned about correctness, security and performance. As such, I implement
18
16
 
19
17
  Add this line to your application's Gemfile:
20
18
 
21
- ```ruby
19
+ ``` ruby
22
20
  gem 'http-accept'
23
21
  ```
24
22
 
25
23
  And then execute:
26
24
 
27
- $ bundle
25
+ $ bundle
28
26
 
29
27
  Or install it yourself as:
30
28
 
31
- $ gem install http-accept
29
+ $ gem install http-accept
30
+
31
+ You can then require it in your code like so:
32
+
33
+ ``` ruby
34
+ require 'http/accept'
35
+ ```
32
36
 
33
37
  ## Usage
34
38
 
@@ -38,7 +42,7 @@ Here are some examples of how to parse various headers.
38
42
 
39
43
  You can parse the incoming `Accept:` header:
40
44
 
41
- ```ruby
45
+ ``` ruby
42
46
  media_types = HTTP::Accept::MediaTypes.parse("text/html;q=0.5, application/json; version=1")
43
47
 
44
48
  expect(media_types[0].mime_type).to be == "application/json"
@@ -49,7 +53,7 @@ expect(media_types[1].parameters).to be == {'q' => '0.5'}
49
53
 
50
54
  Normally, you'd want to match the media types against some set of available mime types:
51
55
 
52
- ```ruby
56
+ ``` ruby
53
57
  module ToJSON
54
58
  def content_type
55
59
  HTTP::Accept::ContentType.new("application", "json", charset: 'utf-8')
@@ -82,7 +86,7 @@ response = [200, {'Content-Type' => object.content_type}, [content]]
82
86
 
83
87
  You can parse the incoming `Accept-Language:` header:
84
88
 
85
- ```ruby
89
+ ``` ruby
86
90
  languages = HTTP::Accept::Languages.parse("da, en-gb;q=0.8, en;q=0.7")
87
91
 
88
92
  expect(languages[0].locale).to be == "da"
@@ -92,7 +96,7 @@ expect(languages[2].locale).to be == "en"
92
96
 
93
97
  Normally, you'd want to match the languages against some set of available localizations:
94
98
 
95
- ```ruby
99
+ ``` ruby
96
100
  available_localizations = HTTP::Accept::Languages::Locales.new(["en-nz", "en-us"])
97
101
 
98
102
  # Given the languages that the user wants, and the localizations available, compute the set of desired localizations.
@@ -101,37 +105,22 @@ desired_localizations = available_localizations & languages
101
105
 
102
106
  The `desired_localizations` in the example above is a subset of `available_localizations`.
103
107
 
104
- `HTTP::Accept::Languages::Locales` provides an efficient data-structure for matching the Accept-Languages header to set of available localizations according to https://tools.ietf.org/html/rfc7231#section-5.3.5 and https://tools.ietf.org/html/rfc4647#section-2.3
108
+ `HTTP::Accept::Languages::Locales` provides an efficient data-structure for matching the Accept-Languages header to set of available localizations according to <https://tools.ietf.org/html/rfc7231#section-5.3.5> and <https://tools.ietf.org/html/rfc4647#section-2.3>
105
109
 
106
110
  ## Contributing
107
111
 
108
- 1. Fork it
109
- 2. Create your feature branch (`git checkout -b my-new-feature`)
110
- 3. Commit your changes (`git commit -am 'Add some feature'`)
111
- 4. Push to the branch (`git push origin my-new-feature`)
112
- 5. Create new Pull Request
113
-
114
- ## License
112
+ We welcome contributions to this project.
115
113
 
116
- Released under the MIT license.
114
+ 1. Fork it.
115
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
116
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
117
+ 4. Push to the branch (`git push origin my-new-feature`).
118
+ 5. Create new Pull Request.
117
119
 
118
- Copyright, 2016, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
119
- Copyright, 2016, by [Matthew Kerwin](http://kerwin.net.au).
120
+ ### Developer Certificate of Origin
120
121
 
121
- Permission is hereby granted, free of charge, to any person obtaining a copy
122
- of this software and associated documentation files (the "Software"), to deal
123
- in the Software without restriction, including without limitation the rights
124
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
125
- copies of the Software, and to permit persons to whom the Software is
126
- furnished to do so, subject to the following conditions:
122
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
127
123
 
128
- The above copyright notice and this permission notice shall be included in
129
- all copies or substantial portions of the Software.
124
+ ### Contributor Covenant
130
125
 
131
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
133
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
134
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
135
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
136
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
137
- THE SOFTWARE.
126
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,85 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-accept
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
9
- bindir: exe
10
- cert_chain: []
11
- date: 2019-09-01 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: covered
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '10.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
69
- description:
8
+ - Matthew Kerwin
9
+ - Alif Rachmawadi
10
+ - Andy Brody
11
+ - Ian Oxley
12
+ - Khaled Hassan Hussein
13
+ - Olle Jonsson
14
+ - Robert Pritzkow
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain:
18
+ - |
19
+ -----BEGIN CERTIFICATE-----
20
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
21
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
22
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
23
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
24
+ MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
25
+ bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
26
+ igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
27
+ 9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
28
+ sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
29
+ e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
30
+ XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
31
+ RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
32
+ tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
33
+ zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
34
+ xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
35
+ BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
36
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
37
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
38
+ cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
39
+ xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
40
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
41
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
42
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
43
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
44
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
45
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
46
+ -----END CERTIFICATE-----
47
+ date: 2024-02-05 00:00:00.000000000 Z
48
+ dependencies: []
49
+ description:
70
50
  email:
71
- - samuel.williams@oriontransfer.co.nz
72
51
  executables: []
73
52
  extensions: []
74
53
  extra_rdoc_files: []
75
54
  files:
76
- - ".gitignore"
77
- - ".rspec"
78
- - ".travis.yml"
79
- - Gemfile
80
- - README.md
81
- - Rakefile
82
- - http-accept.gemspec
55
+ - lib/.DS_Store
83
56
  - lib/http/accept.rb
84
57
  - lib/http/accept/charsets.rb
85
58
  - lib/http/accept/content_type.rb
@@ -91,11 +64,14 @@ files:
91
64
  - lib/http/accept/quoted_string.rb
92
65
  - lib/http/accept/sort.rb
93
66
  - lib/http/accept/version.rb
67
+ - license.md
68
+ - readme.md
94
69
  homepage: https://github.com/ioquatix/http-accept
95
70
  licenses:
96
71
  - MIT
97
- metadata: {}
98
- post_install_message:
72
+ metadata:
73
+ funding_uri: https://github.com/sponsors/ioquatix/
74
+ post_install_message:
99
75
  rdoc_options: []
100
76
  require_paths:
101
77
  - lib
@@ -103,15 +79,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
79
  requirements:
104
80
  - - ">="
105
81
  - !ruby/object:Gem::Version
106
- version: '0'
82
+ version: '3.0'
107
83
  required_rubygems_version: !ruby/object:Gem::Requirement
108
84
  requirements:
109
85
  - - ">="
110
86
  - !ruby/object:Gem::Version
111
87
  version: '0'
112
88
  requirements: []
113
- rubygems_version: 3.0.3
114
- signing_key:
89
+ rubygems_version: 3.5.3
90
+ signing_key:
115
91
  specification_version: 4
116
92
  summary: Parse Accept and Accept-Language HTTP headers.
117
93
  test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ p)�� 9��Ǖ\
2
+ /�0�ʯz_2�W�vt�)\�(cP؉U(�S�
3
+ �36����J�nb�Ŷ1]���f�lx���X�|��M��I&�� �@ya�� ��\�������${�b�~��*�ܮ�t:��[�}�9#�w'ê����æ ��d�At� ���m���ݞZ�>K͉D��pr[��^ �X�� ?5�t����3w���h��6�^ɐge� �$�(uE� � �h���/���;�C$E)�
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- .tags*
19
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --warnings
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- language: ruby
2
- sudo: required
3
- dist: xenial
4
- cache: bundler
5
-
6
- matrix:
7
- include:
8
- - rvm: 2.3
9
- - rvm: 2.4
10
- - rvm: 2.5
11
- - rvm: 2.6
12
- - rvm: 2.6
13
- env: COVERAGE=PartialSummary,Coveralls
14
- - rvm: truffleruby
15
- - rvm: jruby-head
16
- env: JRUBY_OPTS="--debug -X+O"
17
- - rvm: ruby-head
18
- allow_failures:
19
- - rvm: truffleruby
20
- - rvm: ruby-head
21
- - rvm: jruby-head
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in http-accept.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/http-accept.gemspec DELETED
@@ -1,23 +0,0 @@
1
-
2
- require_relative 'lib/http/accept/version'
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "http-accept"
6
- spec.version = HTTP::Accept::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
-
10
- spec.summary = %q{Parse Accept and Accept-Language HTTP headers.}
11
- spec.homepage = "https://github.com/ioquatix/http-accept"
12
- spec.license = 'MIT'
13
-
14
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
- spec.bindir = "exe"
16
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_development_dependency "covered"
20
- spec.add_development_dependency "bundler"
21
- spec.add_development_dependency "rake", "~> 10.0"
22
- spec.add_development_dependency "rspec", "~> 3.0"
23
- end