class Beaver::PercentageGuide
The configuration for a percentage tip guide. All three guides must be provided.
Attributes
percentage_high[RW]
The 'high' guide. @return [Integer]
percentage_low[RW]
The 'low' guide. @return [Integer]
percentage_medium[RW]
The 'medium' guide. @return [Integer]
show_amount[RW]
Whether or not to show the amount that the percentage equates to in the tip guide button. @return [Boolean]
Public Class Methods
from_hash(hash)
click to toggle source
Creates an instance of the object from a hash.
# File lib/beaver/models/percentage_guide.rb, line 48 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. show_amount = hash['show_amount'] percentage_low = hash['percentage_low'] percentage_medium = hash['percentage_medium'] percentage_high = hash['percentage_high'] # Create object from extracted values. PercentageGuide.new(show_amount, percentage_low, percentage_medium, percentage_high) end
names()
click to toggle source
A mapping from model property names to API property names.
# File lib/beaver/models/percentage_guide.rb, line 28 def self.names @_hash = {} if @_hash.nil? @_hash['show_amount'] = 'show_amount' @_hash['percentage_low'] = 'percentage_low' @_hash['percentage_medium'] = 'percentage_medium' @_hash['percentage_high'] = 'percentage_high' @_hash end
new(show_amount = nil, percentage_low = nil, percentage_medium = nil, percentage_high = nil)
click to toggle source
# File lib/beaver/models/percentage_guide.rb, line 37 def initialize(show_amount = nil, percentage_low = nil, percentage_medium = nil, percentage_high = nil) @show_amount = show_amount @percentage_low = percentage_low @percentage_medium = percentage_medium @percentage_high = percentage_high end