salestation 4.2.0 → 4.3.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: 95319eaf34503c8cdbe7c7ebbaefbd23e92090417ee6588fe394714981c87efe
4
- data.tar.gz: 9ec9d477a27876759501d401981a5dcdcacc00d543c3af954da325fce42a8b08
3
+ metadata.gz: d178f4048330fddbdef70373ce9862f0bbf12778e004141f5091b71cbb572774
4
+ data.tar.gz: c614a8e78f5ae59095ef145e46b407823385fcf10f86116f8d50104f2684b7b8
5
5
  SHA512:
6
- metadata.gz: 85caaf8b2e31975fc302dff5492dabf42fb2affd681e4f038de544d48b9a3df4903a8eb11f2b2dbe3a244be13061a225e01f458ffcf5c6c008aab7ec0e61bef0
7
- data.tar.gz: 11a0e53eea71d877032836b2b11762d4f20fabf42a86b2742ba4db6b8ad9b0ad26df3d3fadaa2d00231e0048bb9b288b118a2ef05f3d92ddf447cc8d7cca67ea
6
+ metadata.gz: d9dd1468e2c4c9941563105ef7f79c40f41e395bd13ee6ee2cc5408158f5d81f745b395d218a726b0705e527f7271b7aac822146506c50559ba5afa7d28eb376
7
+ data.tar.gz: 5b6b5f8e2b3111b0cb1adae98a98d10670be1734bb197c1cd89c4b3dad0e142cf4df76b33db864a2dfe2840cc30286b2e800d24f029465554398644aa86cd129
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'http/accept'
4
+
3
5
  module Salestation
4
6
  class Web < Module
5
7
  module InputValidators
@@ -15,9 +17,11 @@ module Salestation
15
17
  end
16
18
 
17
19
  def call(header_value)
18
- header_valid = @allowed_headers.empty? || @allowed_headers.include?(header_value)
20
+ return Success(nil) if @allowed_headers.empty?
21
+
22
+ mime_types = HTTP::Accept::MediaTypes.parse(header_value).map(&:mime_type)
19
23
 
20
- if header_valid
24
+ if (@allowed_headers & mime_types).any?
21
25
  Success(nil)
22
26
  else
23
27
  Failure(App::Errors::NotAcceptable.new(
data/salestation.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "salestation"
7
- spec.version = "4.2.0"
7
+ spec.version = "4.3.0"
8
8
  spec.authors = ["Glia TechMovers"]
9
9
  spec.email = ["techmovers@glia.com"]
10
10
 
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency 'deterministic'
30
30
  spec.add_dependency 'dry-struct'
31
31
  spec.add_dependency 'dry-types'
32
+ spec.add_dependency 'http-accept', '~> 2.1'
32
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salestation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: http-accept
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '2.1'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '2.1'
139
153
  description: ''
140
154
  email:
141
155
  - techmovers@glia.com