Class: Hyrb::Models::Developer
- Inherits:
-
Object
- Object
- Hyrb::Models::Developer
- Defined in:
- lib/hyrb/models/developer.rb
Constant Summary collapse
- ROLE_MAP =
{ 1 => :admin, 2 => :developer, 3 => :contractor, 4 => :banned, }
Instance Attribute Summary collapse
-
#digital_ocean_id ⇒ Object
Returns the value of attribute digital_ocean_id.
-
#email ⇒ Object
Returns the value of attribute email.
-
#github_username ⇒ Object
Returns the value of attribute github_username.
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#name ⇒ Object
Returns the value of attribute name.
-
#role ⇒ Object
Returns the value of attribute role.
Instance Method Summary collapse
- #employee? ⇒ Boolean
-
#initialize(hash = {}) ⇒ Developer
constructor
A new instance of Developer.
- #to_hash ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Developer
Returns a new instance of Developer.
13 14 15 16 17 |
# File 'lib/hyrb/models/developer.rb', line 13 def initialize(hash = {}) hash.each do |k,v| send("#{k}=", v) end end |
Instance Attribute Details
#digital_ocean_id ⇒ Object
Returns the value of attribute digital_ocean_id.
11 12 13 |
# File 'lib/hyrb/models/developer.rb', line 11 def digital_ocean_id @digital_ocean_id end |
#email ⇒ Object
Returns the value of attribute email.
11 12 13 |
# File 'lib/hyrb/models/developer.rb', line 11 def email @email end |
#github_username ⇒ Object
Returns the value of attribute github_username.
11 12 13 |
# File 'lib/hyrb/models/developer.rb', line 11 def github_username @github_username end |
#keys ⇒ Object
Returns the value of attribute keys.
11 12 13 |
# File 'lib/hyrb/models/developer.rb', line 11 def keys @keys end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/hyrb/models/developer.rb', line 11 def name @name end |
#role ⇒ Object
Returns the value of attribute role.
11 12 13 |
# File 'lib/hyrb/models/developer.rb', line 11 def role @role end |
Instance Method Details
#employee? ⇒ Boolean
19 20 21 |
# File 'lib/hyrb/models/developer.rb', line 19 def employee? [:admin, :developer].include?(role) end |
#to_hash ⇒ Object
23 24 25 |
# File 'lib/hyrb/models/developer.rb', line 23 def to_hash Hash[%w(name email role github_username keys).map { |a| [a, send(a)] }] end |