Class: Joey::Location

Inherits:
Model
  • Object
show all
Defined in:
lib/joey/location.rb

Instance Attribute Summary

Attributes inherited from Model

#client, #errors

Instance Method Summary collapse

Methods inherited from Model

define_properties, find, get_all, has_association, hash_populating_accessor, hash_populating_association, #initialize, recognize?

Constructor Details

This class inherits a constructor from Joey::Model

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/joey/location.rb', line 11

def valid?
  self.validate
  puts self.errors.inspect unless self.errors.empty?
  self.errors.empty?
end

#validateObject



5
6
7
8
9
# File 'lib/joey/location.rb', line 5

def validate
  valid = true
  errors << { :message => "country should be string but is #{country.inspect}" } unless country.is_a?(String)
  errors << { :message => "city should be string but is #{city.inspect}" } unless city.is_a?(String)
end