http_headers-accept 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/.idea/http_headers-accept.iml +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +3 -3
- data/README.md +14 -1
- data/http_headers-accept.gemspec +1 -1
- data/lib/http_headers/accept.rb +6 -6
- metadata +9 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f95a246d378afbc008c41cc605238934950075cfd6ed674230c0825d6f7f477
|
|
4
|
+
data.tar.gz: 271b53bb408212620b83e54bccaa815ab0ef8c3ffe9be3435383ab7ff5506af9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe774a2472bbd598d3456bbe9c79f18d0e9b5c80dfa32bd0f0e8c70d4cec1345963ca947515f6351ddd17a0c98f6b9c5d35d76575be38b448b6332ac0170d400
|
|
7
|
+
data.tar.gz: b2c5f3f2a13b9e7b0903e64d1097a6d9d132abef30e8699ca932ab89c2b80cf59b4c283bff34f26d59710b4c79a4546f66dcbd8487b082d545bc2f8f5493f16d
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<orderEntry type="jdk" jdkName="ruby-2.5.3-p105" jdkType="RUBY_SDK" />
|
|
28
28
|
<orderEntry type="sourceFolder" forTests="false" />
|
|
29
29
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.1, ruby-2.5.3-p105) [gem]" level="application" />
|
|
30
|
-
<orderEntry type="library" scope="PROVIDED" name="http_headers-utils (v0.
|
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="http_headers-utils (v0.2.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
31
31
|
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, ruby-2.5.3-p105) [gem]" level="application" />
|
|
32
32
|
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.5.3-p105) [gem]" level="application" />
|
|
33
33
|
</component>
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
http_headers-accept (0.
|
|
5
|
-
http_headers-utils (< 1.0.0)
|
|
4
|
+
http_headers-accept (0.2.0)
|
|
5
|
+
http_headers-utils (>= 0.2.0, < 1.0.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
http_headers-utils (0.
|
|
10
|
+
http_headers-utils (0.2.0)
|
|
11
11
|
minitest (5.11.3)
|
|
12
12
|
rake (10.5.0)
|
|
13
13
|
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://badge.fury.io/rb/http_headers-accept)
|
|
5
5
|
[](http://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
:nut_and_bolt: Utility to parse and sort the "Accept" HTTP Header
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -47,6 +47,19 @@ parsed.last.to_s
|
|
|
47
47
|
# => '*/*; q=0.1'
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
Each parsed entry exposes the following methods:
|
|
51
|
+
- `media_type`: the parsed media_type
|
|
52
|
+
- `q`: the quality parameter as float, or 1.0
|
|
53
|
+
- `[](parameter)`: accessor for the parameter; throws if it does not exist
|
|
54
|
+
- `to_s`: encode back to an entry to be used in a `Accept` header
|
|
55
|
+
|
|
56
|
+
## Related
|
|
57
|
+
|
|
58
|
+
- [HttpHeaders::Utils](https://github.com/XPBytes/http_headers-utils): :nut_and_bolt: Utility belt for the HttpHeader libraries
|
|
59
|
+
- [HttpHeaders::AcceptLanguage](https://github.com/XPBytes/http_headers-accept_language): :nut_and_bolt: Utility to parse and sort the "Accept-Language" HTTP Header
|
|
60
|
+
- [HttpHeaders::ContentType](https://github.com/XPBytes/http_headers-content_type): :nut_and_bolt: Utility to parse and sort the "Content-Type" HTTP Header
|
|
61
|
+
|
|
62
|
+
|
|
50
63
|
## Development
|
|
51
64
|
|
|
52
65
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can
|
data/http_headers-accept.gemspec
CHANGED
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
36
36
|
spec.require_paths = ["lib"]
|
|
37
37
|
|
|
38
|
-
spec.add_dependency 'http_headers-utils', '< 1.0.0'
|
|
38
|
+
spec.add_dependency 'http_headers-utils', '>= 0.2.0', '< 1.0.0'
|
|
39
39
|
|
|
40
40
|
spec.add_development_dependency "bundler", "~> 2.0"
|
|
41
41
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/http_headers/accept.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
require 'http_headers/utils'
|
|
1
|
+
require 'http_headers/utils/list'
|
|
2
|
+
require 'delegate'
|
|
2
3
|
|
|
3
4
|
module HttpHeaders
|
|
4
|
-
class Accept <
|
|
5
|
-
VERSION = "0.
|
|
5
|
+
class Accept < DelegateClass(Array)
|
|
6
|
+
VERSION = "0.2.0"
|
|
6
7
|
|
|
7
8
|
def initialize(value)
|
|
8
|
-
|
|
9
|
-
sort!
|
|
9
|
+
__setobj__ HttpHeaders::Utils::List.new(value, entry_klazz: Accept::Entry)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
class Entry
|
|
@@ -35,7 +35,7 @@ module HttpHeaders
|
|
|
35
35
|
parameters.fetch(String(parameter).to_sym)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def
|
|
38
|
+
def to_header
|
|
39
39
|
to_s
|
|
40
40
|
end
|
|
41
41
|
|
metadata
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: http_headers-accept
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Derk-Jan Karrenbeld
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-02-
|
|
11
|
+
date: 2019-02-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: http_headers-utils
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.2.0
|
|
17
20
|
- - "<"
|
|
18
21
|
- !ruby/object:Gem::Version
|
|
19
22
|
version: 1.0.0
|
|
@@ -21,6 +24,9 @@ dependencies:
|
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: 0.2.0
|
|
24
30
|
- - "<"
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
32
|
version: 1.0.0
|
|
@@ -82,6 +88,7 @@ files:
|
|
|
82
88
|
- ".idea/runConfigurations/test.xml"
|
|
83
89
|
- ".idea/vcs.xml"
|
|
84
90
|
- ".travis.yml"
|
|
91
|
+
- CHANGELOG.md
|
|
85
92
|
- CODE_OF_CONDUCT.md
|
|
86
93
|
- Gemfile
|
|
87
94
|
- Gemfile.lock
|