Class: Upwork::Api::Routers::Hr::Milestones

Inherits:
Object
  • Object
show all
Defined in:
lib/upwork/api/routers/hr/milestones.rb

Overview

Milestones workflow

Constant Summary collapse

ENTRY_POINT =
'api'

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Milestones

Init

Arguments:

client: (Client)


26
27
28
29
# File 'lib/upwork/api/routers/hr/milestones.rb', line 26

def initialize(client)
  @client = client
  @client.epoint = ENTRY_POINT 
end

Instance Method Details

#activate(milestone_id, params) ⇒ Object

Activate an existing Milestone

Arguments:

milestone_id: (String)
params: (Hash)


73
74
75
76
# File 'lib/upwork/api/routers/hr/milestones.rb', line 73

def activate(milestone_id, params)
  $LOG.i "running " + __method__.to_s
  @client.put '/hr/v3/fp/milestones/' + milestone_id + '/activate', params
end

#approve(milestone_id, params) ⇒ Object

Approve an existing Milestone

Arguments:

milestone_id: (String)
params: (Hash)


83
84
85
86
# File 'lib/upwork/api/routers/hr/milestones.rb', line 83

def approve(milestone_id, params)
  $LOG.i "running " + __method__.to_s
  @client.put '/hr/v3/fp/milestones/' + milestone_id + '/approve', params
end

#create(params) ⇒ Object

Create a new Milestone

Arguments:

params: (Hash)


53
54
55
56
# File 'lib/upwork/api/routers/hr/milestones.rb', line 53

def create(params)
  $LOG.i "running " + __method__.to_s
  @client.post '/hr/v3/fp/milestones', params
end

#delete(milestone_id) ⇒ Object

Delete an existing Milestone

Arguments:

milestone_id: (String)


92
93
94
95
# File 'lib/upwork/api/routers/hr/milestones.rb', line 92

def delete(milestone_id)
  $LOG.i "running " + __method__.to_s
  @client.delete '/hr/v3/fp/milestones/' + milestone_id
end

#edit(milestone_id, params) ⇒ Object

Edit an existing Milestone

Arguments:

milestone_id: (String)
params: (Hash)


63
64
65
66
# File 'lib/upwork/api/routers/hr/milestones.rb', line 63

def edit(milestone_id, params)
  $LOG.i "running " + __method__.to_s
  @client.put '/hr/v3/fp/milestones/' + milestone_id, params
end

#get_active_milestone(contract_id) ⇒ Object

Get active Milestone for specific Contract

Arguments:

contract_id: (String)


35
36
37
38
# File 'lib/upwork/api/routers/hr/milestones.rb', line 35

def get_active_milestone(contract_id)
  $LOG.i "running " + __method__.to_s
  @client.get '/hr/v3/fp/milestones/statuses/active/contracts/' + contract_id
end

#get_submissions(milestone_id) ⇒ Object

Get active Milestone for specific Contract

Arguments:

milestone_id: (String)


44
45
46
47
# File 'lib/upwork/api/routers/hr/milestones.rb', line 44

def get_submissions(milestone_id)
  $LOG.i "running " + __method__.to_s
  @client.get '/hr/v3/fp/milestones/' + milestone_id + '/submissions'
end