Class: Mxrb::Model::NavigationProfile
- Inherits:
-
Object
- Object
- Mxrb::Model::NavigationProfile
- Defined in:
- lib/mxrb/model/navigation.rb
Overview
Typed view of one navigation profile, including recursive menu items.
Instance Attribute Summary collapse
-
#raw_document ⇒ Object
readonly
Returns the value of attribute raw_document.
Instance Method Summary collapse
- #app_icon ⇒ Object
- #app_title ⇒ Object
- #home_microflow ⇒ Object
- #home_page ⇒ Object
-
#initialize(raw_document) ⇒ NavigationProfile
constructor
A new instance of NavigationProfile.
- #kind ⇒ Object
- #menu_items ⇒ Object
- #name ⇒ Object
- #offline? ⇒ Boolean
- #role_homes ⇒ Object
- #sign_in_page ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(raw_document) ⇒ NavigationProfile
Returns a new instance of NavigationProfile.
49 50 51 |
# File 'lib/mxrb/model/navigation.rb', line 49 def initialize(raw_document) @raw_document = raw_document end |
Instance Attribute Details
#raw_document ⇒ Object (readonly)
Returns the value of attribute raw_document.
47 48 49 |
# File 'lib/mxrb/model/navigation.rb', line 47 def raw_document @raw_document end |
Instance Method Details
#app_icon ⇒ Object
56 |
# File 'lib/mxrb/model/navigation.rb', line 56 def app_icon = @raw_document['AppIcon'] |
#app_title ⇒ Object
57 |
# File 'lib/mxrb/model/navigation.rb', line 57 def app_title = text_translations(@raw_document['AppTitle']) |
#home_microflow ⇒ Object
59 |
# File 'lib/mxrb/model/navigation.rb', line 59 def home_microflow = reference(@raw_document.dig('HomePage', 'Microflow')) |
#home_page ⇒ Object
58 |
# File 'lib/mxrb/model/navigation.rb', line 58 def home_page = reference(@raw_document.dig('HomePage', 'Page')) |
#kind ⇒ Object
54 |
# File 'lib/mxrb/model/navigation.rb', line 54 def kind = @raw_document['Kind'].to_s |
#menu_items ⇒ Object
72 73 74 75 |
# File 'lib/mxrb/model/navigation.rb', line 72 def collection = @raw_document['Menu'] || @raw_document['MenuItemCollection'] items(collection&.fetch('Items', nil)).map { (_1) } end |
#name ⇒ Object
53 |
# File 'lib/mxrb/model/navigation.rb', line 53 def name = @raw_document['Name'].to_s |
#offline? ⇒ Boolean
55 |
# File 'lib/mxrb/model/navigation.rb', line 55 def offline? = kind.match?(/offline/i) |
#role_homes ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/mxrb/model/navigation.rb', line 62 def role_homes items(@raw_document['HomeItems'] || @raw_document['RoleBasedHomePages']).map do |home| { role: reference(home['UserRole']), page: reference(home['Page']), microflow: reference(home['Microflow']) }.compact end end |
#sign_in_page ⇒ Object
60 |
# File 'lib/mxrb/model/navigation.rb', line 60 def sign_in_page = reference(@raw_document.dig('LoginPageSettings', 'Form')) |
#to_h ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/mxrb/model/navigation.rb', line 77 def to_h base_profile.merge( offline: offline?, app_icon:, app_title:, items: ) end |