slideshare_api 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06f251b0a8f7fb00b173bf2e2d1b6ce2ab9d412e
4
- data.tar.gz: aa8691054b279fe7c19eb3aabea002eff75a97dc
3
+ metadata.gz: 63dba4aeab650366a2a5d89c7a150bf294841f0c
4
+ data.tar.gz: 5abdd7c7222d6e350040a39b2440d6a2664d8b5a
5
5
  SHA512:
6
- metadata.gz: 2c5aa91a7480d1c225d2526413a4ab09438b3f93a62948f0f94f2e1ca5d5140723beabbef8bc52d5557175f01adcca02b1af3e6ceff3198d9ae949161baab8f7
7
- data.tar.gz: a26af121af50be2501b253f77fd0bd481fddf26a95307166b4d7febb8f169fb22c4795a244f93c3aebc0cf13b0e5e437f9947d94f33a6957972d3d7bc9cb95a1
6
+ metadata.gz: 5031fd4b932932dd96ec8a81a06b98de66624a3dcdd8bfb8c205fbd9d11d76fcb80754c29cf6da8816e032a4e210a9783284523daec2002806ca45788e08146d
7
+ data.tar.gz: 8845fc91dc22218c6c494d368163f7bea082aaf65ab7a737b05ded7bcc30351daeb611ce2f935193b84bf006602438db46f23cdee0588a7fdf92d70e76e30329
@@ -15,9 +15,14 @@ module SlideshareApi
15
15
  :related_slideshow_ids,
16
16
  :is_private, :is_not_flagged, :url_is_secret, :is_embaddable, :is_visible, :is_visible_by_contacts
17
17
 
18
- def initialize(slideshow_xml)
18
+ def initialize(slideshow_xml = nil)
19
19
  @original_slideshow_xml = slideshow_xml
20
+ setup_attributes_from_xml if @original_slideshow_xml
21
+ end
22
+
23
+ private
20
24
 
25
+ def setup_attributes_from_xml
21
26
  @id = integer_from_xml('ID')
22
27
  @title = text_from_xml('Title')
23
28
  @description = text_from_xml('Description')
@@ -53,43 +58,54 @@ module SlideshareApi
53
58
  @is_visible_by_contacts = boolean_from_xml('ShareWithContacts')
54
59
  end
55
60
 
56
- private
57
-
58
61
  def text_from_xml(attribute_name)
59
- @original_slideshow_xml.search(attribute_name).text
62
+ node = @original_slideshow_xml.search(attribute_name)
63
+ node.text unless node.empty?
60
64
  end
61
65
 
62
66
  def text_list_from_xml(attribute_name)
63
- @original_slideshow_xml.search(attribute_name).map(&:text)
67
+ node = @original_slideshow_xml.search(attribute_name)
68
+ node.map(&:text) unless node.empty?
64
69
  end
65
70
 
66
71
  def boolean_from_xml(attribute_name)
67
- @original_slideshow_xml.search(attribute_name).first.content == '1'
72
+ node = @original_slideshow_xml.search(attribute_name)
73
+ node.first.content == '1' unless node.empty?
68
74
  end
69
75
 
70
76
  def integer_from_xml(attribute_name)
71
- text_from_xml(attribute_name).to_i
77
+ text = text_from_xml(attribute_name)
78
+ text.to_i if text
72
79
  end
73
80
 
74
81
  def integer_list_from_xml(attribute_name)
75
- text_list_from_xml(attribute_name).map(&:to_i)
82
+ text_list = text_list_from_xml(attribute_name)
83
+ text_list.map(&:to_i) if text_list
76
84
  end
77
85
 
78
86
  def status_from_xml
79
87
  case integer_from_xml('Status')
80
- when 0 then :queued_for_conversion
81
- when 1 then :converting
82
- when 2 then :converted
83
- else :conversion_failed
88
+ when 0 then
89
+ :queued_for_conversion
90
+ when 1 then
91
+ :converting
92
+ when 2 then
93
+ :converted
94
+ else
95
+ :conversion_failed
84
96
  end
85
97
  end
86
98
 
87
99
  def type_from_xml
88
100
  case integer_from_xml('SlideshowType')
