Class: Harvest::UserAssignment

Inherits:
Hashie::Mash
  • Object
show all
Includes:
Model
Defined in:
lib/harvest/user_assignment.rb

Instance Method Summary (collapse)

Methods included from Model

included

Constructor Details

- (UserAssignment) initialize(args = {}, _ = nil)



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

- (Boolean) active?



22
23
24
# File 'lib/harvest/user_assignment.rb', line 22

def active?
  !deactivated
end

- (Object) project=(project)



18
19
20
# File 'lib/harvest/user_assignment.rb', line 18

def project=(project)
  self["project_id"] = project.to_i
end

- (Object) user=(user)



14
15
16
# File 'lib/harvest/user_assignment.rb', line 14

def user=(user)
  self["user_id"] = user.to_i
end

- (Object) user_as_json



26
27
28
# File 'lib/harvest/user_assignment.rb', line 26

def user_as_json
  {"user" => {"id" => user_id}}
end