http_headers-accept 0.1.0 → 0.2.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: 0cbe2181fc062a21371d0f187e0204a6e679c04aa7a9d759b4c40eed3105ae61
4
- data.tar.gz: 3f59b1429d33885ae1586d64c1d3d88448f73140e81e95dc8ceca16541950a04
3
+ metadata.gz: 1f95a246d378afbc008c41cc605238934950075cfd6ed674230c0825d6f7f477
4
+ data.tar.gz: 271b53bb408212620b83e54bccaa815ab0ef8c3ffe9be3435383ab7ff5506af9
5
5
  SHA512:
6
- metadata.gz: fa64023dd5b79c089b13307a8adf43b9330cf77ee28acc820d65ec37e1137cb8553c4df7a05fafad238ada927383c28c7461f7b6a44ca43737158b78f846d2b8
7
- data.tar.gz: ac175c5d99499c7784f79eb05a30659375739925f316656874cc24e35d603005d4a85ae8d82511b561c3a1e793b9e84d30da0c71ec146cc2c8d90e2456fabbdb
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.1.0, ruby-2.5.3-p105) [gem]" level="application" />
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
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ - Update to `utils` version 0.2.0
6
+ - Delegate directly to `Array`
7
+
8
+ ## 0.1.0
9
+
10
+ :baby: Initial release
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- http_headers-accept (0.1.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.1.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
  [![Gem Version](https://badge.fury.io/rb/http_headers-accept.svg)](https://badge.fury.io/rb/http_headers-accept)
5
5
  [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
6
6
 
7
- Authorize a certain block with cancan
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
@@ -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"
@@ -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 < Utils::List
5
- VERSION = "0.1.0"
5
+ class Accept < DelegateClass(Array)
6
+ VERSION = "0.2.0"
6
7
 
7
8
  def initialize(value)
8
- super value, entry_klazz: Accept::Entry
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 inspect
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.1.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-15 00:00:00.000000000 Z
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