Class: Mxrb::Model::NavigationProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/model/navigation.rb

Overview

Typed view of one navigation profile, including recursive menu items.

Instance Attribute Summary collapse

Instance Method Summary collapse

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_documentObject (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_iconObject



56
# File 'lib/mxrb/model/navigation.rb', line 56

def app_icon = @raw_document['AppIcon']

#app_titleObject



57
# File 'lib/mxrb/model/navigation.rb', line 57

def app_title = text_translations(@raw_document['AppTitle'])

#home_microflowObject



59
# File 'lib/mxrb/model/navigation.rb', line 59

def home_microflow = reference(@raw_document.dig('HomePage', 'Microflow'))

#home_pageObject



58
# File 'lib/mxrb/model/navigation.rb', line 58

def home_page = reference(@raw_document.dig('HomePage', 'Page'))

#kindObject



54
# File 'lib/mxrb/model/navigation.rb', line 54

def kind = @raw_document['Kind'].to_s


72
73
74
75
# File 'lib/mxrb/model/navigation.rb', line 72

def menu_items
  collection = @raw_document['Menu'] || @raw_document['MenuItemCollection']
  items(collection&.fetch('Items', nil)).map { navigation_item(_1) }
end

#nameObject



53
# File 'lib/mxrb/model/navigation.rb', line 53

def name = @raw_document['Name'].to_s

#offline?Boolean

Returns:

  • (Boolean)


55
# File 'lib/mxrb/model/navigation.rb', line 55

def offline? = kind.match?(/offline/i)

#role_homesObject



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_pageObject



60
# File 'lib/mxrb/model/navigation.rb', line 60

def  = reference(@raw_document.dig('LoginPageSettings', 'Form'))

#to_hObject



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: menu_items
  )
end