usps-jwt_auth 0.2.4 → 0.2.6

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: 3234aa60bdc40f77d5ffbfba7c47d5836f57d9aeffe67508f13a03146ec963be
4
- data.tar.gz: '0853671498c9ef621fc7f6f112a98d146b6690bb65e4d1dc16c25c5bc3d2d795'
3
+ metadata.gz: 34bde76a473a9a091c8b44a0253d49868d957e7ea2edd365aae1d0b8639073e1
4
+ data.tar.gz: 2f5a5df0b10c3344b563abede725f50b65c3fad6694babb2dd6683569e3d784c
5
5
  SHA512:
6
- metadata.gz: 4fe2b1029bb951a115897235d122d0d6ae5c547f6c4d62d2ea23325fc604ac5c8c0e2c9fb494fb5d985866c2058490bcc60860f423285f5528f19a21dc939d03
7
- data.tar.gz: da1de46ac9c47f87f3c8bf20881971cca746764a690bdd786854e96e4f4298506a0d970adccdad45c822f5ed237fa1794a6cdd9f878c2348fb84e1683279f019
6
+ metadata.gz: b77c1978798dbe4e885b7f9f47b46d18b53bc0e72c8075ad6be054d0ac0a80c4268f945431523158f3534b896858ad32b58fa7153ae3934d87e638fa4df57bf8
7
+ data.tar.gz: fe942f554c30ef6eca06a9e99f8d4e0b73381e59da2145ae7dabe233008db30b5a01ca19095d2f48d6168e367de0db62b880eaf54a3bf74618704538de9e1fc7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps-jwt_auth (0.2.4)
4
+ usps-jwt_auth (0.2.6)
5
5
  activesupport (~> 8.0)
6
6
  fileutils (~> 1.7)
7
7
  jwt (~> 3.1)
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  Add the gem to your Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'usps-jwt_auth', '>= 0.2.4'
10
+ gem 'usps-jwt_auth', '>= 0.2.6'
11
11
  ```
12
12
 
13
13
  Then run the install task:
@@ -20,7 +20,7 @@ bundle exec rails usps:jwt:install
20
20
 
21
21
  ```ruby
22
22
  Usps::JwtAuth.configure do |config|
23
- config.environment = Rails.env
23
+ # config.environment = Rails.env
24
24
  # config.keys_path = 'config/keys'
25
25
  # config.public_keys_path = 'config/public_keys'
26
26
  # config.key_size = 4096
@@ -7,11 +7,11 @@ module Usps
7
7
  class Config
8
8
  REQUIRED_OPTIONS = %i[audience is_admin find_member].freeze
9
9
 
10
- attr_accessor :environment, :key_size, :algorithm, :issuer_base, :issuers, :audience, :is_admin, :find_member
11
- attr_reader :keys_path, :public_keys_path
10
+ attr_accessor :key_size, :algorithm, :issuer_base, :issuers, :audience, :is_admin, :find_member
11
+ attr_reader :environment
12
12
 
13
13
  def initialize
14
- @environment = ActiveSupport::StringInquirer.new('development')
14
+ @environment = defined?(Rails) ? Rails.env : ActiveSupport::StringInquirer.new('development')
15
15
  @keys_path = Pathname.new('config/keys')
16
16
  @public_keys_path = Pathname.new('config/public_keys')
17
17
  @key_size = 4096
@@ -23,10 +23,22 @@ module Usps
23
23
  yield self if block_given? # Also support setting options on initialize
24
24
  end
25
25
 
26
+ def environment=(env)
27
+ @environment = ActiveSupport::StringInquirer.new(env)
28
+ end
29
+
30
+ def keys_path
31
+ defined?(Rails) ? Rails.root.join(@keys_path) : @keys_path
32
+ end
33
+
26
34
  def keys_path=(path)
27
35
  @keys_path = path.is_a?(Pathname) ? path : Pathname.new(path)
28
36
  end
29
37
 
38
+ def public_keys_path
39
+ defined?(Rails) ? Rails.root.join(@public_keys_path) : @public_keys_path
40
+ end
41
+
30
42
  def public_keys_path=(path)
31
43
  @public_keys_path = path.is_a?(Pathname) ? path : Pathname.new(path)
32
44
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module JwtAuth
5
- VERSION = '0.2.4'
5
+ VERSION = '0.2.6'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander