Module: Freelancer::API::Profile::InstanceMethods
- Defined in:
- lib/freelancer/api/profile.rb
Instance Method Summary collapse
-
#account_details ⇒ Object
Retrieve profile information for the current user.
-
#profile_info(*args) ⇒ Object
Retrieve profile information about a specific user.
-
#update_account_details(account) ⇒ Object
Update one or more attributes for the current user.
Instance Method Details
#account_details ⇒ Object
Retrieve profile information for the current user
7 8 9 10 11 12 |
# File 'lib/freelancer/api/profile.rb', line 7 def account_details 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 update_account_details(account) # Prepare a map of update parameters params = {} params[:fullname] = account.name params[:company_name] = account.company params[:type_of_work] = account.type_of_work params[:addressline1] = account.address.street_name params[:addressline2] = account.address.street_name_2 params[:city] = account.address.city params[:state] = account.address.state params[:country] = account.address.country params[:postalcode] = account.address.postal_code params[:phone] = account.phone_number params[:fax] = account.fax_number params[:notificationformat] = account.notifications.notification_format params[:emailnotificationstatus] = account.notifications.email params[:receivenewsstatus] = account.notifications.news params[:bidwonnotificationstatus] = account.notifications.bid_won params[:bidplacednotificationstatus] = account.notifications.bid_placed params[:newprivatemessagestatus] = account.notifications. params[:qualificationcsv] = account.qualifications.join(",") params[:profiletext] = account.profile_text params[:vision] = account.vision params[:keywords] = account.keywords params[:hourlyrate] = account.hourly_rate params[:skills] = account.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 |