Class: Strongmind::CommonNavFetcher
- Inherits:
-
Object
- Object
- Strongmind::CommonNavFetcher
- Defined in:
- lib/strongmind/common_nav_fetcher.rb
Overview
This class is responsible for fetching the common navbar data from SM Central
Defined Under Namespace
Classes: TokenNotFoundError, UserNotFoundError
Instance Attribute Summary collapse
-
#auth_client ⇒ Object
readonly
Returns the value of attribute auth_client.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user) ⇒ CommonNavFetcher
constructor
A new instance of CommonNavFetcher.
- #retrieve(nav_items, nav_options) ⇒ Object
Constructor Details
#initialize(user) ⇒ CommonNavFetcher
Returns a new instance of CommonNavFetcher.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/strongmind/common_nav_fetcher.rb', line 16 def initialize(user) raise Strongmind::Exceptions::UserNotFoundError, 'User not found' unless user.present? raise ArgumentError, 'Identity base URL not found at IDENTITY_BASE_URL in environment' unless ENV['IDENTITY_BASE_URL'].present? raise ArgumentError, 'Identity client ID not found at IDENTITY_CLIENT_ID in environment' unless ENV['IDENTITY_CLIENT_ID'].present? raise ArgumentError, 'Identity client secret not found at IDENTITY_CLIENT_SECRET in environment' unless ENV['IDENTITY_CLIENT_SECRET'].present? @user = user @auth_client = PlatformSdk::Identity::AuthClient.new( ENV.fetch('IDENTITY_BASE_URL'), ENV.fetch('IDENTITY_CLIENT_ID'), ENV.fetch('IDENTITY_CLIENT_SECRET') ) end |
Instance Attribute Details
#auth_client ⇒ Object (readonly)
Returns the value of attribute auth_client.
8 9 10 |
# File 'lib/strongmind/common_nav_fetcher.rb', line 8 def auth_client @auth_client end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
8 9 10 |
# File 'lib/strongmind/common_nav_fetcher.rb', line 8 def user @user end |
Instance Method Details
#retrieve(nav_items, nav_options) ⇒ Object
28 29 30 31 |
# File 'lib/strongmind/common_nav_fetcher.rb', line 28 def retrieve(nav_items, ) response = (nav_items, ) (response) end |