action_interceptor 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWQ3OTdmZjQyYjhlM2RkZTMzNmE0Yzc4YWE0YzNmZmY5ZWQ0NTJkMg==
4
+ ODI1YzZmYmQ1MjU4YjUwY2IwMmJkZTUyNjdiNzVmMDIxMTg4OWYzMg==
5
5
  data.tar.gz: !binary |-
6
- YmU0MGRhNzNhMzgxOThkY2U5YjljMjliOWNhOTUxMmVmYzJhNzNmYg==
6
+ M2E5NTczN2RkZWNiZGQxNjgzMzhiNGZmODYyNWM0ZjAxZjBhYWI3Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODdlMTlhMDlmNTM2MjRmODdlNTRhYzdhMzQ1NjhhYjA5YWUzMTE0ZjhiNzNj
10
- OGFiN2NhNTgzMmQwYzE0ZDU0MGJhZDc5NGUwYjkwNGM0N2U2NWJhODVhODVm
11
- ZGE4ODA3NmM3MjVkMjI4MzRmNDJlNmM3OTE2NDQyZjkzMTdiMGI=
9
+ MzNkODA1MWQ4NTQ2YWIwOWRiZGM0NzFjZDRlMWI4YTRlYjNhZDM4Y2Y3YmJi
10
+ MTk0NDE0NWViZjIyN2ViYjlkYzE5NzNhZmUxNzI0NTVkN2UxOGQ4ZjM3YzBl
11
+ YWViMWIxZjBlZWNhMzJlZDlkMzQzOTM1ZmEzOGE3Y2FjYzg4OGE=
12
12
  data.tar.gz: !binary |-
13
- NzBmMTIwNDc5MjFkMTExYWJhMzg2Nzg2MTEzZDRiYTUwZjllYzk5NzU4N2Qw
14
- MDliOThmYmMzYzgwMGNkZGNmZTk2NzBkZTVmYTI3MWVmZmEwMDhlNmUxOGQ5
15
- Y2M4ZTk0ZjM2NmQ5OWQyZmQ2Yzk4N2QxYjU1MWJlMWEyMGU2ZmY=
13
+ MTVhN2IyYjFkYTA2YzgwNWZkYTg4OTg5YjU2NjRhYTY1NzUwMjVkMDkyYzQ4
14
+ YzczMGFjNDhmNjdmYWU0MTE2NTQ3NTFjOGVlM2ZkYmFjODlhZTcxZmI3OWY1
15
+ MTMyOGZhMDc1ZWQ0ZDg5OGVhNDg4ZWNjYjZjODBlMDVhYzgwZWU=
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Action Interceptor
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/action_interceptor.svg)](http://badge.fury.io/rb/action_interceptor)
3
4
  [![Build Status](https://travis-ci.org/openstax/action_interceptor.svg?branch=master)](https://travis-ci.org/openstax/action_interceptor)
4
-
5
5
  [![Code Climate](https://codeclimate.com/github/openstax/action_interceptor.png)](https://codeclimate.com/github/openstax/action_interceptor)
6
6
 
7
7
  Action Interceptor is a Rails engine that makes it easy to have controllers intercept
data/Rakefile CHANGED
@@ -13,7 +13,6 @@ Bundler::GemHelper.install_tasks
13
13
  require 'rake/testtask'
14
14
 
15
15
  Rake::TestTask.new(:spec) do |t|
16
- t.libs << 'lib'
17
16
  t.libs << 'spec'
18
17
  t.pattern = 'spec/**/*_spec.rb'
19
18
  t.verbose = false
@@ -1,8 +1,6 @@
1
1
  module ActionInterceptor
2
2
  module Common
3
3
 
4
- protected
5
-
6
4
  def url_for(options = {})
7
5
  url = super
8
6
  return url unless use_interceptor
@@ -17,6 +15,8 @@ module ActionInterceptor
17
15
  uri.to_s
18
16
  end
19
17
 
18
+ protected
19
+
20
20
  # Executes the given block as if it was inside an interceptor
21
21
  def with_interceptor(&block)
22
22
  previous_use_interceptor = use_interceptor
@@ -13,9 +13,13 @@ module ActionInterceptor
13
13
 
14
14
  def self.message_encryptor
15
15
  return @message_encryptor if @message_encryptor
16
- config = Rails.application.config
17
- application_secret = config.respond_to?(:secret_key_base) ? \
18
- config.secret_key_base : config.secret_token
16
+
17
+ application = Rails.application
18
+ config = application.config
19
+ application_secret = application.secrets[:secret_key_base] \
20
+ if application.respond_to?(:secrets)
21
+ application_secret ||= config.secret_key_base if config.respond_to?(:secret_key_base)
22
+ application_secret ||= config.secret_token
19
23
 
20
24
  # This is how Rails 4 generates keys for encrypted cookies
21
25
  # Except that, in Rails 4, MessageEncryptor can take 2 different secrets,
@@ -1,4 +1,4 @@
1
1
  module ActionInterceptor
2
- VERSION = '0.2.4'
2
+ VERSION = '0.3.0'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_interceptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails