Class: FMyLife::Story

Inherits:
XMLStruct show all
Defined in:
lib/fmylife.rb

Overview

Story

Encapsulates a story on fmylife.com. These are primary used for reading stories off the site, but it can be used to submit stories as well. An example:

fml = FMyLife.new("apikeyhere")
story = FMyLife::Story.new(:author => "Anonymous", 
                            :category => :love,
                            :text => "blah blah blah. FML")
fml.submit(story)

To read one, simple use it’s variables:

story = fml.latest.first
author = story.author
text = story.text

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from XMLStruct

field, #parse_xml, #post_initialize

Methods included from CanParse

#xml_attribute, #xml_content, #xml_doc, #xpath

Constructor Details

#initialize(opts = {}) ⇒ Story

Initialize a new story. Available options are:

:author

The name of the author

:category

The category (must be from FMyLife::AVAILABLE_CATEGORIES)

:text

The text of the submissions



429
# File 'lib/fmylife.rb', line 429

def initialize(opts = {}); super(opts); end

Instance Attribute Details

#commentsObject

Returns the value of attribute comments.



412
413
414
# File 'lib/fmylife.rb', line 412

def comments
  @comments
end