Sha256: 3bba56d6c54f94eb7f0ff05c136117315a676d5d4b93695b96135b25f9a47263

Contents?: true

Size: 898 Bytes

Versions: 69

Compression:

Stored size: 898 Bytes

Contents

module FbGraph
  module OpenGraph
    class Object < Node
      attr_accessor :type, :application, :url, :title, :description, :images, :image, :site_name, :updated_time
      attr_accessor :raw_attributes

      def initialize(identifier, attributes = {})
        super
        @raw_attributes = attributes
        [:type, :url, :title, :description, :site_name].each do |key|
          self.send "#{key}=", attributes[key]
        end
        if application = attributes[:application]
          @application = Application.new(application[:id], application)
        end
        @images = []
        if attributes[:image]
          attributes[:image].each do |image|
            @images << image[:url]
          end
        end
        @image = @images.first
        if attributes[:updated_time]
          @updated_time = Time.parse attributes[:updated_time]
        end
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
fb_graph-2.2.5 lib/fb_graph/open_graph/object.rb
fb_graph-2.2.4 lib/fb_graph/open_graph/object.rb
fb_graph-2.2.3 lib/fb_graph/open_graph/object.rb
fb_graph-2.2.2 lib/fb_graph/open_graph/object.rb
fb_graph-2.2.1 lib/fb_graph/open_graph/object.rb
fb_graph-2.2.0 lib/fb_graph/open_graph/object.rb
fb_graph-2.2.0.beta lib/fb_graph/open_graph/object.rb
fb_graph-2.2.0.alpha2 lib/fb_graph/open_graph/object.rb
fb_graph-2.2.0.alpha lib/fb_graph/open_graph/object.rb