89
- when 0 then :presentation
90
- when 1 then :document
91
- when 2 then :portfolio
92
- else :video
101
+ when 0 then
102
+ :presentation
103
+ when 1 then
104
+ :document
105
+ when 2 then
106
+ :portfolio
107
+ else
108
+ :video
93
109
  end
94
110
  end
95
111
  end
@@ -1,3 +1,3 @@
1
1
  module SlideshareApi
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -29,39 +29,4 @@
29
29
  <Download>0</Download>
30
30
  <SlideshowType>0</SlideshowType>
31
31
  <InContest>0</InContest>
32
- <UserID>62691692</UserID>
33
- <PPTLocation>
34
- prerequispourappliquerleleanstartupdanslentreprise-140430023146-phpapp02-140501195007-phpapp01
35
- </PPTLocation>
36
- <StrippedTitle>prerequis-pour-appliquer-le-lean-startup-en-entreprise</StrippedTitle>
37
- <Tags>
38
- <Tag Count="1" Owner="1">leanstartup</Tag>
39
- <Tag Count="1" Owner="1">entrepreneur</Tag>
40
- <Tag Count="1" Owner="1">startup</Tag>
41
- <Tag Count="1" Owner="1">entrepreneurship</Tag>
42
- <Tag Count="1" Owner="1">business</Tag>
43
- </Tags>
44
- <NumDownloads>0</NumDownloads>
45
- <NumViews>223</NumViews>
46
- <NumComments>0</NumComments>
47
- <NumFavorites>0</NumFavorites>
48
- <NumSlides>28</NumSlides>
49
- <RelatedSlideshows>
50
- <RelatedSlideshowID rank="1">34115565</RelatedSlideshowID>
51
- <RelatedSlideshowID rank="2">34120112</RelatedSlideshowID>
52
- <RelatedSlideshowID rank="3">33133758</RelatedSlideshowID>
53
- <RelatedSlideshowID rank="4">27569567</RelatedSlideshowID>
54
- <RelatedSlideshowID rank="5">28375042</RelatedSlideshowID>
55
- <RelatedSlideshowID rank="6">30302539</RelatedSlideshowID>
56
- <RelatedSlideshowID rank="7">28193782</RelatedSlideshowID>
57
- <RelatedSlideshowID rank="8">22861393</RelatedSlideshowID>
58
- <RelatedSlideshowID rank="9">16138475</RelatedSlideshowID>
59
- <RelatedSlideshowID rank="10">19583592</RelatedSlideshowID>
60
- </RelatedSlideshows>
61
- <PrivacyLevel>0</PrivacyLevel>
62
- <FlagVisible>1</FlagVisible>
63
- <ShowOnSS>0</ShowOnSS>
64
- <SecretURL>0</SecretURL>
65
- <AllowEmbed>0</AllowEmbed>
66
- <ShareWithContacts>0</ShareWithContacts>
67
32
  </Slideshow>
