class Beaver::TerminalDisplay

This configuration is required if the mode is “prompt_on_terminal”, and is responsible for configuring how the tip guide appears on the physical terminal.

Attributes

amount_guide_type[RW]

The type of the amount guide can be either a percentage guide or a flat guide. Percentage guides will offer the payer a chance to tip with one of a few default tip percentages that are configured. Flat guides will offer the payer flat tip amounts to choose from. Both types of guides will allow the payer to manually enter a tip amount. @return [AmountGuideTypeEnum]

flat_guide[RW]

The configuration for a flat tip guide. All three guides must be provided. @return [FlatGuide]

percentage_guide[RW]

The configuration for a percentage tip guide. All three guides must be provided. @return [PercentageGuide]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# File lib/beaver/models/terminal_display.rb, line 46
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount_guide_type = hash['amount_guide_type']
  percentage_guide = PercentageGuide.from_hash(hash['percentage_guide']) if
    hash['percentage_guide']
  flat_guide = FlatGuide.from_hash(hash['flat_guide']) if
    hash['flat_guide']

  # Create object from extracted values.
  TerminalDisplay.new(amount_guide_type,
                      percentage_guide,
                      flat_guide)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/terminal_display.rb, line 29
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount_guide_type'] = 'amount_guide_type'
  @_hash['percentage_guide'] = 'percentage_guide'
  @_hash['flat_guide'] = 'flat_guide'
  @_hash
end
new(amount_guide_type = nil, percentage_guide = nil, flat_guide = nil) click to toggle source
# File lib/beaver/models/terminal_display.rb, line 37
def initialize(amount_guide_type = nil,
               percentage_guide = nil,
               flat_guide = nil)
  @amount_guide_type = amount_guide_type
  @percentage_guide = percentage_guide
  @flat_guide = flat_guide
end