slideshare_api 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slideshare_api/model/slideshow.rb +32 -16
- data/lib/slideshare_api/version.rb +1 -1
- data/spec/fixtures/slideshow.xml +0 -35
- data/spec/fixtures/slideshow_detailed.xml +67 -0
- data/spec/model/slideshow_spec.rb +237 -126
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63dba4aeab650366a2a5d89c7a150bf294841f0c
|
4
|
+
data.tar.gz: 5abdd7c7222d6e350040a39b2440d6a2664d8b5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
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)
|
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)
|
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)
|
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)
|
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
|
81
|
-
|
82
|
-
when
|
83
|
-
|
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
|
90
|
-
|
91
|
-
when
|
92
|
-
|
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
|
data/spec/fixtures/slideshow.xml
CHANGED
@@ -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
|
+
<iframe src="https://www.slideshare.net/slideshow/embed_code/34187090" width="427"
|
18
|
+
height="356" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"
|
19
|
+
style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen>
|
20
|
+
</iframe> <div style="margin-bottom:5px"> <strong> <a href="https://www.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise"
|
21
|
+
title="Prerequis pour appliquer le Lean Startup en entreprise" target="_blank">Prerequis pour
|
22
|
+
appliquer le Lean Startup en entreprise</a> </strong> from <strong><a href="http://www.slideshare.net/jeremyvenezia"
|
23
|
+
target="_blank">Jeremy Venezia</a></strong> </div>
|
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
|
-
|
5
|
+
context 'without xml input' do
|
6
|
+
subject { SlideshareApi::Model::Slideshow.new }
|
6
7
|
|
7
|
-
|
8
|
+
it { expect(subject.original_slideshow_xml).to be nil }
|
9
|
+
end
|
8
10
|
|
9
|
-
|
10
|
-
|
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
|
-
|
15
|
-
|
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
|
-
|
21
|
-
|
22
|
-
it { expect(subject.
|
23
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
it { expect(subject.
|
61
|
-
|
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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
-
|
74
|
-
|
75
|
-
|
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
|
-
|
80
|
-
|
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
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
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
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
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
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
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
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
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
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
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
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
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
|
-
|
156
|
-
|
157
|
-
|
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.
|
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
|