@@ -0,0 +1,67 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Slideshow>
3
+ <ID>34187090</ID>
4
+ <Title>Prerequis pour appliquer le Lean Startup en entreprise</Title>
5
+ <Description></Description>
6
+ <Status>2</Status>
7
+ <Username>jeremyvenezia</Username>
8
+ <URL>http://www.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise</URL>
9
+ <ThumbnailURL>
10
+ //cdn.slidesharecdn.com/ss_thumbnails/prerequispourappliquerleleanstartupdanslentreprise-140430023146-phpapp02-140501195007-phpapp01-thumbnail.jpg?cb=1398991939
11
+ </ThumbnailURL>
12
+ <ThumbnailSize>[170,130]</ThumbnailSize>
13
+ <ThumbnailSmallURL>
14
+ //cdn.slidesharecdn.com/ss_thumbnails/prerequispourappliquerleleanstartupdanslentreprise-140430023146-phpapp02-140501195007-phpapp01-thumbnail-2.jpg?cb=1398991939
15
+ </ThumbnailSmallURL>
16
+ <Embed>
17
+ &lt;iframe src=&quot;https://www.slideshare.net/slideshow/embed_code/34187090&quot; width=&quot;427&quot;
18
+ height=&quot;356&quot; frameborder=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; scrolling=&quot;no&quot;
19
+ style=&quot;border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;&quot; allowfullscreen&gt;
20
+ &lt;/iframe&gt; &lt;div style=&quot;margin-bottom:5px&quot;&gt; &lt;strong&gt; &lt;a href=&quot;https://www.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise&quot;
21
+ title=&quot;Prerequis pour appliquer le Lean Startup en entreprise&quot; target=&quot;_blank&quot;&gt;Prerequis pour
22
+ appliquer le Lean Startup en entreprise&lt;/a&gt; &lt;/strong&gt; from &lt;strong&gt;&lt;a href=&quot;http://www.slideshare.net/jeremyvenezia&quot;
23
+ target=&quot;_blank&quot;&gt;Jeremy Venezia&lt;/a&gt;&lt;/strong&gt; &lt;/div&gt;
24
+ </Embed>
25
+ <Created>2014-05-02 00:50:06 UTC</Created>
26
+ <Updated>2014-05-02 00:52:19 UTC</Updated>
27
+ <Language>fr</Language>
28
+ <Format>pptx</Format>
29
+ <Download>0</Download>
30
+ <SlideshowType>0</SlideshowType>
31
+ <InContest>0</InContest>
32
+ <UserID>62691692</UserID>
33
+ <PPTLocation>
34
+ prerequispourappliquerleleanstartupdanslentreprise-140430023146-phpapp02-140501195007-phpapp01
35
+ </PPTLocation>
36
+ <StrippedTitle>prerequis-pour-appliquer-le-lean-startup-en-entreprise</StrippedTitle>
37
+ <Tags>
38
+ <Tag Count="1" Owner="1">leanstartup</Tag>
39
+ <Tag Count="1" Owner="1">entrepreneur</Tag>
40
+ <Tag Count="1" Owner="1">startup</Tag>
41
+ <Tag Count="1" Owner="1">entrepreneurship</Tag>
42
+ <Tag Count="1" Owner="1">business</Tag>
43
+ </Tags>
44
+ <NumDownloads>0</NumDownloads>
45
+ <NumViews>223</NumViews>
46
+ <NumComments>0</NumComments>
47
+ <NumFavorites>0</NumFavorites>
48
+ <NumSlides>28</NumSlides>
49
+ <RelatedSlideshows>
50
+ <RelatedSlideshowID rank="1">34115565</RelatedSlideshowID>
51
+ <RelatedSlideshowID rank="2">34120112</RelatedSlideshowID>
52
+ <RelatedSlideshowID rank="3">33133758</RelatedSlideshowID>
53
+ <RelatedSlideshowID rank="4">27569567</RelatedSlideshowID>
54
+ <RelatedSlideshowID rank="5">28375042</RelatedSlideshowID>
55
+ <RelatedSlideshowID rank="6">30302539</RelatedSlideshowID>
56
+ <RelatedSlideshowID rank="7">28193782</RelatedSlideshowID>
57
+ <RelatedSlideshowID rank="8">22861393</RelatedSlideshowID>
58
+ <RelatedSlideshowID rank="9">16138475</RelatedSlideshowID>
59
+ <RelatedSlideshowID rank="10">19583592</RelatedSlideshowID>
60
+ </RelatedSlideshows>
61
+ <PrivacyLevel>0</PrivacyLevel>
62
+ <FlagVisible>1</FlagVisible>
63
+ <ShowOnSS>0</ShowOnSS>
64
+ <SecretURL>0</SecretURL>
65
+ <AllowEmbed>0</AllowEmbed>
66
+ <ShareWithContacts>0</ShareWithContacts>
67
+ </Slideshow>
@@ -2,159 +2,270 @@ require 'spec_helper'
2
2
 
3
3
  describe SlideshareApi::Model::Slideshow do
4
4
  describe 'attributes' do
5
- let(:slideshow_xml) { Nokogiri::XML(open('spec/fixtures/slideshow.xml').read) }
5
+ context 'without xml input' do
6
+ subject { SlideshareApi::Model::Slideshow.new }
6
7
 
