Sha256: 2030c6d8df1277834f156ba2fa1e13bc8cbc347edc2ec9c307cb8f0e6d70f97c

Contents?: true

Size: 705 Bytes

Versions: 7

Compression:

Stored size: 705 Bytes

Contents

module LinkedIn

  class Recommendations < LinkedIn::Base

    def recommendations
      @recommendations ||= @doc.children.inject([]) do |list, recommendation|
        list << Recommendation.new(recommendation) unless recommendation.blank?
        list
      end
    end

    class Recommendation
      def initialize(recommendation)
        @recommendation = recommendation
      end

      %w[id recommendation_type recommendation_text].each do |f|
        define_method(f.to_sym) do
          @recommendation.xpath("./#{f.gsub(/_/,'-')}").text
        end
      end

      def recommender
        @recommender ||= ShortProfile.new(@recommendation.xpath('./recommender'))
      end
    end

  end

end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
linkedin-bdigital-0.2.2.3 lib/linked_in/recommendations.rb
cl_linkedin-0.2.3 lib/linked_in/recommendations.rb
linkedin-bdigital-0.2.2.2 lib/linked_in/recommendations.rb
linkedin-bdigital-0.2.2.1 lib/linked_in/recommendations.rb
linkedin-bdigital-0.2.2 lib/linked_in/recommendations.rb
linkedin-0.2.2 lib/linked_in/recommendations.rb
linkedin-0.2.1 lib/linked_in/recommendations.rb