class Beaver::Name

Name Model.

Attributes

first[RW]

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

last[RW]

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

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

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

  # Extract variables from the hash.
  first = hash['first']
  last = hash['last']

  # Create object from extracted values.
  Name.new(first,
           last)
end
names() click to toggle source

A mapping from model property names to API property names.

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