7
- subject { SlideshareApi::Model::Slideshow.new slideshow_xml }
8
+ it { expect(subject.original_slideshow_xml).to be nil }
9
+ end
8
10
 
9
- it { expect(subject.original_slideshow_xml).to eq slideshow_xml }
10
- it { expect(subject.id).to eq slideshow_xml.search('ID').text.to_i }
11
- it { expect(subject.title).to eq slideshow_xml.search('Title').text }
12
- it { expect(subject.description).to eq slideshow_xml.search('Description').text }
11
+ context 'with xml input' do
12
+ subject { SlideshareApi::Model::Slideshow.new slideshow_xml }
13
13
 
14
- describe 'status' do
15
- context 'queued_for_conversion' do
16
- before { slideshow_xml.search('Status').first.content = 0 }
17
- it { expect(subject.status).to eq :queued_for_conversion }
18
- end
14
+ context 'not detailed xml' do
15
+ let(:slideshow_xml) { Nokogiri::XML(open('spec/fixtures/slideshow.xml').read) }
19
16
 
20
- context 'converting' do
21
- before { slideshow_xml.search('Status').first.content = 1 }
22
- it { expect(subject.status).to eq :converting }
23
- end
17
+ it { expect(subject.original_slideshow_xml).to eq slideshow_xml }
18
+ it { expect(subject.id).to eq slideshow_xml.search('ID').text.to_i }
19
+ it { expect(subject.title).to eq slideshow_xml.search('Title').text }
20
+ it { expect(subject.description).to eq slideshow_xml.search('Description').text }
24
21
 
25
- context 'converted' do
26
- before { slideshow_xml.search('Status').first.content = 2 }
27
- it { expect(subject.status).to eq :converted }
28
- end
22
+ describe 'status' do
23
+ context 'queued_for_conversion' do
24
+ before { slideshow_xml.search('Status').first.content = 0 }
25
+ it { expect(subject.status).to eq :queued_for_conversion }
26
+ end
29
27
 
30
- context 'conversion_failed' do
31
- before { slideshow_xml.search('Status').first.content = 3 }
32
- it { expect(subject.status).to eq :conversion_failed }
33
- end
34
- end
28
+ context 'converting' do
29
+ before { slideshow_xml.search('Status').first.content = 1 }
30
+ it { expect(subject.status).to eq :converting }
31
+ end
35
32
 
36
- it { expect(subject.username).to eq slideshow_xml.search('Username').text }
37
- it { expect(subject.url).to eq slideshow_xml.search('URL').text }
38
- it { expect(subject.thumbnail_url).to eq slideshow_xml.search('ThumbnailURL').text }
39
- it { expect(subject.thumbnail_size).to eq slideshow_xml.search('ThumbnailSize').text }
40
- it { expect(subject.thumbnail_small_url).to eq slideshow_xml.search('ThumbnailSmallURL').text }
41
- it { expect(subject.embed).to eq slideshow_xml.search('Embed').text }
42
- it { expect(subject.created_at).to eq Time.parse slideshow_xml.search('Created').text }
43
- it { expect(subject.updated_at).to eq Time.parse slideshow_xml.search('Updated').text }
44
- it { expect(subject.language).to eq slideshow_xml.search('Language').text }
45
- it { expect(subject.format).to eq slideshow_xml.search('Format').text }
46
-
47
- context 'it is downloadable' do
48
- before { slideshow_xml.search('Download').first.content = 1 }
49
- it { expect(subject.is_downloadable).to eq true }
50
- end
33
+ context 'converted' do
34
+ before { slideshow_xml.search('Status').first.content = 2 }
35
+ it { expect(subject.status).to eq :converted }
36
+ end
51
37
 
52
- context 'it is not downloadable' do
53
- before { slideshow_xml.search('Download').first.content = 0 }
54
- it { expect(subject.is_downloadable).to eq false }
55
- end
38
+ context 'conversion_failed' do
39
+ before { slideshow_xml.search('Status').first.content = 3 }
40
+ it { expect(subject.status).to eq :conversion_failed }
41
+ end
42
+ end
56
43
 
