Method: Harvest::API::UserAssignments#create

Defined in:
lib/harvest/api/user_assignments.rb

#create(user_assignment) ⇒ Object



15
16
17
18
19
20
# File 'lib/harvest/api/user_assignments.rb', line 15

def create(user_assignment)
  user_assignment = Harvest::UserAssignment.wrap(user_assignment)
  response = request(:post, credentials, "/projects/#{user_assignment.project_id}/user_assignments", :body => user_assignment.user_as_json.to_json)
  id = response.headers["location"].match(/\/.*\/(\d+)\/.*\/(\d+)/)[2]
  find(user_assignment.project_id, id)
end