class Clubhouse::Story

Public Class Methods

all() click to toggle source
# File lib/clubhouse/story.rb, line 52
def all
  raise NotSupportedByAPIError,
    'Use Story.search(..) to return stories matching your search query'
end

Public Instance Methods

add_comment(text) click to toggle source
# File lib/clubhouse/story.rb, line 28
def add_comment(text)
  add_resource(:comment) do
    comment = Comment.new(text: text, story_id: id)
    comment.save
    comments << comment
  end
end
add_task(desc) click to toggle source
# File lib/clubhouse/story.rb, line 36
def add_task(desc)
  add_resource(:task) do
    task = Task.new(description: desc, story_id: id)
    task.save
    tasks << task
  end
end
comments() click to toggle source
# File lib/clubhouse/story.rb, line 20
def comments
  @_comments ||= Array(@comments).collect {|c| Comment.new.update_object_from_payload(c) }
end
tasks() click to toggle source
# File lib/clubhouse/story.rb, line 24
def tasks
  @_tasks ||= Array(@tasks).collect {|t| Task.new.update_object_from_payload(t) }
end
update_object_from_payload(attr = {}) click to toggle source
# File lib/clubhouse/story.rb, line 44
def update_object_from_payload(attr = {})
  super
  instance_variable_set("@_comments", nil)
  instance_variable_set("@_tasks", nil)
  self
end

Private Instance Methods

add_resource(type) { || ... } click to toggle source
# File lib/clubhouse/story.rb, line 65
def add_resource(type)
  raise StoryNotSavedError, "Please save the story to use the add #{type} method" unless id
  yield
end