fundamentalista-rails 0.2.0 → 0.3.0

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: acb408b2adaf80663d870ba7ff7e58881cfbff271757b486ad43b72ce45d480d
4
- data.tar.gz: c7db5e55d712622e51bc4c1730cc222df1369cb8d0db867b45129f4170b4049c
3
+ metadata.gz: 042cbcfd7de6b6aa4071a1e7a5594e1255d85f7d378c67f750f439d732c5f773
4
+ data.tar.gz: e2f10ed5b9c2702d22c456969a479c68d0c7040c3182a2cef8ba208fd72133d1
5
5
  SHA512:
6
- metadata.gz: f5390738f4c6696c501f8bbbbc7b83f36a2e9f2770215aea142b56e0580d11e5e559cdbd3fce67d64f368ab6dffbf1a237be528f19364dc8817368e67c8d7e59
7
- data.tar.gz: 799f2c7e898ed8af174d06450a77ef1bbcba41956d33f2074bcffa646c4d5b8c2c03651446b14c25fefee181a0616e0d7d273006cb32a6936ed229ac1a003eb0
6
+ metadata.gz: beefab6e0cbedc3e6f26c03baeec789fe45ea268fbbbc051e443235f82f49fefe66e4fbd1b04bedbaf788328fbd221516c83abe74ec9f21d0d192ac0da9d05eb
7
+ data.tar.gz: 8648be6ef6d194e21f1ba5869f84662a518bc7b81d98e6d66fa55fdfa33535670dae01d0f30026edb0e658b7b04bc18798f5aaf5da124da3e7180448ac286c57
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ - `FundamentalistaRails.parent_controller` names the controller the engine's controllers inherit from, so the host's authentication guards the pages.
6
+
3
7
  ## 0.2.0
4
8
 
5
9
  - Valuation history on the company page when the provider serves prices, one row per fiscal year at its closing price.
data/README.md CHANGED
@@ -28,7 +28,14 @@ Fundamentalista.configure do |config|
28
28
  end
29
29
  ```
30
30
 
31
- The engine points the gem at `Rails.cache` with a one day expiry unless you set `config.cache` yourself, so a company page costs one download and a watchlist does not hammer the SEC. Put the engine behind whatever authentication your application uses; it ships none.
31
+ The engine points the gem at `Rails.cache` with a one day expiry unless you set `config.cache` yourself, so a company page costs one download and a watchlist does not hammer the SEC. The engine ships no authentication. Name the controller its controllers inherit from, and your own `before_action` callbacks guard the pages:
32
+
33
+ ```ruby
34
+ # config/initializers/fundamentalista.rb
35
+ FundamentalistaRails.parent_controller = "FundamentalsController"
36
+ ```
37
+
38
+ The default is `ActionController::Base`. Inside the engine, route helpers resolve against the engine's routes, so a callback in that controller that redirects to one of your pages uses `main_app.new_session_path`, not `new_session_path`.
32
39
 
33
40
  ## Pages
34
41
 
@@ -2,9 +2,11 @@
2
2
 
3
3
  module FundamentalistaRails
4
4
  # Base controller of the engine: turns the gem's errors into flash
5
- # messages and reads prices from parameters.
6
- class ApplicationController < ActionController::Base
5
+ # messages and reads prices from parameters. It inherits from
6
+ # FundamentalistaRails.parent_controller.
7
+ class ApplicationController < FundamentalistaRails.parent_controller.constantize
7
8
  protect_from_forgery with: :exception
9
+ helper FiguresHelper
8
10
 
9
11
  rescue_from Fundamentalista::CompanyNotFoundError, Fundamentalista::NoFinancialsError,
10
12
  Fundamentalista::UnsupportedPeriodError do |error|
@@ -19,4 +19,9 @@ module FundamentalistaRails
19
19
  # as decimals. Set them in an initializer.
20
20
  mattr_accessor :risk_free_rate, default: BigDecimal('0.04')
21
21
  mattr_accessor :equity_premium, default: BigDecimal('0.05')
22
+
23
+ # The controller the engine's controllers inherit from, as a name, so the
24
+ # host's own authentication and callbacks guard the pages. Set it in an
25
+ # initializer; the engine ships no authentication of its own.
26
+ mattr_accessor :parent_controller, default: 'ActionController::Base'
22
27
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module FundamentalistaRails
4
4
  # The version of the fundamentalista-rails gem, as a string.
5
- VERSION = '0.2.0'
5
+ VERSION = '0.3.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fundamentalista-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Costanzo
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 4.0.16
103
+ rubygems_version: 4.0.10
104
104
  specification_version: 4
105
105
  summary: 'Fundamental analysis pages for Rails: companies, comparisons and watchlists.'
106
106
  test_files: []