57
- describe 'type' do
58
- context 'presentation' do
59
- before { slideshow_xml.search('SlideshowType').first.content = 0 }
60
- it { expect(subject.type).to eq :presentation }
61
- end
44
+ it { expect(subject.username).to eq slideshow_xml.search('Username').text }
45
+ it { expect(subject.url).to eq slideshow_xml.search('URL').text }
46
+ it { expect(subject.thumbnail_url).to eq slideshow_xml.search('ThumbnailURL').text }
47
+ it { expect(subject.thumbnail_size).to eq slideshow_xml.search('ThumbnailSize').text }
48
+ it { expect(subject.thumbnail_small_url).to eq slideshow_xml.search('ThumbnailSmallURL').text }
49
+ it { expect(subject.embed).to eq slideshow_xml.search('Embed').text }
50
+ it { expect(subject.created_at).to eq Time.parse slideshow_xml.search('Created').text }
51
+ it { expect(subject.updated_at).to eq Time.parse slideshow_xml.search('Updated').text }
52
+ it { expect(subject.language).to eq slideshow_xml.search('Language').text }
53
+ it { expect(subject.format).to eq slideshow_xml.search('Format').text }
62
54
 
63
- context 'document' do
64
- before { slideshow_xml.search('SlideshowType').first.content = 1 }
65
- it { expect(subject.type).to eq :document }
66
- end
55
+ context 'it is downloadable' do
56
+ before { slideshow_xml.search('Download').first.content = 1 }
57
+ it { expect(subject.is_downloadable).to eq true }
58
+ end
67
59
 
68
- context 'portfolio' do
69
- before { slideshow_xml.search('SlideshowType').first.content = 2 }
70
- it { expect(subject.type).to eq :portfolio }
71
- end
60
+ context 'it is not downloadable' do
61
+ before { slideshow_xml.search('Download').first.content = 0 }
62
+ it { expect(subject.is_downloadable).to eq false }
63
+ end
64
+
65
+ describe 'type' do
66
+ context 'presentation' do
67
+ before { slideshow_xml.search('SlideshowType').first.content = 0 }
68
+ it { expect(subject.type).to eq :presentation }
69
+ end
72
70
 
73
- context 'video' do
74
- before { slideshow_xml.search('SlideshowType').first.content = 3 }
75
- it { expect(subject.type).to eq :video }
71
+ context 'document' do
72
+ before { slideshow_xml.search('SlideshowType').first.content = 1 }
73
+ it { expect(subject.type).to eq :document }
74
+ end
75
+
76
+ context 'portfolio' do
77
+ before { slideshow_xml.search('SlideshowType').first.content = 2 }
78
+ it { expect(subject.type).to eq :portfolio }
79
+ end
80
+
81
+ context 'video' do
82
+ before { slideshow_xml.search('SlideshowType').first.content = 3 }
83
+ it { expect(subject.type).to eq :video }
84
+ end
85
+ end
86
+
87
+ context 'it is in contest' do
88
+ before { slideshow_xml.search('InContest').first.content = 1 }
89
+ it { expect(subject.is_in_contest).to eq true }
90
+ end
91
+
92
+ context 'it is not in contest' do
93
+ before { slideshow_xml.search('InContest').first.content = 0 }
94
+ it { expect(subject.is_in_contest).to eq false }
95
+ end
96
+
97
+ it { expect(subject.user_id).to eq nil }
98
+ it { expect(subject.ppt_location).to eq nil }
99
+ it { expect(subject.stripped_title).to eq nil }
100
+ it { expect(subject.tags).to eq nil }
101
+ it { expect(subject.download_count).to eq nil }
102
+ it { expect(subject.view_count).to eq nil }
103
+ it { expect(subject.comment_count).to eq nil }
104
+ it { expect(subject.favorite_count).to eq nil }
105
+ it { expect(subject.slide_count).to eq nil }
106
+ it { expect(subject.related_slideshow_ids).to eq nil }
107
+ it { expect(subject.is_private).to eq nil }
108
+ it { expect(subject.is_not_flagged).to eq nil }
109
+ it { expect(subject.is_visible).to eq nil }
110
+ it { expect(subject.url_is_secret).to eq nil }
111
+ it { expect(subject.is_embaddable).to eq nil }
112
+ it { expect(subject.is_visible_by_contacts).to eq nil }
76
113
  end
