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

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

Instance Method Summary collapse

Instance Method Details

#account_detailsObject

Retrieve profile information for the current user



7
8
9
10
11
12
# File 'lib/freelancer/api/profile.rb', line 7

def 

  result = api_get("/Profile/getAccountDetails.json")
  ::Freelancer::Models::User.parse(result, :shift => :"json-result")
  
end

#profile_info(*args) ⇒ Object

Retrieve profile information about a specific user

Valid parameters are:

- user_id: the user id to retrieve profile for


58
59
60
61
62
63
64
65
# File 'lib/freelancer/api/profile.rb', line 58

def profile_info(*args)

  params = extract_params(args)

  result = api_get("/Profile/getProfileInfo.json", { :userid => params[:user_id] })
  ::Freelancer::Models::User.parse(result, :shift => :"json-result")

end

#update_account_details(account) ⇒ Object

Update one or more attributes for the current user. This method takes a User object, and this should in most cases have been populated by the account_details method before passed to the update_account_details method to ensure that no data gets lost.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/freelancer/api/profile.rb', line 18

def ()

  # Prepare a map of update parameters
  params = {}
  params[:fullname] = .name
  params[:company_name] = .company
  params[:type_of_work] = .type_of_work
  params[:addressline1] = .address.street_name
  params[:addressline2] = .address.street_name_2
  params[:city] = .address.city
  params[:state] = .address.state
  params[:country] = .address.country
  params[:postalcode] = .address.postal_code
  params[:phone] = .phone_number
  params[:fax] = .fax_number
  params[:notificationformat] = .notifications.notification_format
  params[:emailnotificationstatus] = .notifications.email
  params[:receivenewsstatus] = .notifications.news
  params[:bidwonnotificationstatus] = .notifications.bid_won
  params[:bidplacednotificationstatus] = .notifications.bid_placed
  params[:newprivatemessagestatus] = .notifications.new_private_message
  params[:qualificationcsv] = .qualifications.join(",")
  params[:profiletext] = .profile_text
  params[:vision] = .vision
  params[:keywords] = .keywords
  params[:hourlyrate] = .hourly_rate
  params[:skills] = .skills.join("\n")

  # Execute the service call
  result = api_get("/Profile/setProfileInfo.json", params)

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

end