Class: Diggr::Story

Inherits:
Object
  • Object
show all
Defined in:
lib/diggr/response_classes/story.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#commentsObject

Returns the value of attribute comments.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def comments
  @comments
end

#containerObject

Returns the value of attribute container.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def container
  @container
end

#descriptionObject

Returns the value of attribute description.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def description
  @description
end

#diggsObject

Returns the value of attribute diggs.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def diggs
  @diggs
end

#hrefObject

Returns the value of attribute href.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def href
  @href
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def id
  @id
end

Returns the value of attribute link.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def link
  @link
end

#mediaObject

Returns the value of attribute media.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def media
  @media
end

#shorturlObject

Returns the value of attribute shorturl.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def shorturl
  @shorturl
end

#statusObject

Returns the value of attribute status.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def status
  @status
end

#submit_dateObject

Returns the value of attribute submit_date.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def submit_date
  @submit_date
end

#thumbnailObject

Returns the value of attribute thumbnail.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def thumbnail
  @thumbnail
end

#titleObject

Returns the value of attribute title.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def title
  @title
end

#topicObject

Returns the value of attribute topic.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def topic
  @topic
end

#userObject

Returns the value of attribute user.



11
12
13
# File 'lib/diggr/response_classes/story.rb', line 11

def user
  @user
end

Class Method Details

.new_from_parsed_json(data) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/diggr/response_classes/story.rb', line 14

def self.new_from_parsed_json(data)
  story = Story.new
  
  %w(id link submit_date diggs comments title description status media href).each do |attribute|
    story.send("#{attribute}=",data[attribute]) if data[attribute]
  end

  story.user = Diggr::User.new_from_parsed_json(data['user']) if data['user']
  story.topic = Diggr::Topic.new_from_parsed_json(data['topic']) if data['topic']
  story.container = Diggr::Container.new_from_parsed_json(data['container']) if data['container']
  story.thumbnail = Diggr::Photo.new_from_parsed_json(data['thumbnail']) if data['thumbnail']
  story.shorturl = Diggr::ShortUrl.new_from_parsed_json(data['shorturl'][0]) if data['shorturl']

  story
end