77
- end
78
114
 
79
- context 'it is in contest' do
80
- before { slideshow_xml.search('InContest').first.content = 1 }
81
- it { expect(subject.is_in_contest).to eq true }
82
- end
115
+ context 'detailed xml' do
116
+ let(:slideshow_xml) { Nokogiri::XML(open('spec/fixtures/slideshow_detailed.xml').read) }
83
117
 
84
- context 'it is not in contest' do
85
- before { slideshow_xml.search('InContest').first.content = 0 }
86
- it { expect(subject.is_in_contest).to eq false }
87
- end
118
+ it { expect(subject.original_slideshow_xml).to eq slideshow_xml }
119
+ it { expect(subject.id).to eq slideshow_xml.search('ID').text.to_i }
120
+ it { expect(subject.title).to eq slideshow_xml.search('Title').text }
121
+ it { expect(subject.description).to eq slideshow_xml.search('Description').text }
88
122
 
89
- it { expect(subject.user_id).to eq slideshow_xml.search('UserID').text.to_i }
90
- it { expect(subject.ppt_location).to eq slideshow_xml.search('PPTLocation').text }
91
- it { expect(subject.stripped_title).to eq slideshow_xml.search('StrippedTitle').text }
92
- it { expect(subject.tags).to eq slideshow_xml.search('Tag').map(&:text) }
93
- it { expect(subject.download_count).to eq slideshow_xml.search('NumDownloads').text.to_i }
94
- it { expect(subject.view_count).to eq slideshow_xml.search('NumViews').text.to_i }
95
- it { expect(subject.comment_count).to eq slideshow_xml.search('NumComments').text.to_i }
96
- it { expect(subject.favorite_count).to eq slideshow_xml.search('NumFavorites').text.to_i }
97
- it { expect(subject.slide_count).to eq slideshow_xml.search('NumSlides').text.to_i }
98
- it { expect(subject.related_slideshow_ids).to eq slideshow_xml.search('RelatedSlideshowID').map(&:text).map(&:to_i) }
99
-
100
- context 'it is private' do
101
- before { slideshow_xml.search('PrivacyLevel').first.content = 1 }
102
- it { expect(subject.is_private).to eq true }
103
- end
123
+ describe 'status' do
124
+ context 'queued_for_conversion' do
125
+ before { slideshow_xml.search('Status').first.content = 0 }
126
+ it { expect(subject.status).to eq :queued_for_conversion }
127
+ end
104
128
 
105
- context 'it is not private' do
106
- before { slideshow_xml.search('PrivacyLevel').first.content = 0 }
107
- it { expect(subject.is_private).to eq false }
108
- end
129
+ context 'converting' do
130
+ before { slideshow_xml.search('Status').first.content = 1 }
131
+ it { expect(subject.status).to eq :converting }
132
+ end
109
133
 
110
- context 'it is flagged' do
111
- before { slideshow_xml.search('FlagVisible').first.content = 1 }
112
- it { expect(subject.is_not_flagged).to eq true }
113
- end
134
+ context 'converted' do
135
+ before { slideshow_xml.search('Status').first.content = 2 }
136
+ it { expect(subject.status).to eq :converted }
137
+ end
114
138
 
115
- context 'it is not flagged' do
116
- before { slideshow_xml.search('FlagVisible').first.content = 0 }
117
- it { expect(subject.is_not_flagged).to eq false }
118
- end
139
+ context 'conversion_failed' do
140
+ before { slideshow_xml.search('Status').first.content = 3 }
141
+ it { expect(subject.status).to eq :conversion_failed }
142
+ end
143
+ end
119
144
 
