lib/travis/client/entity.rb in travis-1.5.9.travis.360.4 vs lib/travis/client/entity.rb in travis-1.5.9.travis.361.4
- old
+ new
@@ -23,10 +23,14 @@
def self.aka(*names)
names.each { |n| MAP[n.to_s] = self }
end
+ def self.weak?
+ false
+ end
+
def self.one(key = nil)
MAP[key.to_s] = self if key
@one ||= key.to_s
end
@@ -83,12 +87,13 @@
end
id_field :id
def initialize(session, id)
+ raise Travis::Client::Error, '%p is not a valid id' % id unless self.class.id? id
@attributes = {}
@session = session
- @id = self.class.cast_id(id)
+ @id = self.class.cast_id(id) if id
end
def update_attributes(data)
data.each_pair do |key, value|
self[key] = value