Sha256: 8157d7dea46b1fd4430c6559022493c3275d4479f09d72d8defe3ab64eeb8b14

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

module PivotalTracker
  class Project
    include HappyMapper

    class << self
      def all
        @found = parse(Client.connection['/projects'].get)
      end

      def find(id)
        if @found
          @found.detect { |document| document.id == id }
        else
          parse(Client.connection["/projects/#{id}"].get)
        end
      end
    end

    element :id, Integer
    element :name, String
    element :account, String
    element :week_start_day, String
    element :point_scale, String
    element :week_start_day, String
    element :velocity_scheme, String
    element :iteration_length, Integer
    element :initial_velocity, Integer
    element :current_velocity, Integer
    element :last_activity_at, DateTime
    element :use_https, Boolean

    def activities
      @activities ||= Proxy.new(self, Activity)
    end

    def iterations
      @iterations ||= Proxy.new(self, Iteration)
    end

    def stories
      @stories ||= Proxy.new(self, Story)
    end

    def memberships
      @memberships ||= Proxy.new(self, Membership)
    end

    def iteration(group)
      case group.to_sym
      when :done then Iteration.done(self)
      when :current then Iteration.current(self)
      when :backlog then Iteration.backlog(self)
      else
        raise ArgumentError, "Invalid group. Use :done, :current or :backlog instead."
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
pivotal-tracker-0.4.1 lib/pivotal-tracker/project.rb
pivotal-tracker-0.4.0 lib/pivotal-tracker/project.rb
tsenart-pivotal-tracker-0.5.0 lib/pivotal-tracker/project.rb
tsenart-pivotal-tracker-0.4.0 lib/pivotal-tracker/project.rb
topprospect-pivotal-tracker-0.1.1 lib/pivotal-tracker/project.rb
topprospect-pivotal-tracker-0.0.1 lib/pivotal-tracker/project.rb
pivotal-tracker-0.3.1 lib/pivotal-tracker/project.rb
pivotal-tracker-0.3.0 lib/pivotal-tracker/project.rb
pivotal-tracker-0.2.2 lib/pivotal-tracker/project.rb