120
- context 'it is visible' do
121
- before { slideshow_xml.search('ShowOnSS').first.content = 1 }
122
- it { expect(subject.is_visible).to eq true }
123
- end
145
+ it { expect(subject.username).to eq slideshow_xml.search('Username').text }
146
+ it { expect(subject.url).to eq slideshow_xml.search('URL').text }
147
+ it { expect(subject.thumbnail_url).to eq slideshow_xml.search('ThumbnailURL').text }
148
+ it { expect(subject.thumbnail_size).to eq slideshow_xml.search('ThumbnailSize').text }
149
+ it { expect(subject.thumbnail_small_url).to eq slideshow_xml.search('ThumbnailSmallURL').text }
150
+ it { expect(subject.embed).to eq slideshow_xml.search('Embed').text }
151
+ it { expect(subject.created_at).to eq Time.parse slideshow_xml.search('Created').text }
152
+ it { expect(subject.updated_at).to eq Time.parse slideshow_xml.search('Updated').text }
153
+ it { expect(subject.language).to eq slideshow_xml.search('Language').text }
154
+ it { expect(subject.format).to eq slideshow_xml.search('Format').text }
124
155
 
125
- context 'it is not visible' do
126
- before { slideshow_xml.search('ShowOnSS').first.content = 0 }
127
- it { expect(subject.is_visible).to eq false }
128
- end
156
+ context 'it is downloadable' do
157
+ before { slideshow_xml.search('Download').first.content = 1 }
158
+ it { expect(subject.is_downloadable).to eq true }
159
+ end
129
160
 
130
- context 'url is secret' do
131
- before { slideshow_xml.search('SecretURL').first.content = 1 }
132
- it { expect(subject.url_is_secret).to eq true }
133
- end
161
+ context 'it is not downloadable' do
162
+ before { slideshow_xml.search('Download').first.content = 0 }
163
+ it { expect(subject.is_downloadable).to eq false }
164
+ end
134
165
 
135
- context 'url is not secret' do
136
- before { slideshow_xml.search('SecretURL').first.content = 0 }
137
- it { expect(subject.url_is_secret).to eq false }
138
- end
166
+ describe 'type' do
167
+ context 'presentation' do
168
+ before { slideshow_xml.search('SlideshowType').first.content = 0 }
169
+ it { expect(subject.type).to eq :presentation }
170
+ end
139
171
 
140
- context 'it is embaddable' do
141
- before { slideshow_xml.search('AllowEmbed').first.content = 1 }
142
- it { expect(subject.is_embaddable).to eq true }
143
- end
172
+ context 'document' do
173
+ before { slideshow_xml.search('SlideshowType').first.content = 1 }
174
+ it { expect(subject.type).to eq :document }
175
+ end
144
176
 
145
- context 'url is not embaddable' do
146
- before { slideshow_xml.search('AllowEmbed').first.content = 0 }
147
- it { expect(subject.is_embaddable).to eq false }
148
- end
177
+ context 'portfolio' do
178
+ before { slideshow_xml.search('SlideshowType').first.content = 2 }
179
+ it { expect(subject.type).to eq :portfolio }
180
+ end
149
181
 
150
- context 'it is visible by contacts' do
151
- before { slideshow_xml.search('ShareWithContacts').first.content = 1 }
152
- it { expect(subject.is_visible_by_contacts).to eq true }
153
- end
182
+ context 'video' do
183
+ before { slideshow_xml.search('SlideshowType').first.content = 3 }
184
+ it { expect(subject.type).to eq :video }
185
+ end
186
+ end
187
+
188
+ context 'it is in contest' do
189
+ before { slideshow_xml.search('InContest').first.content = 1 }
190
+ it { expect(subject.is_in_contest).to eq true }
191
+ end
192
+
193
+ context 'it is not in contest' do
194
+ before { slideshow_xml.search('InContest').first.content = 0 }
195
+ it { expect(subject.is_in_contest).to eq false }
196
+ end
197
+
198
+ it { expect(subject.user_id).to eq slideshow_xml.search('UserID').text.to_i }
199
+ it { expect(subject.ppt_location).to eq slideshow_xml.search('PPTLocation').text }
200
+ it { expect(subject.stripped_title).to eq slideshow_xml.search('StrippedTitle').text }
201
+ it { expect(subject.tags).to eq slideshow_xml.search('Tag').map(&:text) }
202
+ it { expect(subject.download_count).to eq slideshow_xml.search('NumDownloads').text.to_i }
203
+ it { expect(subject.view_count).to eq slideshow_xml.search('NumViews').text.to_i }
204
+ it { expect(subject.comment_count).to eq slideshow_xml.search('NumComments').text.to_i }
205
+ it { expect(subject.favorite_count).to eq slideshow_xml.search('NumFavorites').text.to_i }
206
+ it { expect(subject.slide_count).to eq slideshow_xml.search('NumSlides').text.to_i }
207
+ it { expect(subject.related_slideshow_ids).to eq slideshow_xml.search('RelatedSlideshowID').map(&:text).map(&:to_i) }
208
+
209
+ context 'it is private' do
210
+ before { slideshow_xml.search('PrivacyLevel').first.content = 1 }
211
+ it { expect(subject.is_private).to eq true }
212
+ end
154
213
 
