travis-api/lib/travis/model/account.rb
Aakriti Gupta 65f1a29d86 Move travis-core files from /vendor to /lib.
- Re-factor
- Remove code for notifications
- Remove addons
- Remove travis-core gem.
- Ignore logs directory only
- Move core tests to spec/lib
2016-07-20 11:22:25 +02:00

23 lines
465 B
Ruby

class Account
class << self
def from(record, attrs = {})
new(record.attributes.merge(:type => record.class.name).merge(attrs))
end
end
ATTR_NAMES = [:id, :type, :name, :login, :repos_count, :avatar_url]
attr_accessor *ATTR_NAMES
def initialize(attrs)
attrs = attrs.symbolize_keys
ATTR_NAMES.each do |name|
self.send(:"#{name}=", attrs[name])
end
end
def ==(other)
id == other.id && type == other.type
end
end