Git Product home page Git Product logo

Comments (7)

angelacode avatar angelacode commented on September 2, 2024

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.

chris-sun avatar chris-sun commented on September 2, 2024

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.

joshk avatar joshk commented on September 2, 2024

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.

angelacode avatar angelacode commented on September 2, 2024

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.

angelacode avatar angelacode commented on September 2, 2024

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.

devsatish avatar devsatish commented on September 2, 2024

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.

hexgnu avatar hexgnu commented on September 2, 2024

Instead of responding with pure XML this gem returns Mash results which are easier to work with.

from linkedin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.