freelancer4r 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.rdoc +36 -10
- data/Rakefile.rb +14 -1
- data/lib/freelancer.rb +1 -1
- data/lib/freelancer/authentication.rb +28 -20
- data/lib/freelancer/common.rb +17 -17
- data/lib/freelancer/employer.rb +22 -22
- data/lib/freelancer/freelancer.rb +15 -15
- data/lib/freelancer/message.rb +10 -10
- data/lib/freelancer/payment.rb +27 -27
- data/lib/freelancer/profile.rb +25 -25
- data/lib/freelancer/project.rb +20 -20
- data/lib/freelancer/user.rb +11 -11
- data/lib/freelancer/widget.rb +35 -34
- metadata +3 -19
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== Freelancer4r 1.0.1 (2010.07.21)
|
2
|
+
* Widget API completed
|
3
|
+
* RDoc correction
|
4
|
+
* Github project url added to gemspec
|
5
|
+
* Rdoc target added to Rakefile
|
6
|
+
* Removed mechanize from dependency
|
7
|
+
|
1
8
|
== Freelancer4r 1.0.1 (2010.07.15)
|
2
9
|
* Added widget api for call http://www.freelancer.com/affiliate-api.html API
|
3
10
|
* First public release
|
data/README.rdoc
CHANGED
@@ -1,22 +1,44 @@
|
|
1
1
|
== Introduction
|
2
2
|
Freelancer API for ruby
|
3
3
|
|
4
|
-
This api allow to call freelancer api from ruby code.
|
5
|
-
|
6
|
-
It's can login to freelancer with "mechanize", using oauth library
|
4
|
+
This api allow to call freelancer api from ruby code.
|
5
|
+
It's can login to freelancer with "mechanize", using oauth library
|
7
6
|
|
8
7
|
== Installation
|
9
8
|
|
10
|
-
gem install freelancer4r
|
9
|
+
gem install freelancer4r
|
11
10
|
|
11
|
+
== Detailed information
|
12
|
+
|
13
|
+
Freelancer api implements two different api for different approach.
|
14
|
+
* Full Freelancer.com API - with this you can do anything with freelancer, required oauth authentication
|
15
|
+
* Freelancer.com Widget API - with this you can do minimal but not required oauth authentication
|
16
|
+
|
17
|
+
Full freelancer API modules:
|
18
|
+
* Freelancer::Common
|
19
|
+
* Freelancer::Employer
|
20
|
+
* Freelancer::FreelancersCall
|
21
|
+
* Freelancer::Job
|
22
|
+
* Freelancer::Message
|
23
|
+
* Freelancer::Notification
|
24
|
+
* Freelancer::Payment
|
25
|
+
* Freelancer::Profile
|
26
|
+
* Freelancer::Project
|
27
|
+
* Freelancer::User
|
28
|
+
|
29
|
+
Widget API modules:
|
30
|
+
* Freelancer::Widget
|
31
|
+
|
32
|
+
See modules documentation
|
33
|
+
|
12
34
|
== Usage
|
13
35
|
|
14
|
-
* Shortest way, to login
|
36
|
+
* Shortest way, to login (require mechanize gem)
|
15
37
|
|
16
38
|
freelancer=Freelancer.new false,"application_token","application_secret","username","password"
|
17
39
|
projects=freelancer.searchProjects
|
18
40
|
|
19
|
-
* Custom one step login
|
41
|
+
* Custom one step login (require mechanize gem)
|
20
42
|
|
21
43
|
freelancer=Freelancer.new false
|
22
44
|
freelancer.application_token=token
|
@@ -27,8 +49,7 @@ gem install freelancer4r
|
|
27
49
|
freelancer.login
|
28
50
|
freelancer.searchprojects
|
29
51
|
|
30
|
-
* Hand staged login
|
31
|
-
(no username and password)
|
52
|
+
* Hand staged login (no username and password)
|
32
53
|
|
33
54
|
freelancer=Freelancer.new false,"application_token","application_secret"
|
34
55
|
freelancer.login_stage1
|
@@ -37,8 +58,7 @@ gem install freelancer4r
|
|
37
58
|
freelancer.login_stage3
|
38
59
|
freelancer.searchProjects
|
39
60
|
|
40
|
-
* Usage for
|
41
|
-
(no username and password)
|
61
|
+
* Usage for web pages with callback (no username and password)
|
42
62
|
|
43
63
|
freelancer=Freelancer.new false,"application_token","application_secret"
|
44
64
|
freelancer.callback="http://example.com/callbackurl"
|
@@ -48,3 +68,9 @@ gem install freelancer4r
|
|
48
68
|
#... user come back to callback page ...
|
49
69
|
freelancer.login_stage3
|
50
70
|
freelancer.serchProjects
|
71
|
+
|
72
|
+
* Using widget api (very basic api with limitations, but not required authentication)
|
73
|
+
|
74
|
+
widget=Freelancer.new_widget true
|
75
|
+
widget.search :keyword=>"Ruby"
|
76
|
+
|
data/Rakefile.rb
CHANGED
@@ -27,9 +27,22 @@ spec=Gem::Specification.new do |s|
|
|
27
27
|
|
28
28
|
s.add_dependency(%q<json>, [">= 1.4.0"])
|
29
29
|
s.add_dependency(%q<oauth>, [">= 0.4.1"])
|
30
|
-
s.add_dependency(%q<mechanize>, [">= 1.0.0"])
|
31
30
|
end
|
32
31
|
|
32
|
+
Rake::RDocTask.new do |rd|
|
33
|
+
rd.rdoc_dir = 'doc/rdoc'
|
34
|
+
rd.title = "Freelancer.com API for ruby documentation"
|
35
|
+
rd.main = 'README.txt'
|
36
|
+
rd.rdoc_files.include 'README.rdoc', 'CHANGELOG', "lib/freelancer.rb", "lib/freelancer/**/*\.rb"
|
37
|
+
|
38
|
+
rd.options << '--inline-source'
|
39
|
+
rd.options << '--line-numbers'
|
40
|
+
rd.options << '--all'
|
41
|
+
# rd.options << '--fileboxes'
|
42
|
+
# rd.options << '--diagram'
|
43
|
+
end
|
44
|
+
|
45
|
+
|
33
46
|
Rake::GemPackageTask.new(spec) do |pkg|
|
34
47
|
pkg.need_tar = true
|
35
48
|
end
|
data/lib/freelancer.rb
CHANGED
@@ -44,8 +44,11 @@ module Freelancer
|
|
44
44
|
login_stage1
|
45
45
|
end
|
46
46
|
if @username != nil && @password != nil && @callback == OAuth::OUT_OF_BAND
|
47
|
-
try_to_authorize
|
48
|
-
|
47
|
+
if try_to_authorize
|
48
|
+
login_stage3
|
49
|
+
else
|
50
|
+
@request_token.authorize_url
|
51
|
+
end
|
49
52
|
else
|
50
53
|
@request_token.authorize_url
|
51
54
|
end
|
@@ -68,7 +71,7 @@ module Freelancer
|
|
68
71
|
def login
|
69
72
|
login_stage1 #login stage 1, request unauthorized token
|
70
73
|
login_stage2 #login stage 2, try to log in ang get the verifier
|
71
|
-
if @authorized
|
74
|
+
if @authorized
|
72
75
|
login_stage3 #if we have verifier, we get the access token key
|
73
76
|
else #if we not have verifier, authentication or not oob callback selected, request manual login, return the url
|
74
77
|
return @request_token.authorize_url
|
@@ -79,26 +82,31 @@ module Freelancer
|
|
79
82
|
|
80
83
|
#Try to emulate user authorization
|
81
84
|
def try_to_authorize
|
82
|
-
|
83
|
-
|
84
|
-
@agent.user_agent_alias='Mac Safari'
|
85
|
+
begin
|
86
|
+
require 'mechanize'
|
85
87
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
login_form.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
88
|
+
@agent ||= Mechanize.new
|
89
|
+
@agent.user_agent_alias='Mac Safari'
|
90
|
+
|
91
|
+
@agent.set_proxy(proxy.host, proxy.port, proxy.user,proxy.password) if proxy != nil
|
92
|
+
page = @agent.get(web_url)
|
93
|
+
login_form=page.form_with(:name=>'login_form')
|
94
|
+
if login_form != nil
|
95
|
+
login_form.field_with(:name=>'username').value=@username
|
96
|
+
login_form.field_with(:name=>'passwd').value=@password
|
97
|
+
@agent.submit(login_form)
|
98
|
+
end
|
99
|
+
initial_page=@agent.get(@request_token.authorize_url)
|
100
|
+
initial_page.forms.each do |form|
|
101
|
+
if form.has_field? 'oauth_token'
|
102
|
+
result=form.submit
|
103
|
+
return true
|
104
|
+
end
|
99
105
|
end
|
106
|
+
rescue LoadError
|
107
|
+
false
|
100
108
|
end
|
101
|
-
|
109
|
+
false
|
102
110
|
end
|
103
111
|
end
|
104
112
|
end
|
data/lib/freelancer/common.rb
CHANGED
@@ -5,9 +5,9 @@ module Freelancer
|
|
5
5
|
#http://developer.freelancer.com/RequestCancelProject
|
6
6
|
#
|
7
7
|
#<b>Required:</b>
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
# :projectid
|
9
|
+
# :commenttext
|
10
|
+
# :reasoncancellation
|
11
11
|
# 1 - Mutual – Default
|
12
12
|
# 2 - Service Done,Not Paid
|
13
13
|
# 3 - Service Not Done.
|
@@ -16,7 +16,7 @@ module Freelancer
|
|
16
16
|
# 6 - Other
|
17
17
|
#
|
18
18
|
#<b>Optional:</b>
|
19
|
-
|
19
|
+
# :followedguidelinesstatus
|
20
20
|
# 1 - I followed
|
21
21
|
# 0 - I didn't follow
|
22
22
|
# (This is option is not needed unless felt necessary)
|
@@ -39,11 +39,11 @@ module Freelancer
|
|
39
39
|
#http://developer.freelancer.com/PostFeedback
|
40
40
|
#
|
41
41
|
#<b>Required:</b>
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
# :rating => 1 to 10
|
43
|
+
# :feedbacktext => Text of feedback
|
44
|
+
# :userid => UserId or username the feedback posted to
|
45
|
+
# :username => UserId or username the feedback posted to
|
46
|
+
# :projectid => Project Id associated with the feedback
|
47
47
|
def postFeedback *args
|
48
48
|
options=fill_args [
|
49
49
|
:rating,:feedbacktext,:userid,:username,:projectid
|
@@ -65,10 +65,10 @@ module Freelancer
|
|
65
65
|
#http://developer.freelancer.com/PostReplyForFeedback
|
66
66
|
#
|
67
67
|
#<b>Required:</b>
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
# :feedbacktext => Text of the feedback
|
69
|
+
# :userid => UserId or username the reply posted to
|
70
|
+
# :username => UserId or username the reply posted to
|
71
|
+
# :projectid => Project Id associated with the feedback
|
72
72
|
def postReplyForFeedback *args
|
73
73
|
options=fill_args [
|
74
74
|
:feedbacktext,:userid,:username,:projectid
|
@@ -89,9 +89,9 @@ module Freelancer
|
|
89
89
|
#http://developer.freelancer.com/RequestWithdrawFeedback
|
90
90
|
#
|
91
91
|
#<b>Required:</b>
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
# :userid => UserId or username the reply posted to
|
93
|
+
# :username => UserId or username the reply posted to
|
94
|
+
# :projectid => Project Id associated with the feedback
|
95
95
|
def requestWithdrawFeedback *args
|
96
96
|
options=fill_args [:userid,:username,:projectid],[:projectid],*args
|
97
97
|
if options[:username]==nil && options[:userid]==nil
|
@@ -108,7 +108,7 @@ module Freelancer
|
|
108
108
|
#http://developer.freelancer.com/GetPendingFeedback
|
109
109
|
#
|
110
110
|
#<b>Optional:</b>
|
111
|
-
|
111
|
+
# :type
|
112
112
|
# P - Provider
|
113
113
|
# B - Buyer,Default
|
114
114
|
def getPendingFeedback *args
|
data/lib/freelancer/employer.rb
CHANGED
@@ -5,17 +5,17 @@ module Freelancer
|
|
5
5
|
#http://developer.freelancer.com/PostNewProject
|
6
6
|
#
|
7
7
|
#<b>Required:</b>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
14
|
#
|
15
15
|
#<b>Optional:</b> (available on :normal and :draft)
|
16
|
-
|
17
|
-
|
18
|
-
|
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
19
|
def postNewProject *args
|
20
20
|
options=fill_args [
|
21
21
|
:projectType,
|
@@ -54,8 +54,8 @@ module Freelancer
|
|
54
54
|
#http://developer.freelancer.com/ChooseWinnerForProject
|
55
55
|
#
|
56
56
|
#<b>Required:</b>
|
57
|
-
|
58
|
-
|
57
|
+
# :projectid => Project identifier
|
58
|
+
# :useridcsv => Allows multiple winner for ALL except full-time jobs. At-least one ID mandatory
|
59
59
|
def chooseWinnerForProject *args
|
60
60
|
options=fill_args [:projectid,:useridcsv],[:projectid,:useridcsv],*args
|
61
61
|
request "/Employer/chooseWinnerForProject.json", options
|
@@ -66,7 +66,7 @@ module Freelancer
|
|
66
66
|
#http://developer.freelancer.com/GetPostedProjectList
|
67
67
|
#
|
68
68
|
#<b>Required:</b>
|
69
|
-
|
69
|
+
# :status
|
70
70
|
# 1 - All
|
71
71
|
# 2 - Open And Frozen – Default
|
72
72
|
# 3 - Frozen Awaiting your action
|
@@ -76,10 +76,10 @@ module Freelancer
|
|
76
76
|
# 7 - Closed Canceled
|
77
77
|
#
|
78
78
|
#<b>Optional:</b>
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
# :userid => UserID of the Poster
|
80
|
+
# :projectid => Project ID filter
|
81
|
+
# :count => (Default: 50)
|
82
|
+
# :page => (Default: 0)
|
83
83
|
def getPostedProjectList *args
|
84
84
|
options=fill_args [:status,:userid,:projectid,:count,:page],[:status],*args
|
85
85
|
request "/Employer/getPostedProjectList.json", options
|
@@ -90,9 +90,9 @@ module Freelancer
|
|
90
90
|
#http://developer.freelancer.com/InviteUserForProject
|
91
91
|
#
|
92
92
|
#<b>Required:</b>
|
93
|
-
|
94
|
-
|
95
|
-
|
93
|
+
# :useridcsv => :useridcsv <b>OR</b> :usernamecsv
|
94
|
+
# :usernamecsv => Can be CSV also to allow multiple user invite
|
95
|
+
# :projectid => Project identifier
|
96
96
|
def inviteUserForProject *args
|
97
97
|
options=fill_args [:useridcsv,:usernamecsv,:projectid],[:projectid],*args
|
98
98
|
if options[:useridcsv]==nil && options[:usernamecsv]==nil
|
@@ -110,11 +110,11 @@ module Freelancer
|
|
110
110
|
#http://developer.freelancer.com/UpdateProjectDetails
|
111
111
|
#
|
112
112
|
#<b>Required:</b>
|
113
|
-
|
113
|
+
# :projectid
|
114
114
|
#
|
115
115
|
#<b>Optional:</b>
|
116
|
-
|
117
|
-
|
116
|
+
# :projectdesc
|
117
|
+
# :jobtypecsv
|
118
118
|
def updateProjectDetails *args
|
119
119
|
options=fill_args [:projectid,:projectdesc,:jobtypecsv],[:projectid],*args
|
120
120
|
request "/Employer/updateProjectDetails.json", options
|
@@ -5,7 +5,7 @@ module Freelancer
|
|
5
5
|
#http://developer.freelancer.com/GetProjectListForPlacedBids
|
6
6
|
#
|
7
7
|
#<b>Required:</b>
|
8
|
-
|
8
|
+
# :status
|
9
9
|
# 1 - All
|
10
10
|
# 2 - Open And Frozen – Default
|
11
11
|
# 3 - Frozen Awaiting your action
|
@@ -15,10 +15,10 @@ module Freelancer
|
|
15
15
|
# 7 - Closed Canceled
|
16
16
|
#
|
17
17
|
#<b>Optional:</b>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# :userid => UserID of the Poster
|
19
|
+
# :projectid => Project ID filter
|
20
|
+
# :count => (Default: 50)
|
21
|
+
# :page => (Default: 0)
|
22
22
|
def getProjectListForPlacedBids
|
23
23
|
options=fill_args [:status,:userid,:projectid,:count,:page],[:status],*args
|
24
24
|
request "/Freelancer/getProjectListForPlacedBids.json", options
|
@@ -29,15 +29,15 @@ module Freelancer
|
|
29
29
|
#http://developer.freelancer.com/PlaceBidOnProject
|
30
30
|
#
|
31
31
|
#<b>Required:</b>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
# :amount => amount
|
33
|
+
# :days => days
|
34
|
+
# :description => description
|
35
|
+
# :projectid => project identifier
|
36
36
|
#
|
37
37
|
#<b>Optional:</b>
|
38
|
-
|
39
|
-
|
40
|
-
|
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
41
|
def placeBidOnProject *args
|
42
42
|
options=fill_args [
|
43
43
|
:amount,
|
@@ -61,7 +61,7 @@ module Freelancer
|
|
61
61
|
#http://developer.freelancer.com/RetractBidFromProject
|
62
62
|
#
|
63
63
|
#<b>Required:</b>
|
64
|
-
|
64
|
+
# :projectid => project identifier
|
65
65
|
def retractBidFromProject *args
|
66
66
|
options=fill_args [:projectid],[:projectid],*args
|
67
67
|
request "/Freelancer/retractBidFromProject.json", options
|
@@ -72,8 +72,8 @@ module Freelancer
|
|
72
72
|
#http://developer.freelancer.com/AcceptBidWon
|
73
73
|
#
|
74
74
|
#<b>Required:</b>
|
75
|
-
|
76
|
-
|
75
|
+
# :projectid => project identifier
|
76
|
+
# :state => 0 - decline , 1 - Accept (default)
|
77
77
|
def acceptBidWon *args
|
78
78
|
options=fill_args [:projectid,:state],[:projectid],*args
|
79
79
|
request "/Freelancer/acceptBidWon.json", options
|
data/lib/freelancer/message.rb
CHANGED
@@ -5,9 +5,9 @@ module Freelancer
|
|
5
5
|
#http://developer.freelancer.com/GetInboxMessages
|
6
6
|
#
|
7
7
|
#<b>Optional:</b>
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
# :projectid => Get the private messages for the specific project
|
9
|
+
# :count
|
10
|
+
# :page
|
11
11
|
def getInboxMessages *args
|
12
12
|
options=fill_args [:projectid,:count,:page],[],*args
|
13
13
|
request "/Message/getInboxMessages.json", options
|
@@ -18,8 +18,8 @@ module Freelancer
|
|
18
18
|
#http://developer.freelancer.com/GetSentMessages
|
19
19
|
#
|
20
20
|
#<b>Optional:</b>
|
21
|
-
|
22
|
-
|
21
|
+
# :count
|
22
|
+
# :page
|
23
23
|
def getSentMessages *args
|
24
24
|
options=fill_args [:count,:page],[],*args
|
25
25
|
request "/Message/getSentMessages.json", options
|
@@ -37,10 +37,10 @@ module Freelancer
|
|
37
37
|
#http://developer.freelancer.com/SendMessage
|
38
38
|
#
|
39
39
|
#<b>Required:</b>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
44
|
def sendMessage *args
|
45
45
|
options=fill_args [
|
46
46
|
:projectid,:messagetext,:userid,:username
|
@@ -61,7 +61,7 @@ module Freelancer
|
|
61
61
|
#http://developer.freelancer.com/MarkMessageAsRead
|
62
62
|
#
|
63
63
|
#<b>Required:</b>
|
64
|
-
|
64
|
+
# :id => Message Id to be marked as read
|
65
65
|
def markMessageAsRead *args
|
66
66
|
options=fill_args [:id],[:id],*args
|
67
67
|
request "/Message/markMessageAsRead.json", options
|
data/lib/freelancer/payment.rb
CHANGED
@@ -12,10 +12,10 @@ module Freelancer
|
|
12
12
|
#http://developer.freelancer.com/GetAccountTransactionList
|
13
13
|
#
|
14
14
|
#<b>Optional:</b>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
# :count => (Default: 50)
|
16
|
+
# :page => (Default: 0)
|
17
|
+
# :datefrom => Get transactions from the date
|
18
|
+
# :dateto => Get transactions up to the date
|
19
19
|
def getAccountTransactionList *args
|
20
20
|
options=fill_args [
|
21
21
|
:count,:page,:datefrom,:dateto
|
@@ -28,13 +28,13 @@ module Freelancer
|
|
28
28
|
#http://developer.freelancer.com/RequestWithdrawal
|
29
29
|
#
|
30
30
|
#<b>Required:</b>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
38
|
def requestWithdrawal *args
|
39
39
|
options=fill_args [
|
40
40
|
:amount,
|
@@ -61,12 +61,12 @@ module Freelancer
|
|
61
61
|
#http://developer.freelancer.com/CreateMilestonePayment
|
62
62
|
#
|
63
63
|
#<b>Required:</b>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
70
|
def createMilestonePayment *args
|
71
71
|
options=fill_args [
|
72
72
|
:projectid,
|
@@ -95,7 +95,7 @@ module Freelancer
|
|
95
95
|
#http://developer.freelancer.com/CancelMilestone
|
96
96
|
#
|
97
97
|
#<b>Required:</b>
|
98
|
-
|
98
|
+
# :transactionid => Transaction Id
|
99
99
|
def cancelMilestone *args
|
100
100
|
options=fill_args [:transactionid],[:transactionid],*args
|
101
101
|
request "/Payment/cancelMilestone.json", options
|
@@ -106,9 +106,9 @@ module Freelancer
|
|
106
106
|
#http://developer.freelancer.com/GetAccountMilestoneList
|
107
107
|
#
|
108
108
|
#<b>Optional:</b>
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
# :type => Incoming(default) or Outgoing
|
110
|
+
# :count => (Default: 50)
|
111
|
+
# :page => (Default: 0)
|
112
112
|
def getAccountMilestoneList *args
|
113
113
|
options=fill_args [:type,:count,:page],[],*args
|
114
114
|
request "/Payment/getAccountMilestoneList.json", options
|
@@ -119,9 +119,9 @@ module Freelancer
|
|
119
119
|
#http://developer.freelancer.com/GetAccountWithdrawalList
|
120
120
|
#
|
121
121
|
#<b>Optional:</b>
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
# :type => Incoming(default) or Outgoing
|
123
|
+
# :count => (Default: 50)
|
124
|
+
# :page => (Default: 0)
|
125
125
|
def getAccountWithdrawalList *args
|
126
126
|
options=fill_args [:type,:count,:page],[],*args
|
127
127
|
request "/Payment/getAccountMilestoneList.json", options
|
@@ -132,7 +132,7 @@ module Freelancer
|
|
132
132
|
#http://developer.freelancer.com/RequestReleaseMilestone
|
133
133
|
#
|
134
134
|
#<b>Required:</b>
|
135
|
-
|
135
|
+
# :transactionid => Transaction Id
|
136
136
|
def requestReleaseMilestone *args
|
137
137
|
options=fill_args [:transactionid],[:transactionid],*args
|
138
138
|
request "/Payment/requestReleaseMilestone.json", options
|
@@ -143,8 +143,8 @@ module Freelancer
|
|
143
143
|
#http://developer.freelancer.com/ReleaseMilestone
|
144
144
|
#
|
145
145
|
#<b>Required:</b>
|
146
|
-
|
147
|
-
|
146
|
+
# :transactionid => Transaction Id
|
147
|
+
# :fullname => Fullname of the payer
|
148
148
|
def releaseMilestone *args
|
149
149
|
options=fill_args [:transactionid,:fullname],[:transactionid,:fullname],*args
|
150
150
|
request "/Payment/releaseMilestone.json", options
|
data/lib/freelancer/profile.rb
CHANGED
@@ -12,7 +12,7 @@ module Freelancer
|
|
12
12
|
#http://developer.freelancer.com/GetProfileInfo
|
13
13
|
#
|
14
14
|
#<b>Required:</b>
|
15
|
-
|
15
|
+
# :userid => Retrieve the profile information of this user Id.
|
16
16
|
def getProfileInfo *args
|
17
17
|
options=fill_args [:userid],[:userid],*args
|
18
18
|
request "/Profile/getProfileInfo.json",options
|
@@ -23,30 +23,30 @@ module Freelancer
|
|
23
23
|
#http://developer.freelancer.com/SetProfileInfo
|
24
24
|
#
|
25
25
|
#<b>Optional:</b> (minimum one required)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
26
|
+
# :fullname
|
27
|
+
# :company_name
|
28
|
+
# :type_of_work
|
29
|
+
# :multipartpic
|
30
|
+
# :addressline1
|
31
|
+
# :addressline2
|
32
|
+
# :city
|
33
|
+
# :state
|
34
|
+
# :country
|
35
|
+
# :postalcode
|
36
|
+
# :phone
|
37
|
+
# :fax
|
38
|
+
# :notificationformat
|
39
|
+
# :emailnotificationstatus
|
40
|
+
# :receivenewsstatus
|
41
|
+
# :bidwonnotificationstatus
|
42
|
+
# :bidplacednotificationstatus
|
43
|
+
# :newprivatemessagestatus
|
44
|
+
# :qualificationcsv
|
45
|
+
# :profiletext
|
46
|
+
# :vision
|
47
|
+
# :keywords
|
48
|
+
# :hourlyrate
|
49
|
+
# :skills
|
50
50
|
def setProfileInfo *args
|
51
51
|
options=fill_args [
|
52
52
|
:fullname,
|
data/lib/freelancer/project.rb
CHANGED
@@ -5,21 +5,21 @@ module Freelancer
|
|
5
5
|
#http://developer.freelancer.com/SearchProjects
|
6
6
|
#
|
7
7
|
#<b>Optional:</b>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
# :isfeatured => boolean
|
9
|
+
# :isnonpublic => boolean
|
10
|
+
# :searchkeyword => string
|
11
|
+
# :searchjobtypecsv => coma separated job types [ PHP, .NET ]
|
12
|
+
# :status => string [ Open | Frozen | Closed| ClosedAwarded| ClosedCanceled ]
|
13
|
+
# :budgetmin => integer or String [ 250 | 750 |1500 |3000 | Any ]
|
14
|
+
# :budgetmax => integer
|
15
|
+
# :isfulltime => boolean
|
16
|
+
# :istrial => boolean
|
17
|
+
# :isgoldmembersonly => boolean
|
18
|
+
# :bidendsduration => string [ submitdate (default) | bid_enddate | id | state ]
|
19
|
+
# :count => number
|
20
|
+
# :page => number
|
21
|
+
# :tags => string
|
22
|
+
# :sort => string
|
23
23
|
def searchProjects *args
|
24
24
|
options=fill_args [
|
25
25
|
:isfeatured,
|
@@ -54,7 +54,7 @@ module Freelancer
|
|
54
54
|
#http://developer.freelancer.com/GetProjectDetails
|
55
55
|
#
|
56
56
|
#<b>Required:</b>
|
57
|
-
|
57
|
+
# :projectid => project id
|
58
58
|
def getProjectDetails *args
|
59
59
|
options = fill_args [:projectid],[:projectid],*args
|
60
60
|
request "/Project/getProjectDetails.json", options
|
@@ -65,7 +65,7 @@ module Freelancer
|
|
65
65
|
#http://developer.freelancer.com/GetBidsDetails
|
66
66
|
#
|
67
67
|
#<b>Required:</b>
|
68
|
-
|
68
|
+
# :projectid => project id
|
69
69
|
def getBidsDetails *args
|
70
70
|
options = fill_args [:projectid],[:projectid],*args
|
71
71
|
request "/Project/getBidsDetails.json",options
|
@@ -76,7 +76,7 @@ module Freelancer
|
|
76
76
|
#http://developer.freelancer.com/GetPublicMessages
|
77
77
|
#
|
78
78
|
#<b>Required:</b>
|
79
|
-
|
79
|
+
# :projectid => project id
|
80
80
|
def getPublicMessages *args
|
81
81
|
options = fill_args [:projectid],[:projectid],*args
|
82
82
|
request "/Project/getPublicMessages.json",options
|
@@ -87,8 +87,8 @@ module Freelancer
|
|
87
87
|
#http://developer.freelancer.com/PostPublicMessage
|
88
88
|
#
|
89
89
|
#<b>Required:</b>
|
90
|
-
|
91
|
-
|
90
|
+
# :projectid => Project Id associated with the message
|
91
|
+
# :messagetext => message text
|
92
92
|
def postPublicMessage *args
|
93
93
|
options = fill_args [:projectid,:messagetext],[:projectid,:messagetext],*args
|
94
94
|
request "/Project/postPublicMessage.json",options
|
data/lib/freelancer/user.rb
CHANGED
@@ -5,12 +5,12 @@ module Freelancer
|
|
5
5
|
#http://developer.freelancer.com/GetUsersBySearch
|
6
6
|
#
|
7
7
|
#<b>Optional:</b>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
# :username => Username of the person for who you are searching.
|
9
|
+
# :expertise_csv => Comma separated list of job categories, refer to the main page for a list of categories.
|
10
|
+
# :country_csv => Comma separated list of countries
|
11
|
+
# :rating => Minimum rating for the user
|
12
|
+
# :count => (default: 50)
|
13
|
+
# :page => (default: 0)
|
14
14
|
def getUsersBySearch *args
|
15
15
|
options=fill_args [
|
16
16
|
:username,
|
@@ -28,11 +28,11 @@ module Freelancer
|
|
28
28
|
#http://developer.freelancer.com/GetUserFeedback
|
29
29
|
#
|
30
30
|
#<b>Required:</b>
|
31
|
-
|
32
|
-
|
31
|
+
# :username => Username or userid is required
|
32
|
+
# :userid => Username or userid is required
|
33
33
|
#
|
34
34
|
#<b>Optional:</b>
|
35
|
-
|
35
|
+
# :type => [P = Provider Only, B = Buyer Only, A = Default, All]
|
36
36
|
def getUsersFeedback *args
|
37
37
|
options=fill_args [:username,:userid,:type],[],*args
|
38
38
|
if options[:username]==nil && options[:userid]==nil
|
@@ -49,8 +49,8 @@ module Freelancer
|
|
49
49
|
#http://developer.freelancer.com/GetUserDetails
|
50
50
|
#
|
51
51
|
#<b>Required:</b>
|
52
|
-
|
53
|
-
|
52
|
+
# :username => Username or userid is required
|
53
|
+
# :userid => Username or userid is required
|
54
54
|
def getUserDetails *args
|
55
55
|
options=fill_args [:username,:userid],[],*args
|
56
56
|
if options[:username]==nil && options[:userid]==nil
|
data/lib/freelancer/widget.rb
CHANGED
@@ -4,6 +4,7 @@ require 'cgi'
|
|
4
4
|
|
5
5
|
module Freelancer
|
6
6
|
module Widget
|
7
|
+
protected
|
7
8
|
def request_widget path, parameters={}
|
8
9
|
params=parameters.map do |k,v|
|
9
10
|
if v.is_a?(TrueClass) || v.is_a?(FalseClass)
|
@@ -14,46 +15,46 @@ module Freelancer
|
|
14
15
|
"#{CGI.escape(k.to_s)}[]=#{CGI.escape(item.to_s)}"
|
15
16
|
end.join("&")
|
16
17
|
else
|
17
|
-
puts v
|
18
18
|
"#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"
|
19
19
|
end
|
20
20
|
end.join("&")
|
21
21
|
url=api_url+path
|
22
22
|
url+="?#{params}" if params.length > 0
|
23
23
|
uri=URI.parse(url)
|
24
|
-
|
25
|
-
|
26
|
-
# puts response.body
|
24
|
+
result=Net::HTTP.get_response(uri)
|
25
|
+
JSON.parse(result.body)
|
27
26
|
end
|
28
27
|
|
28
|
+
public
|
29
|
+
|
29
30
|
#= Search projects
|
30
31
|
#
|
31
32
|
#http://www.freelancer.com/affiliate-api.html#ProjectSearch
|
32
33
|
#
|
33
34
|
#== Optional
|
34
|
-
|
35
|
+
# :keyword
|
35
36
|
# Search keyword
|
36
|
-
|
37
|
+
# :owner
|
37
38
|
# Username of ID of project owner
|
38
|
-
|
39
|
+
# :winner
|
39
40
|
# Username of ID of project winner
|
40
|
-
|
41
|
+
# :jobs[]
|
41
42
|
# Names of job categories from the available list on Freelancer.com (PHP, .NET, AJAX, etc.). This parameter may be repeated more than once
|
42
|
-
|
43
|
+
# :featured
|
43
44
|
# If 1 - only featured projects, if 0 - only NON-featured projects
|
44
|
-
|
45
|
+
# :trial
|
45
46
|
# If 1 - only trial projects, if 0 - only NON-trial projects
|
46
|
-
|
47
|
+
# :for_gold_members
|
47
48
|
# If 1 - only "For gold members" projects, if 0 - only NON "For gold members" projects
|
48
|
-
|
49
|
+
# :nonpublic
|
49
50
|
# If 1 - only nonpublic projects, if 0 - only public projects
|
50
|
-
|
51
|
+
# :min_budget
|
51
52
|
# Only projects with budget higher or equal to min_budget
|
52
|
-
|
53
|
+
# :max_budget
|
53
54
|
# Only projects with budget lower or equal to max_budget
|
54
|
-
|
55
|
+
# :bidding_ends
|
55
56
|
# Only projects ending sooner than bidding_ends days
|
56
|
-
|
57
|
+
# :order
|
57
58
|
# How to order projects in the result output. See available project order criteria.
|
58
59
|
# types:
|
59
60
|
# :id - order by project ID
|
@@ -66,13 +67,13 @@ module Freelancer
|
|
66
67
|
# :budget - order by budget
|
67
68
|
# :relevance - order by relevance of search by keyword. This criterion should be used with the parameter keyword
|
68
69
|
# :rand - order randomly
|
69
|
-
|
70
|
+
# :order_dir
|
70
71
|
# Direction of sorting. If the parameter is equal to asc, results are ordered in ascending way, otherwise - descending (desc).
|
71
|
-
|
72
|
+
# :pg
|
72
73
|
# Page number. Starts from 0. Default page is 0
|
73
|
-
|
74
|
+
# :count
|
74
75
|
# Number of items on a page
|
75
|
-
|
76
|
+
# :apikey
|
76
77
|
# API key, paramater is optional.
|
77
78
|
def search *args
|
78
79
|
options=fill_args [
|
@@ -102,27 +103,27 @@ module Freelancer
|
|
102
103
|
#http://www.freelancer.com/affiliate-api.html#ProjectProperties
|
103
104
|
#
|
104
105
|
#== Required
|
105
|
-
|
106
|
+
# :id
|
106
107
|
# the project id
|
107
108
|
#
|
108
109
|
#== Optional
|
109
|
-
|
110
|
+
# :apikey
|
110
111
|
# API key, paramater is optional.
|
111
112
|
def projectDetails *args
|
112
113
|
options=fill_args [:id,:apikey],[:id],*args
|
113
114
|
request_widget("/Project/Properties.json",options)
|
114
115
|
end
|
115
116
|
|
116
|
-
|
117
|
+
#=Get the project details
|
117
118
|
#
|
118
119
|
#http://www.freelancer.com/affiliate-api.html#UserProperties
|
119
120
|
#
|
120
121
|
#== Required
|
121
|
-
|
122
|
+
# :id
|
122
123
|
# the user id
|
123
124
|
#
|
124
125
|
#== Optional
|
125
|
-
|
126
|
+
# :apikey
|
126
127
|
# API key
|
127
128
|
def userDetails *args
|
128
129
|
options=fill_args [:id,:apikey],[:id],*args
|
@@ -134,28 +135,28 @@ module Freelancer
|
|
134
135
|
#http://www.freelancer.com/affiliate-api.html#FeedbackSearch
|
135
136
|
#
|
136
137
|
#== Required
|
137
|
-
|
138
|
+
# :user
|
138
139
|
# ID or username of a feedback receiver
|
139
140
|
#
|
140
141
|
#== Optional
|
141
|
-
|
142
|
+
# :project_id
|
142
143
|
# ID of project for which the feedback was made
|
143
|
-
|
144
|
+
# :type
|
144
145
|
# Type of the feedback. S - service provider's (seller's) feedbacks, B - buyer's feedbacks. By default provider's feedbacks are returned
|
145
|
-
|
146
|
+
# :positive
|
146
147
|
# if positive equals to 1, only feedbacks with rating higher than average will be returned
|
147
|
-
|
148
|
+
# :order
|
148
149
|
# How to order feedbacks in result output. Types:
|
149
150
|
# :active_date - order by date when feedback was activated (default)
|
150
151
|
# :rand - order randomly
|
151
152
|
#
|
152
|
-
|
153
|
+
# :order_dir
|
153
154
|
# Direction of sorting. If the parameter is equal to asc, results are ordered in ascending way, otherwise - descending ('desc').
|
154
|
-
|
155
|
+
# :pg
|
155
156
|
# Page number. Starts from 0. Default page is 0
|
156
|
-
|
157
|
+
# :count
|
157
158
|
# Number of items on a page
|
158
|
-
|
159
|
+
# :apikey
|
159
160
|
# API key
|
160
161
|
def feedbackSearch
|
161
162
|
options=fill_args [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freelancer4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Janos Haber
|
@@ -50,22 +50,6 @@ dependencies:
|
|
50
50
|
version: 0.4.1
|
51
51
|
type: :runtime
|
52
52
|
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: mechanize
|
55
|
-
prerelease: false
|
56
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
hash: 23
|
62
|
-
segments:
|
63
|
-
- 1
|
64
|
-
- 0
|
65
|
-
- 0
|
66
|
-
version: 1.0.0
|
67
|
-
type: :runtime
|
68
|
-
version_requirements: *id003
|
69
53
|
description: Freelancer API for ruby. More informaito about freelancer api see http://developer.freelancer.com
|
70
54
|
email: freelancer4r@googlegroups.com
|
71
55
|
executables: []
|