Class: Harvest::UserAssignment
- Inherits:
-
Hashie::Mash
- Object
- Hashie::Mash
- Harvest::UserAssignment
- Includes:
- Model
- Defined in:
- lib/harvest/user_assignment.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
-
#initialize(args = {}, _ = nil) ⇒ UserAssignment
constructor
A new instance of UserAssignment.
- #project=(project) ⇒ Object
- #user=(user) ⇒ Object
- #user_as_json ⇒ Object
Methods included from Model
Constructor Details
#initialize(args = {}, _ = nil) ⇒ UserAssignment
Returns a new instance of UserAssignment.
7 8 9 10 11 12 |
# File 'lib/harvest/user_assignment.rb', line 7 def initialize(args = {}, _ = nil) args = args.to_hash.stringify_keys self.user = args.delete("user") if args["user"] self.project = args.delete("project") if args["project"] super end |
Instance Method Details
#active? ⇒ Boolean
22 23 24 |
# File 'lib/harvest/user_assignment.rb', line 22 def active? !deactivated end |
#project=(project) ⇒ Object
18 19 20 |
# File 'lib/harvest/user_assignment.rb', line 18 def project=(project) self["project_id"] = project.to_i end |
#user=(user) ⇒ Object
14 15 16 |
# File 'lib/harvest/user_assignment.rb', line 14 def user=(user) self["user_id"] = user.to_i end |
#user_as_json ⇒ Object
26 27 28 |
# File 'lib/harvest/user_assignment.rb', line 26 def user_as_json {"user" => {"id" => user_id}} end |