class SlideshareApi::Model::Slideshow

Attributes

comment_count[RW]
created_at[RW]
description[RW]
download_count[RW]
embed[RW]
favorite_count[RW]
format[RW]
id[RW]
is_downloadable[RW]
is_embaddable[RW]
is_in_contest[RW]
is_not_flagged[RW]
is_private[RW]
is_visible[RW]
is_visible_by_contacts[RW]
language[RW]
original_slideshow_xml[RW]
ppt_location[RW]
slide_count[RW]
status[RW]
stripped_title[RW]
tags[RW]
thumbnail_large_url[RW]
thumbnail_medium_url[RW]
thumbnail_size[RW]
thumbnail_small_url[RW]
thumbnail_url[RW]
title[RW]
type[RW]
updated_at[RW]
url[RW]
url_is_secret[RW]
user_id[RW]
username[RW]
view_count[RW]

Public Class Methods

new(slideshow_xml = nil) click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 19
def initialize(slideshow_xml = nil)
  @original_slideshow_xml = slideshow_xml
  setup_attributes_from_xml if @original_slideshow_xml
end

Public Instance Methods

==(other) click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 24
def ==(other)
  other.class == self.class && other.state == self.state
end

Protected Instance Methods

state() click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 30
def state
  self.instance_variables.reject { |item| item == :@original_slideshow_xml }.map { |variable| self.instance_variable_get variable }
end

Private Instance Methods

boolean_from_xml(attribute_name) click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 84
def boolean_from_xml(attribute_name)
  node = @original_slideshow_xml.search(attribute_name)
  node.first.content == '1' unless node.empty?
end
integer_from_xml(attribute_name) click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 89
def integer_from_xml(attribute_name)
  text = text_from_xml(attribute_name)
  text.to_i if text
end
integer_list_from_xml(attribute_name) click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 94
def integer_list_from_xml(attribute_name)
  text_list = text_list_from_xml(attribute_name)
  text_list.map(&:to_i) if text_list
end
setup_attributes_from_xml() click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 36
def setup_attributes_from_xml
  @id = integer_from_xml('ID')
  @title = text_from_xml('Title')
  @description = text_from_xml('Description')
  @status = status_from_xml
  @username = text_from_xml('Username')
  @url = text_from_xml('URL')
  @thumbnail_url = text_from_xml('ThumbnailURL')
  @thumbnail_size = text_from_xml('ThumbnailSize')
  @thumbnail_small_url = text_from_xml('ThumbnailSmallURL')
  @thumbnail_medium_url = text_from_xml('ThumbnailXLargeURL')
  @thumbnail_large_url = text_from_xml('ThumbnailXXLargeURL')
  @embed = text_from_xml('Embed')
  @created_at = Time.parse text_from_xml('Created')
  @updated_at = Time.parse text_from_xml('Updated')
  @language = text_from_xml('Language')
  @format = text_from_xml('Format')
  @is_downloadable = boolean_from_xml('Download')
  @type = type_from_xml
  @is_in_contest = boolean_from_xml('InContest')
  @user_id = integer_from_xml('UserID')
  @ppt_location = text_from_xml('PPTLocation')
  @stripped_title = text_from_xml('StrippedTitle')
  @tags = text_list_from_xml('Tag')
  @download_count = integer_from_xml('NumDownloads')
  @view_count = integer_from_xml('NumViews')
  @comment_count = integer_from_xml('NumComments')
  @favorite_count = integer_from_xml('NumFavorites')
  @slide_count = integer_from_xml('NumSlides')
  @related_slideshow_ids = integer_list_from_xml('RelatedSlideshowID')
  @is_private = boolean_from_xml('PrivacyLevel')
  @is_not_flagged = boolean_from_xml('FlagVisible')
  @is_visible = boolean_from_xml('ShowOnSS')
  @url_is_secret = boolean_from_xml('SecretURL')
  @is_embaddable = boolean_from_xml('AllowEmbed')
  @is_visible_by_contacts = boolean_from_xml('ShareWithContacts')
end
status_from_xml() click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 99
def status_from_xml
  case integer_from_xml('Status')
    when 0 then
      :queued_for_conversion
    when 1 then
      :converting
    when 2 then
      :converted
    else
      :conversion_failed
  end
end
text_from_xml(attribute_name) click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 74
def text_from_xml(attribute_name)
  node = @original_slideshow_xml.search(attribute_name)
  node.text unless node.empty?
end
text_list_from_xml(attribute_name) click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 79
def text_list_from_xml(attribute_name)
  node = @original_slideshow_xml.search(attribute_name)
  node.map(&:text) unless node.empty?
end
type_from_xml() click to toggle source
# File lib/slideshare_api/model/slideshow.rb, line 112
def type_from_xml
  case integer_from_xml('SlideshowType')
    when 0 then
      :presentation
    when 1 then
      :document
    when 2 then
      :portfolio
    else
      :video
  end
end