class Beaver::Weight

Weight Model.

Attributes

units[RW]

TODO: Write general description for this method @return [UnitsEnum]

weight[RW]

TODO: Write general description for this method @return [Float]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

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

  # Extract variables from the hash.
  units = hash['units']
  weight = hash['weight']

  # Create object from extracted values.
  Weight.new(units,
             weight)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/weight.rb, line 18
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['units'] = 'units'
  @_hash['weight'] = 'weight'
  @_hash
end
new(units = nil, weight = nil) click to toggle source
# File lib/beaver/models/weight.rb, line 25
def initialize(units = nil,
               weight = nil)
  @units = units
  @weight = weight
end