class Peaty::Story

Public Class Methods

collection_path(options = {}) click to toggle source
# File lib/peaty/story.rb, line 47
def collection_path(options = {})
  "/projects/%i/stories" % options[:project_id].to_i
end
element() click to toggle source
# File lib/peaty/story.rb, line 44
def element
  "story"
end
member_path(id, options = {}) click to toggle source
# File lib/peaty/story.rb, line 50
def member_path(id, options = {})
  "/projects/%i/stories/%i" % [options[:project_id].to_i, id]
end
move_path(id, options = {}) click to toggle source
# File lib/peaty/story.rb, line 53
def move_path(id, options = {})
  "/projects/%i/stories/%i/moves?move[move]=%s&move[target]=%i" % [options[:project_id].to_i, id, options[:type], options[:target_id].to_i]
end
releases(options = {}) click to toggle source

Filters

# File lib/peaty/story.rb, line 59
def releases(options = {})
  self.filter(:type => :release)
end

Public Instance Methods

estimate() click to toggle source

chores, bugs, releases may or may not have estimates

# File lib/peaty/story.rb, line 11
def estimate
  self.attributes["estimate"].to_i
end
move(options) click to toggle source

Moves a story before or after another story

story1.move(:before => story2)
story2.move(:after => story1)
# File lib/peaty/story.rb, line 23
def move(options)
  @error = nil

  move_options = { :project_id => project_id }
  if options[:before]
    move_options.merge!({ :type => :before, :target_id => options[:before].id })
  elsif options[:after]
    move_options.merge!({ :type => :after, :target_id => options[:after].id })
  else
    raise ArgumentError, "Must specify :before => story or :after => story"
  end

  self.connection[self.class.move_path(id, move_options)].post("").body

  self
rescue RestClient::UnprocessableEntity => e
  @error = JSON.parse(XmlToJson.transform(e.response.body))["message"]
  false
end
project() click to toggle source
# File lib/peaty/story.rb, line 15
def project
  Project.with_connection(self.class.connection).find(self.project_id)
end
story_type() click to toggle source
# File lib/peaty/story.rb, line 5
def story_type
  self.attributes["story_type"].to_sym if story_type?
end
Also aliased as: type
type()
Alias for: story_type