Sha256: c164614fbaedda8451f01cf9983ad83bbfcbf678652f2e4216a8be275a0ce413

Contents?: true

Size: 1.33 KB

Versions: 18

Compression:

Stored size: 1.33 KB

Contents

module PivotalTracker
  class Activity
    include HappyMapper
    class << self
      def all(project=nil, options={})
        params = self.encode_options(options)
        if project
          parse(Client.connection["/projects/#{project.id}/activities#{params}"].get)
        else
          parse(Client.connection["/activities#{params}"].get)
        end
      end

      protected

        def encode_options(options)
          return nil if !options.is_a?(Hash) || options.empty?

          options_string = []
          options_string << "limit=#{options.delete(:limit)}" if options[:limit]
          options_string << "newer_than_version=#{options.delete(:newer_than_version)}" if options[:newer_than_version]

          if options[:occurred_since]
            options_string << "occurred_since_date=\"#{options[:occurred_since].utc}\""
          elsif options[:occurred_since_date]
            options_string << "occurred_since_date=#{URI.escape options[:occurred_since_date].strftime("%Y/%m/%d %H:%M:%S %Z")}"
          end

          return "?#{options_string.join('&')}"
        end

    end

    element :id, Integer
    element :version, Integer
    element :event_type, String
    element :occurred_at, DateTime
    element :author, String
    element :project_id, Integer
    element :description, String

    has_many :stories, Story

  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
pivotal-tracker-0.5.13 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.12 lib/pivotal-tracker/activity.rb
pivotal-tracker-fox-0.5.13 lib/pivotal-tracker/activity.rb
pivotal-tracker-fox-0.5.12 lib/pivotal-tracker/activity.rb
pivotal-tracker-fox-0.5.11 lib/pivotal-tracker/activity.rb
pivotal-tracker-fox-0.5.10 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.10 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.9 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.8 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.7 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.6 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.5 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.4 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.3 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.1 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.5.0 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.4.1 lib/pivotal-tracker/activity.rb
pivotal-tracker-0.4.0 lib/pivotal-tracker/activity.rb