Module: Freelancer::API::Freelancer::InstanceMethods

Defined in:
lib/freelancer/api/freelancer.rb

Instance Method Summary collapse

Instance Method Details

#accept_won_bid(*args) ⇒ Object

Accept a won bid

Valid parameters are:

- project_id: the id of the project to accept the offer on


85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/freelancer/api/freelancer.rb', line 85

def accept_won_bid(*args)

  params = extract_params(args)

  # Execute the service call
  result = api_get("/Freelancer/acceptBidWon.json", build_api_params({
    :projectid => params[:project_id]
  }))

  # Parse and return the response
  ::Freelancer::Models::StatusConfirmation.parse(result, :shift => :"json-result")
  
end

#bid_on_project(*args) ⇒ Object

Place a bid on a project

Valid parameters are:

- project_id: the id of the project to bid on
- amount: the amount of money to offer taking the project for
- description: the bid description
- days: the estimated number of days to complete the project
- notify_on_underbid: if notifications should be send when someone bids lower than this bid
- highlighted: if this bid is highlighted or not
- milestone: declares the initial milestone percentage for the bid


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/freelancer/api/freelancer.rb', line 43

def bid_on_project(*args)

  params = extract_params(args)

  # Execute the service call
  result = api_get("/Freelancer/placeBidOnProject.json", build_api_params({
    :projectid => params[:project_id],
    :amount => params[:amount],
    :description => params[:description],
    :days => params[:days],
    :notificationStatus => params[:notify_on_underbid],
    :highlighted => params[:highlighted],
    :milestone => params[:milestone]
  }))

  # Parse and return the response
  ::Freelancer::Models::StatusConfirmation.parse(result, :shift => :"json-result")
  
end

#bid_projects(*args) ⇒ Object

Get a list of all projects where the specified user have placed a bid. If no user id is specified, the current user is used.

Valid parameters are:

- status: the project status to filter the results by (defaults to 2 - open and frozen)
- user_id: the id of the user to retrieve projects for
- project_id: the project id to filter the results by
- count: the number of results to return (defaults to 50)
- page: the page to retrieve (defaults to 0)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/freelancer/api/freelancer.rb', line 15

def bid_projects(*args)

  params = extract_params(args)

  # Execute the service call
  result = api_get("/Freelancer/getProjectListForPlacedBids.json", build_api_params({
    :status => params[:status],
    :userid => params[:user_id],
    :projectid => params[:project_id],
    :count => params[:count],
    :page => params[:page]
  }))
  
  # Parse and return the response
  ::Freelancer::Models::Project.parse_collection(result, :shift => [ :"json-result", :items ])
  
end

#reject_won_bid(*args) ⇒ Object

Reject a won bid

Valid parameters are:

- project_id: the id of the project to reject the offer on


103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/freelancer/api/freelancer.rb', line 103

def reject_won_bid(*args)

  params = extract_params(args)

  # Execute the service call
  result = api_get("/Freelancer/acceptBidWon.json", build_api_params({
    :projectid => params[:project_id],
    :state => 0
  }))

  # Parse and return the response
  ::Freelancer::Models::StatusConfirmation.parse(result, :shift => :"json-result")
  
end

#retract_bid_from_project(*args) ⇒ Object

Retract a bid from a project

Valid parameters are:

- project_id: the id of the project to withdraw bid from


67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/freelancer/api/freelancer.rb', line 67

def retract_bid_from_project(*args)

  params = extract_params(args)

  # Execute the service call
  result = api_get("/Freelancer/retractBidFromProject.json", build_api_params({
    :projectid => params[:project_id]
  }))

  # Parse and return the response
  ::Freelancer::Models::StatusConfirmation.parse(result, :shift => :"json-result")
  
end