155
- context 'url is not visible by contacts' do
156
- before { slideshow_xml.search('ShareWithContacts').first.content = 0 }
157
- it { expect(subject.is_visible_by_contacts).to eq false }
214
+ context 'it is not private' do
215
+ before { slideshow_xml.search('PrivacyLevel').first.content = 0 }
216
+ it { expect(subject.is_private).to eq false }
217
+ end
218
+
219
+ context 'it is flagged' do
220
+ before { slideshow_xml.search('FlagVisible').first.content = 1 }
221
+ it { expect(subject.is_not_flagged).to eq true }
222
+ end
223
+
224
+ context 'it is not flagged' do
225
+ before { slideshow_xml.search('FlagVisible').first.content = 0 }
226
+ it { expect(subject.is_not_flagged).to eq false }
227
+ end
228
+
229
+ context 'it is visible' do
230
+ before { slideshow_xml.search('ShowOnSS').first.content = 1 }
231
+ it { expect(subject.is_visible).to eq true }
232
+ end
233
+
234
+ context 'it is not visible' do
235
+ before { slideshow_xml.search('ShowOnSS').first.content = 0 }
236
+ it { expect(subject.is_visible).to eq false }
237
+ end
238
+
239
+ context 'url is secret' do
240
+ before { slideshow_xml.search('SecretURL').first.content = 1 }
241
+ it { expect(subject.url_is_secret).to eq true }
242
+ end
243
+
244
+ context 'url is not secret' do
245
+ before { slideshow_xml.search('SecretURL').first.content = 0 }
246
+ it { expect(subject.url_is_secret).to eq false }
247
+ end
248
+
249
+ context 'it is embaddable' do
250
+ before { slideshow_xml.search('AllowEmbed').first.content = 1 }
251
+ it { expect(subject.is_embaddable).to eq true }
252
+ end
253
+
254
+ context 'url is not embaddable' do
255
+ before { slideshow_xml.search('AllowEmbed').first.content = 0 }
256
+ it { expect(subject.is_embaddable).to eq false }
257
+ end
258
+
259
+ context 'it is visible by contacts' do
260
+ before { slideshow_xml.search('ShareWithContacts').first.content = 1 }
261
+ it { expect(subject.is_visible_by_contacts).to eq true }
262
+ end
263
+
264
+ context 'url is not visible by contacts' do
265
+ before { slideshow_xml.search('ShareWithContacts').first.content = 0 }
266
+ it { expect(subject.is_visible_by_contacts).to eq false }
267
+ end
268
+ end
158
269
  end
159
270
  end
160
271
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshare_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Venezia
@@ -128,6 +128,7 @@ files:
128
128
  - slideshare_api.gemspec
129
129
  - spec/client_spec.rb
130
130
  - spec/fixtures/slideshow.xml
131
+ - spec/fixtures/slideshow_detailed.xml
131
132
  - spec/model/slideshow_spec.rb
132
133
  - spec/spec_helper.rb
133
134
  homepage: https://github.com/jvenezia/slideshare_api
@@ -157,5 +158,6 @@ summary: Ruby wrapper for the Slideshare API.
157
158
  test_files:
158
159
  - spec/client_spec.rb
159
160
  - spec/fixtures/slideshow.xml
161
+ - spec/fixtures/slideshow_detailed.xml
160
162
  - spec/model/slideshow_spec.rb
161
163
  - spec/spec_helper.rb