freelancer4r 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +6 -0
- data/LICENSE.txt +1 -0
- data/README.rdoc +50 -0
- data/Rakefile.rb +35 -0
- data/lib/freelancer.rb +75 -0
- data/lib/freelancer/api.rb +30 -0
- data/lib/freelancer/authentication.rb +104 -0
- data/lib/freelancer/common.rb +120 -0
- data/lib/freelancer/core.rb +26 -0
- data/lib/freelancer/employer.rb +122 -0
- data/lib/freelancer/freelancer.rb +82 -0
- data/lib/freelancer/job.rb +10 -0
- data/lib/freelancer/message.rb +70 -0
- data/lib/freelancer/notification.rb +17 -0
- data/lib/freelancer/payment.rb +153 -0
- data/lib/freelancer/profile.rb +83 -0
- data/lib/freelancer/project.rb +97 -0
- data/lib/freelancer/user.rb +65 -0
- data/lib/freelancer/util.rb +35 -0
- data/lib/freelancer/widget.rb +176 -0
- metadata +136 -0
@@ -0,0 +1,122 @@
|
|
1
|
+
module Freelancer
|
2
|
+
module Employer
|
3
|
+
#Post a new project.
|
4
|
+
#
|
5
|
+
#http://developer.freelancer.com/PostNewProject
|
6
|
+
#
|
7
|
+
#<b>Required:</b>
|
8
|
+
#:projectType => The type of tye project (:normal,:trial,:draft)
|
9
|
+
#:projectname => Project name to post
|
10
|
+
#:projectdesc => Project description
|
11
|
+
#:jobtypecsv => Job category associated with project
|
12
|
+
#:budget => Budget of the project
|
13
|
+
#:duration => Period of the project
|
14
|
+
#
|
15
|
+
#<b>Optional:</b> (available on :normal and :draft)
|
16
|
+
#:isfeatured => Set to 1 if post as a featured project.(Default: 0)
|
17
|
+
#:isnonpublic => Set to 1 if post as a nonpublic project.(Default: 0)
|
18
|
+
#:isbidhidden => Set to 1 if post as a sealbids project.(Default: 0)
|
19
|
+
def postNewProject *args
|
20
|
+
options=fill_args [
|
21
|
+
:projectType,
|
22
|
+
:projectname,
|
23
|
+
:projectdesc,
|
24
|
+
:jobtypecsv,
|
25
|
+
:budget,
|
26
|
+
:duration,
|
27
|
+
:isfeatured,
|
28
|
+
:isnonpublic,
|
29
|
+
:isbidhidden
|
30
|
+
],[
|
31
|
+
:projectType,
|
32
|
+
:projectname,
|
33
|
+
:projectdesc,
|
34
|
+
:jobtypecsv,
|
35
|
+
:budget,
|
36
|
+
:duration
|
37
|
+
],*args
|
38
|
+
type=options.delete(:projectType)
|
39
|
+
case type
|
40
|
+
when :normal
|
41
|
+
request "/Employer/postNewProject.json",options
|
42
|
+
when :draft
|
43
|
+
request "/Employer/postNewDraftProject.json",options
|
44
|
+
when :trial
|
45
|
+
options.delete(:isfeatured)
|
46
|
+
options.delete(:isnonpublic)
|
47
|
+
options.delete(:isbidhidden)
|
48
|
+
request "/Employer/postNewTrialProject.json",options
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
#Allows a project creator to select a freelancer for their project.
|
53
|
+
#
|
54
|
+
#http://developer.freelancer.com/ChooseWinnerForProject
|
55
|
+
#
|
56
|
+
#<b>Required:</b>
|
57
|
+
#:projectid => Project identifier
|
58
|
+
#:useridcsv => Allows multiple winner for ALL except full-time jobs. At-least one ID mandatory
|
59
|
+
def chooseWinnerForProject *args
|
60
|
+
options=fill_args [:projectid,:useridcsv],[:projectid,:useridcsv],*args
|
61
|
+
request "/Employer/chooseWinnerForProject.json", options
|
62
|
+
end
|
63
|
+
|
64
|
+
#Retrieve the list of projects posted by the current user.
|
65
|
+
#
|
66
|
+
#http://developer.freelancer.com/GetPostedProjectList
|
67
|
+
#
|
68
|
+
#<b>Required:</b>
|
69
|
+
#:status
|
70
|
+
# 1 - All
|
71
|
+
# 2 - Open And Frozen – Default
|
72
|
+
# 3 - Frozen Awaiting your action
|
73
|
+
# 4 - Awaiting Bidder Action
|
74
|
+
# 5 - Closed Won
|
75
|
+
# 6 - Closed Lost
|
76
|
+
# 7 - Closed Canceled
|
77
|
+
#
|
78
|
+
#<b>Optional:</b>
|
79
|
+
#:userid => UserID of the Poster
|
80
|
+
#:projectid => Project ID filter
|
81
|
+
#:count => (Default: 50)
|
82
|
+
#:page => (Default: 0)
|
83
|
+
def getPostedProjectList *args
|
84
|
+
options=fill_args [:status,:userid,:projectid,:count,:page],[:status],*args
|
85
|
+
request "/Employer/getPostedProjectList.json", options
|
86
|
+
end
|
87
|
+
|
88
|
+
#Invite a freelancer to bid on a created project.
|
89
|
+
#
|
90
|
+
#http://developer.freelancer.com/InviteUserForProject
|
91
|
+
#
|
92
|
+
#<b>Required:</b>
|
93
|
+
#:useridcsv => :useridcsv <b>OR</b> :usernamecsv
|
94
|
+
#:usernamecsv => Can be CSV also to allow multiple user invite
|
95
|
+
#:projectid => Project identifier
|
96
|
+
def inviteUserForProject *args
|
97
|
+
options=fill_args [:useridcsv,:usernamecsv,:projectid],[:projectid],*args
|
98
|
+
if options[:useridcsv]==nil && options[:usernamecsv]==nil
|
99
|
+
raise "useridcsv or usernamecsv is required"
|
100
|
+
end
|
101
|
+
if options[:useridcsv]!=nil && options[:usernamecsv]!=nil
|
102
|
+
raise "Both useridcsv and usernamecsv is not allowed"
|
103
|
+
end
|
104
|
+
request "/Employer/inviteUserForProject.json", options
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
#Update the details for a posted project.
|
109
|
+
#
|
110
|
+
#http://developer.freelancer.com/UpdateProjectDetails
|
111
|
+
#
|
112
|
+
#<b>Required:</b>
|
113
|
+
#:projectid
|
114
|
+
#
|
115
|
+
#<b>Optional:</b>
|
116
|
+
#:projectdesc
|
117
|
+
#:jobtypecsv
|
118
|
+
def updateProjectDetails *args
|
119
|
+
options=fill_args [:projectid,:projectdesc,:jobtypecsv],[:projectid],*args
|
120
|
+
request "/Employer/updateProjectDetails.json", options
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Freelancer
|
2
|
+
module FreelancersCall
|
3
|
+
#Get the list of projects that have been bid by the current user.
|
4
|
+
#
|
5
|
+
#http://developer.freelancer.com/GetProjectListForPlacedBids
|
6
|
+
#
|
7
|
+
#<b>Required:</b>
|
8
|
+
#:status
|
9
|
+
# 1 - All
|
10
|
+
# 2 - Open And Frozen – Default
|
11
|
+
# 3 - Frozen Awaiting your action
|
12
|
+
# 4 - Awaiting Bidder Action
|
13
|
+
# 5 - Closed Won
|
14
|
+
# 6 - Closed Lost
|
15
|
+
# 7 - Closed Canceled
|
16
|
+
#
|
17
|
+
#<b>Optional:</b>
|
18
|
+
#:userid => UserID of the Poster
|
19
|
+
#:projectid => Project ID filter
|
20
|
+
#:count => (Default: 50)
|
21
|
+
#:page => (Default: 0)
|
22
|
+
def getProjectListForPlacedBids
|
23
|
+
options=fill_args [:status,:userid,:projectid,:count,:page],[:status],*args
|
24
|
+
request "/Freelancer/getProjectListForPlacedBids.json", options
|
25
|
+
end
|
26
|
+
|
27
|
+
#Place bid on project.
|
28
|
+
#
|
29
|
+
#http://developer.freelancer.com/PlaceBidOnProject
|
30
|
+
#
|
31
|
+
#<b>Required:</b>
|
32
|
+
#:amount => amount
|
33
|
+
#:days => days
|
34
|
+
#:description => description
|
35
|
+
#:projectid => project identifier
|
36
|
+
#
|
37
|
+
#<b>Optional:</b>
|
38
|
+
#:notificationStatus => Notification on anyone else bid on this project at a lower price. 0 - no notification, 1 - notification (Default: 0)
|
39
|
+
#:highlighted => Highlight bids. 0 - not highlighted, 1 - highlighted. (Default: 0)
|
40
|
+
#:milestone => The initial milestone percentage declares the terms of your bid. This tells the employer that you require the specified percentage as a milestone payment before you start work.
|
41
|
+
def placeBidOnProject *args
|
42
|
+
options=fill_args [
|
43
|
+
:amount,
|
44
|
+
:days,
|
45
|
+
:description,
|
46
|
+
:projectid,
|
47
|
+
:notificationStatus,
|
48
|
+
:highlighted,
|
49
|
+
:milestone
|
50
|
+
],[
|
51
|
+
:amount,
|
52
|
+
:days,
|
53
|
+
:description,
|
54
|
+
:projectid
|
55
|
+
],*args
|
56
|
+
request "/Freelancer/placeBidOnProject.json", options
|
57
|
+
end
|
58
|
+
|
59
|
+
#Retract a bid that has been placed on a project.
|
60
|
+
#
|
61
|
+
#http://developer.freelancer.com/RetractBidFromProject
|
62
|
+
#
|
63
|
+
#<b>Required:</b>
|
64
|
+
#:projectid => project identifier
|
65
|
+
def retractBidFromProject *args
|
66
|
+
options=fill_args [:projectid],[:projectid],*args
|
67
|
+
request "/Freelancer/retractBidFromProject.json", options
|
68
|
+
end
|
69
|
+
|
70
|
+
#After a freelancer has been selected for a project, this method should be called to accept the offer.
|
71
|
+
#
|
72
|
+
#http://developer.freelancer.com/AcceptBidWon
|
73
|
+
#
|
74
|
+
#<b>Required:</b>
|
75
|
+
#:projectid => project identifier
|
76
|
+
#:state => 0 - decline , 1 - Accept (default)
|
77
|
+
def acceptBidWon *args
|
78
|
+
options=fill_args [:projectid,:state],[:projectid],*args
|
79
|
+
request "/Freelancer/acceptBidWon.json", options
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Freelancer
|
2
|
+
module Job
|
3
|
+
#Retrieve the list of current job categories. We frequently tune our job categories. As a result, applications are expected to retrieve and update jobs list dynamically.
|
4
|
+
#
|
5
|
+
#http://developer.freelancer.com/GetJobList
|
6
|
+
def getJobList
|
7
|
+
request "/Job/getJobList.json"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Freelancer
|
2
|
+
module Message
|
3
|
+
#Retrieve private messages sent to the current user.
|
4
|
+
#
|
5
|
+
#http://developer.freelancer.com/GetInboxMessages
|
6
|
+
#
|
7
|
+
#<b>Optional:</b>
|
8
|
+
#:projectid => Get the private messages for the specific project
|
9
|
+
#:count
|
10
|
+
#:page
|
11
|
+
def getInboxMessages *args
|
12
|
+
options=fill_args [:projectid,:count,:page],[],*args
|
13
|
+
request "/Message/getInboxMessages.json", options
|
14
|
+
end
|
15
|
+
|
16
|
+
#Retrieve private messages sent by the current user.
|
17
|
+
#
|
18
|
+
#http://developer.freelancer.com/GetSentMessages
|
19
|
+
#
|
20
|
+
#<b>Optional:</b>
|
21
|
+
#:count
|
22
|
+
#:page
|
23
|
+
def getSentMessages *args
|
24
|
+
options=fill_args [:count,:page],[],*args
|
25
|
+
request "/Message/getSentMessages.json", options
|
26
|
+
end
|
27
|
+
|
28
|
+
#Retrieve the number of unread messages received by the current user.
|
29
|
+
#
|
30
|
+
#http://developer.freelancer.com/GetUnreadCount
|
31
|
+
def getUnreadCount
|
32
|
+
request "/Message/getUnreadCount.json"
|
33
|
+
end
|
34
|
+
|
35
|
+
#Send a private message.
|
36
|
+
#
|
37
|
+
#http://developer.freelancer.com/SendMessage
|
38
|
+
#
|
39
|
+
#<b>Required:</b>
|
40
|
+
#:projectid => Project Id to identify the message send with
|
41
|
+
#:messagetext => Message text to send
|
42
|
+
#:userid => Receiver userid or username
|
43
|
+
#:username => Receiver userid or username
|
44
|
+
def sendMessage *args
|
45
|
+
options=fill_args [
|
46
|
+
:projectid,:messagetext,:userid,:username
|
47
|
+
],[
|
48
|
+
:projectid,:messagetext
|
49
|
+
],*args
|
50
|
+
if options[:username]==nil && options[:userid]==nil
|
51
|
+
raise "Username or userid is required"
|
52
|
+
end
|
53
|
+
if options[:username]!=nil && options[:userid]!=nil
|
54
|
+
raise "Both username and userid is not allowed"
|
55
|
+
end
|
56
|
+
request "/Message/sendMessage.json", options
|
57
|
+
end
|
58
|
+
|
59
|
+
#Mark an income message as read.
|
60
|
+
#
|
61
|
+
#http://developer.freelancer.com/MarkMessageAsRead
|
62
|
+
#
|
63
|
+
#<b>Required:</b>
|
64
|
+
#:id => Message Id to be marked as read
|
65
|
+
def markMessageAsRead *args
|
66
|
+
options=fill_args [:id],[:id],*args
|
67
|
+
request "/Message/markMessageAsRead.json", options
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Freelancer
|
2
|
+
module Notification
|
3
|
+
#Get alert messages for the current user. This information is quite important if exists, applications are advised to show this information as soon as possible if it is available.
|
4
|
+
#
|
5
|
+
#http://developer.freelancer.com/GetNotification
|
6
|
+
def getNotification
|
7
|
+
request "/Notification/getNotification.json"
|
8
|
+
end
|
9
|
+
|
10
|
+
#Get the current news items posted by the Freelancer.com staff. Like the coming events.
|
11
|
+
#
|
12
|
+
#http://developer.freelancer.com/GetNews
|
13
|
+
def getNews
|
14
|
+
request "/Notification/getNews.json"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
module Freelancer
|
2
|
+
module Payment
|
3
|
+
#Retrieve the current user's balance and the details of the last transaction.
|
4
|
+
#
|
5
|
+
#http://developer.freelancer.com/GetAccountBalanceStatus
|
6
|
+
def getAccountBalanceStatus
|
7
|
+
request "/Payment/getAccountBalanceStatus.json"
|
8
|
+
end
|
9
|
+
|
10
|
+
#Retrieve the list of transactions and details for an account.
|
11
|
+
#
|
12
|
+
#http://developer.freelancer.com/GetAccountTransactionList
|
13
|
+
#
|
14
|
+
#<b>Optional:</b>
|
15
|
+
#:count => (Default: 50)
|
16
|
+
#:page => (Default: 0)
|
17
|
+
#:datefrom => Get transactions from the date
|
18
|
+
#:dateto => Get transactions up to the date
|
19
|
+
def getAccountTransactionList *args
|
20
|
+
options=fill_args [
|
21
|
+
:count,:page,:datefrom,:dateto
|
22
|
+
],[],*args
|
23
|
+
request "/Payment/getAccountTransactionList.json", options
|
24
|
+
end
|
25
|
+
|
26
|
+
#Make a request to withdraw funds.
|
27
|
+
#
|
28
|
+
#http://developer.freelancer.com/RequestWithdrawal
|
29
|
+
#
|
30
|
+
#<b>Required:</b>
|
31
|
+
#:amount => Withdraw amount
|
32
|
+
#:method => :paypal | :moneybooker | :wire | :paynoneer (default)
|
33
|
+
#:additionaltext => Required for wire withdraw
|
34
|
+
#:paypalemail => Required for paypal withdraw
|
35
|
+
#:mb_account => Required for moneybooker withdraw
|
36
|
+
#:description => Required for wire withedraw
|
37
|
+
#:country_code => Required for wire withdraw
|
38
|
+
def requestWithdrawal *args
|
39
|
+
options=fill_args [
|
40
|
+
:amount,
|
41
|
+
:method,
|
42
|
+
:additionaltext,
|
43
|
+
:paypalemail,
|
44
|
+
:mb_account,
|
45
|
+
:description,
|
46
|
+
:country_code
|
47
|
+
],[
|
48
|
+
:amount,
|
49
|
+
:method,
|
50
|
+
:additionaltext,
|
51
|
+
:paypalemail,
|
52
|
+
:mb_account,
|
53
|
+
:description,
|
54
|
+
:country_code
|
55
|
+
],*args
|
56
|
+
request "/Payment/requestWithdrawal.json", options
|
57
|
+
end
|
58
|
+
|
59
|
+
#Create a milestone (escrow) payment.
|
60
|
+
#
|
61
|
+
#http://developer.freelancer.com/CreateMilestonePayment
|
62
|
+
#
|
63
|
+
#<b>Required:</b>
|
64
|
+
#:projectid => Mandatory if Partial or Full payment for a project.
|
65
|
+
#:amount => Milestone amount
|
66
|
+
#:touserid => Userid or username create milestone payment to
|
67
|
+
#:tousername => Userid or username create milestone payment to
|
68
|
+
#:reasontext => Text attached to transfer
|
69
|
+
#:reasontype => partial|full|other
|
70
|
+
def createMilestonePayment *args
|
71
|
+
options=fill_args [
|
72
|
+
:projectid,
|
73
|
+
:amount,
|
74
|
+
:touserid,
|
75
|
+
:tousername,
|
76
|
+
:reasontext,
|
77
|
+
:reasontype
|
78
|
+
],[
|
79
|
+
:projectid,
|
80
|
+
:amount,
|
81
|
+
:reasontext,
|
82
|
+
:reasontype
|
83
|
+
],*args
|
84
|
+
if options[:touserid]==nil && options[:tousername]==nil
|
85
|
+
raise "touserid or tousername is required"
|
86
|
+
end
|
87
|
+
if options[:touserid]!=nil && options[:tousername]!=nil
|
88
|
+
raise "Both touserid and tousername is not allowed"
|
89
|
+
end
|
90
|
+
request "/Payment/createMilestonePayment.json", options
|
91
|
+
end
|
92
|
+
|
93
|
+
#Cancel milestone
|
94
|
+
#
|
95
|
+
#http://developer.freelancer.com/CancelMilestone
|
96
|
+
#
|
97
|
+
#<b>Required:</b>
|
98
|
+
#:transactionid => Transaction Id
|
99
|
+
def cancelMilestone *args
|
100
|
+
options=fill_args [:transactionid],[:transactionid],*args
|
101
|
+
request "/Payment/cancelMilestone.json", options
|
102
|
+
end
|
103
|
+
|
104
|
+
#Get the list of incoming and outgoing milestone(escrow) payments.
|
105
|
+
#
|
106
|
+
#http://developer.freelancer.com/GetAccountMilestoneList
|
107
|
+
#
|
108
|
+
#<b>Optional:</b>
|
109
|
+
#:type => Incoming(default) or Outgoing
|
110
|
+
#:count => (Default: 50)
|
111
|
+
#:page => (Default: 0)
|
112
|
+
def getAccountMilestoneList *args
|
113
|
+
options=fill_args [:type,:count,:page],[],*args
|
114
|
+
request "/Payment/getAccountMilestoneList.json", options
|
115
|
+
end
|
116
|
+
|
117
|
+
#View the list of withdrawals that have been requested and are pending.
|
118
|
+
#
|
119
|
+
#http://developer.freelancer.com/GetAccountWithdrawalList
|
120
|
+
#
|
121
|
+
#<b>Optional:</b>
|
122
|
+
#:type => Incoming(default) or Outgoing
|
123
|
+
#:count => (Default: 50)
|
124
|
+
#:page => (Default: 0)
|
125
|
+
def getAccountWithdrawalList *args
|
126
|
+
options=fill_args [:type,:count,:page],[],*args
|
127
|
+
request "/Payment/getAccountMilestoneList.json", options
|
128
|
+
end
|
129
|
+
|
130
|
+
#Send a request to payer for releasing an incoming milestone payment.
|
131
|
+
#
|
132
|
+
#http://developer.freelancer.com/RequestReleaseMilestone
|
133
|
+
#
|
134
|
+
#<b>Required:</b>
|
135
|
+
#:transactionid => Transaction Id
|
136
|
+
def requestReleaseMilestone *args
|
137
|
+
options=fill_args [:transactionid],[:transactionid],*args
|
138
|
+
request "/Payment/requestReleaseMilestone.json", options
|
139
|
+
end
|
140
|
+
|
141
|
+
#Release a milestone payment.
|
142
|
+
#
|
143
|
+
#http://developer.freelancer.com/ReleaseMilestone
|
144
|
+
#
|
145
|
+
#<b>Required:</b>
|
146
|
+
#:transactionid => Transaction Id
|
147
|
+
#:fullname => Fullname of the payer
|
148
|
+
def releaseMilestone *args
|
149
|
+
options=fill_args [:transactionid,:fullname],[:transactionid,:fullname],*args
|
150
|
+
request "/Payment/releaseMilestone.json", options
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|