Comments (7)
It seems from the documentation that most people actually get the desired string output or a hash or something, I'm not clear why I am getting this object instead?
from linkedin.
The documentation on this API could definitely be improved.
I basically dumped out the profile structure to learn what was returned.
Then I was able to access certain fields. For example:
profile = client.profile(:fields => [:id, :first_name, :last_name, :summary, :educations, :positions, :picture_url, :headline, :location, :site_standard_profile_request])
logger.debug(profile.inspect)
first_name = ''
if profile.respond_to?('first_name ')
first_name = profile.first_name
end
if profile.respond_to?('educations')
educations = profile.educations
logger.debug(educations.inspect)
educations.each do |e|
school_name = e.school_name
major = e.field_of_study
degree_name = e.degree
year = e.end_year
end
end
The fields in the profile structure are documented here:
http://developer.linkedin.com/docs/DOC-1002 (See "Sample Return XML")
from linkedin.
Hey Guys,
There is no doubt that docs could be improved. As the master branch is under development I would recommend checkout out the 2-0-stable branch. Pull requests happily accepted :)
As for the object returned, this is the Profile object which maps methods to the underlying xml doc, similar to how the rest of the gem works. The master branch will bring is a new way of interacting with the API, once I find some time I will get working on it and hope to finish it soon.
I'm closing this issue as it more seems to be an issue around docs then functionality.
Thanks,
Josh
from linkedin.
What is the right way then....I moved to the master branch, but it sounds like we need to go back to the older one....can someone explain how to actually access speific fields...I'm starting to get it from the examle above, thanks....
from linkedin.
Hi, jumpshot thanks for the example...I think I get it....is there a way to directly access the XML doc in the Profile Object or whatever object and then pass that to something that converts XML to Hash to be able to access it more directly?
from linkedin.
extending the question:
I tried this, but didn't work out, got undefined method empty?' for #<LinkedIn::Profile:0x000001043d6a08>
action:
@profile = client.profile;
@doc = Nokogiri::XML(@profile);
view
<%= debug @doc %>
#tried Nokogiri::XML.parse(@profile) in action, but that returns LinkedIn profile is not a string
from linkedin.
Instead of responding with pure XML this gem returns Mash results which are easier to work with.
from linkedin.
Related Issues (20)
- Segmentation fault when used in parallel threads HOT 8
- Linkedin Group Share HOT 2
- Normal Pagination
- LinkedIn API changes HOT 1
- Documentation Links No Longer Work HOT 5
- token_secret is not passed HOT 2
- LinkedIn API returns Positions without Title HOT 6
- Does the API has stopped providing Connections HOT 3
- (400): 'submitted-url' and 'media-key' can not be both empty HOT 6
- LinkedIn API session issue HOT 1
- List of all companies where authenticated user is the Admin HOT 1
- Setting the linkedin pin at the run time HOT 1
- Unable to find client.profile for authenticated user HOT 3
- NameError: uninitialized constant Api::QueryHelpers HOT 1
- Is this gem still maintained? HOT 1
- Application does not respond after sharing content to company page HOT 1
- UnauthorizedError in callback HOT 2
- problems with the access token HOT 2
- LinkedIn v1 API deprecation HOT 11
- Incorrect tag for v1.1.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linkedin.