salestation 4.2.0 → 4.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95319eaf34503c8cdbe7c7ebbaefbd23e92090417ee6588fe394714981c87efe
4
- data.tar.gz: 9ec9d477a27876759501d401981a5dcdcacc00d543c3af954da325fce42a8b08
3
+ metadata.gz: 533d617c2c637187cc4cb8e9f1131d5dd54fb046c08a279724c99135268b2ad9
4
+ data.tar.gz: 61ff5a8e9d6a93c11dcf2333c4a88e145a8b13a5d2b62bc99a25e665f16a814f
5
5
  SHA512:
6
- metadata.gz: 85caaf8b2e31975fc302dff5492dabf42fb2affd681e4f038de544d48b9a3df4903a8eb11f2b2dbe3a244be13061a225e01f458ffcf5c6c008aab7ec0e61bef0
7
- data.tar.gz: 11a0e53eea71d877032836b2b11762d4f20fabf42a86b2742ba4db6b8ad9b0ad26df3d3fadaa2d00231e0048bb9b288b118a2ef05f3d92ddf447cc8d7cca67ea
6
+ metadata.gz: 41deda5681c52b1fe10f40f4a68606ddc42accd68f816e5ce4cdeef0797400eb73fc65462338d218481c018554095af5b907005af0dc7cb1d89bbc7ff0ff4e9e
7
+ data.tar.gz: 66a543f73b6373b3ba6f40e664f385c651605fcdc0ce637af685341d3238abb852283144c40be6c1aaa8b3ff7252f65f6141f761e086273dcd20a4763da7b54a
@@ -0,0 +1,31 @@
1
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
2
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
3
+
4
+ name: CI
5
+
6
+ on:
7
+ push:
8
+ branches: [ master ]
9
+ pull_request:
10
+ branches: [ master ]
11
+
12
+ jobs:
13
+ test:
14
+
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ ruby-version: ['2.6', '2.7']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Set up Ruby
23
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
24
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
25
+ # uses: ruby/setup-ruby@v1
26
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
27
+ with:
28
+ ruby-version: ${{ matrix.ruby-version }}
29
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
30
+ - name: Run tests
31
+ run: bundle exec rake
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # Salestation
2
-
3
- [![Build Status](https://travis-ci.org/salemove/salestation.svg?branch=master)](https://travis-ci.org/salemove/salestation)
2
+ ![Build Status](https://github.com/salemove/salestation/actions/workflows/ruby.yml/badge.svg)
4
3
 
5
4
  ## Installation
6
5
 
@@ -221,4 +220,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
221
220
  ## License
222
221
 
223
222
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
224
-
@@ -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.to_s).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(
@@ -11,6 +11,7 @@ module Salestation
11
11
  CONTENT_TYPE = 'CONTENT_TYPE'
12
12
  HTTP_USER_AGENT = 'HTTP_USER_AGENT'
13
13
  HTTP_ACCEPT = 'HTTP_ACCEPT'
14
+ HTTP_ORIGIN = 'HTTP_ORIGIN'
14
15
  SERVER_NAME = 'SERVER_NAME'
15
16
 
16
17
  def initialize(app, logger, log_response_body: false, level: :info)
@@ -53,6 +54,7 @@ module Salestation
53
54
  content_type: env[CONTENT_TYPE],
54
55
  http_agent: env[HTTP_USER_AGENT],
55
56
  http_accept: env[HTTP_ACCEPT],
57
+ http_origin: env[HTTP_ORIGIN],
56
58
  server_name: env[SERVER_NAME],
57
59
  status: status,
58
60
  duration: duration(from: began_at),
@@ -66,7 +66,7 @@ module Salestation
66
66
  end
67
67
 
68
68
  class UnprocessableEntityFromSchemaErrors
69
- def self.create(errors:, hints:, base_error: nil, form_errors: false)
69
+ def self.create(errors: nil, hints: nil, base_error: nil, form_errors: false)
70
70
  message = errors ? parse_errors(errors) : nil
71
71
  debug_message = hints ? parse_hints(hints) : nil
72
72
 
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.4.1"
8
8
  spec.authors = ["Glia TechMovers"]
9
9
  spec.email = ["techmovers@glia.com"]
10
10
 
@@ -23,10 +23,11 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rake", "~> 13.0"
24
24
  spec.add_development_dependency "rspec", "~> 3.0"
25
25
  spec.add_development_dependency "pry", "~> 0.10.4"
26
- spec.add_development_dependency "glia-errors", "~> 0.8"
26
+ spec.add_development_dependency "glia-errors", "~> 0.11.4"
27
27
  spec.add_development_dependency "dry-validation"
28
28
 
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.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.8'
75
+ version: 0.11.4
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.8'
82
+ version: 0.11.4
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: dry-validation
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -143,9 +157,9 @@ executables: []
143
157
  extensions: []
144
158
  extra_rdoc_files: []
145
159
  files:
160
+ - ".github/workflows/ruby.yml"
146
161
  - ".gitignore"
147
162
  - ".rspec"
148
- - ".travis.yml"
149
163
  - Gemfile
150
164
  - LICENSE.txt
151
165
  - README.md
@@ -174,7 +188,7 @@ homepage: ''
174
188
  licenses:
175
189
  - MIT
176
190
  metadata: {}
177
- post_install_message:
191
+ post_install_message:
178
192
  rdoc_options: []
179
193
  require_paths:
180
194
  - lib
@@ -189,8 +203,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
203
  - !ruby/object:Gem::Version
190
204
  version: '0'
191
205
  requirements: []
192
- rubygems_version: 3.0.9
193
- signing_key:
206
+ rubygems_version: 3.0.3
207
+ signing_key:
194
208
  specification_version: 4
195
209
  summary: ''
196
210
  test_files: []
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.7