Sha256: c2986d96fa30ea22d27bf1ece83b14c1dc48c06b2740c7f9937fbc7275cb2f58

Contents?: true

Size: 785 Bytes

Versions: 5

Compression:

Stored size: 785 Bytes

Contents

module FbGraph
  class Project < Page
    attr_accessor :with, :start_date, :end_date

    def initialize(identifier, attributes = {})
      super
      @with = []
      if attributes[:with]
        attributes[:with].each do |user|
          @with << User.new(user.delete(:id), user)
        end
      end
      if attributes[:start_date]
        year, month = attributes[:start_date].split('-').collect(&:to_i)
        @start_date = if month == 0
          Date.new(year)
        else
          Date.new(year, month)
        end
      end
      if attributes[:end_date]
        year, month = attributes[:end_date].split('-').collect(&:to_i)
        @end_date = if month == 0
          Date.new(year)
        else
          Date.new(year, month)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fb_graph-1.3.1 lib/fb_graph/project.rb
fb_graph-1.3.0 lib/fb_graph/project.rb
fb_graph-1.2.5 lib/fb_graph/project.rb
fb_graph-1.2.4 lib/fb_graph/project.rb
fb_graph-1.2.3 lib/fb_graph/project.rb