Class: SinglePlatform::Menu
- Inherits:
-
Object
- Object
- SinglePlatform::Menu
- Defined in:
- lib/single_platform/menu.rb
Instance Attribute Summary collapse
-
#attribution_image ⇒ Object
readonly
Returns the value of attribute attribution_image.
-
#attribution_image_link ⇒ Object
readonly
Returns the value of attribute attribution_image_link.
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#disclaimer ⇒ Object
readonly
Returns the value of attribute disclaimer.
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#footnote ⇒ Object
readonly
Returns the value of attribute footnote.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#menu_sections ⇒ Object
readonly
Returns the value of attribute menu_sections.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#secure_attribution_image ⇒ Object
readonly
Returns the value of attribute secure_attribution_image.
-
#secure_attribution_image_link ⇒ Object
readonly
Returns the value of attribute secure_attribution_image_link.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #build_menu ⇒ Object
-
#initialize(location, data) ⇒ Menu
constructor
A new instance of Menu.
Constructor Details
#initialize(location, data) ⇒ Menu
Returns a new instance of Menu.
7 8 9 10 11 12 13 14 |
# File 'lib/single_platform/menu.rb', line 7 def initialize(location, data) @location = location @menu_sections = [] data.each do |key, value| instance_variable_set :"@#{key.underscore}", value end end |
Instance Attribute Details
#attribution_image ⇒ Object (readonly)
Returns the value of attribute attribution_image.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def attribution_image @attribution_image end |
#attribution_image_link ⇒ Object (readonly)
Returns the value of attribute attribution_image_link.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def attribution_image_link @attribution_image_link end |
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def desc @desc end |
#disclaimer ⇒ Object (readonly)
Returns the value of attribute disclaimer.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def disclaimer @disclaimer end |
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def entries @entries end |
#footnote ⇒ Object (readonly)
Returns the value of attribute footnote.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def footnote @footnote end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def id @id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
2 3 4 |
# File 'lib/single_platform/menu.rb', line 2 def location @location end |
#menu_sections ⇒ Object (readonly)
Returns the value of attribute menu_sections.
2 3 4 |
# File 'lib/single_platform/menu.rb', line 2 def @menu_sections end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def name @name end |
#secure_attribution_image ⇒ Object (readonly)
Returns the value of attribute secure_attribution_image.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def secure_attribution_image @secure_attribution_image end |
#secure_attribution_image_link ⇒ Object (readonly)
Returns the value of attribute secure_attribution_image_link.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def secure_attribution_image_link @secure_attribution_image_link end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def state @state end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/single_platform/menu.rb', line 4 def title @title end |
Class Method Details
.menus_for_location(location) ⇒ Object
16 17 18 19 |
# File 'lib/single_platform/menu.rb', line 16 def self.(location) data = SinglePlatform::Request.get("/locations/#{location.id}/menu").body["menus"] data.collect { || new(location, ) } end |
Instance Method Details
#build_menu ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/single_platform/menu.rb', line 21 def current_section = nil entries.each do |entry| if entry["type"] == "section" current_section = SinglePlatform::MenuSection.new(self, entry) << current_section else current_section. << SinglePlatform::MenuItem.new(current_section, entry) end end end |