slideshare_api 0.0.2 → 0.0.3
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 +4 -4
- data/.gitignore +2 -1
- data/README.md +3 -2
- data/lib/slideshare_api/model/slideshow.rb +44 -18
- data/lib/slideshare_api/version.rb +1 -1
- data/slideshare_api.gemspec +3 -2
- data/spec/model/slideshow_spec.rb +64 -13
- data/spec/spec_helper.rb +8 -0
- metadata +18 -5
- data/slideshare_api-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06f251b0a8f7fb00b173bf2e2d1b6ce2ab9d412e
|
4
|
+
data.tar.gz: aa8691054b279fe7c19eb3aabea002eff75a97dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c5aa91a7480d1c225d2526413a4ab09438b3f93a62948f0f94f2e1ca5d5140723beabbef8bc52d5557175f01adcca02b1af3e6ceff3198d9ae949161baab8f7
|
7
|
+
data.tar.gz: a26af121af50be2501b253f77fd0bd481fddf26a95307166b4d7febb8f169fb22c4795a244f93c3aebc0cf13b0e5e437f9947d94f33a6957972d3d7bc9cb95a1
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# SlideshareApi
|
2
|
-
[](https://travis-ci.org/jvenezia/slideshare_api)
|
3
2
|
[](http://badge.fury.io/rb/slideshare_api)
|
3
|
+
[](https://travis-ci.org/jvenezia/slideshare_api)
|
4
|
+
[](https://coveralls.io/r/jvenezia/slideshare_api)
|
4
5
|
|
5
|
-
|
6
|
+
Ruby wrapper for the Slideshare API.
|
6
7
|
|
7
8
|
**Warning**: SlideshareApi is currently under heavy development.
|
8
9
|
|
@@ -6,22 +6,22 @@ module SlideshareApi
|
|
6
6
|
:created_at, :updated_at,
|
7
7
|
:username, :user_id,
|
8
8
|
:url, :thumbnail_url, :thumbnail_size, :thumbnail_small_url, :embed,
|
9
|
-
:language, :format, :
|
9
|
+
:language, :format, :type,
|
10
10
|
:is_downloadable, :is_in_contest,
|
11
11
|
:ppt_location,
|
12
12
|
:tags,
|
13
13
|
:download_count, :view_count, :comment_count, :favorite_count,
|
14
14
|
:slide_count,
|
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
18
|
def initialize(slideshow_xml)
|
19
19
|
@original_slideshow_xml = slideshow_xml
|
20
20
|
|
21
|
-
@id =
|
21
|
+
@id = integer_from_xml('ID')
|
22
22
|
@title = text_from_xml('Title')
|
23
23
|
@description = text_from_xml('Description')
|
24
|
-
@status =
|
24
|
+
@status = status_from_xml
|
25
25
|
@username = text_from_xml('Username')
|
26
26
|
@url = text_from_xml('URL')
|
27
27
|
@thumbnail_url = text_from_xml('ThumbnailURL')
|
@@ -33,20 +33,20 @@ module SlideshareApi
|
|
33
33
|
@language = text_from_xml('Language')
|
34
34
|
@format = text_from_xml('Format')
|
35
35
|
@is_downloadable = boolean_from_xml('Download')
|
36
|
-
@
|
36
|
+
@type = type_from_xml
|
37
37
|
@is_in_contest = boolean_from_xml('InContest')
|
38
|
-
@user_id =
|
38
|
+
@user_id = integer_from_xml('UserID')
|
39
39
|
@ppt_location = text_from_xml('PPTLocation')
|
40
40
|
@stripped_title = text_from_xml('StrippedTitle')
|
41
41
|
@tags = text_list_from_xml('Tag')
|
42
|
-
@download_count =
|
43
|
-
@view_count =
|
44
|
-
@comment_count =
|
45
|
-
@favorite_count =
|
46
|
-
@slide_count =
|
47
|
-
@related_slideshow_ids =
|
48
|
-
@
|
49
|
-
@
|
42
|
+
@download_count = integer_from_xml('NumDownloads')
|
43
|
+
@view_count = integer_from_xml('NumViews')
|
44
|
+
@comment_count = integer_from_xml('NumComments')
|
45
|
+
@favorite_count = integer_from_xml('NumFavorites')
|
46
|
+
@slide_count = integer_from_xml('NumSlides')
|
47
|
+
@related_slideshow_ids = integer_list_from_xml('RelatedSlideshowID')
|
48
|
+
@is_private = boolean_from_xml('PrivacyLevel')
|
49
|
+
@is_not_flagged = boolean_from_xml('FlagVisible')
|
50
50
|
@is_visible = boolean_from_xml('ShowOnSS')
|
51
51
|
@url_is_secret = boolean_from_xml('SecretURL')
|
52
52
|
@is_embaddable = boolean_from_xml('AllowEmbed')
|
@@ -55,10 +55,6 @@ module SlideshareApi
|
|
55
55
|
|
56
56
|
private
|
57
57
|
|
58
|
-
def boolean_from_xml(attribute_name)
|
59
|
-
@original_slideshow_xml.search(attribute_name).first.content == '1'
|
60
|
-
end
|
61
|
-
|
62
58
|
def text_from_xml(attribute_name)
|
63
59
|
@original_slideshow_xml.search(attribute_name).text
|
64
60
|
end
|
@@ -66,6 +62,36 @@ module SlideshareApi
|
|
66
62
|
def text_list_from_xml(attribute_name)
|
67
63
|
@original_slideshow_xml.search(attribute_name).map(&:text)
|
68
64
|
end
|
65
|
+
|
66
|
+
def boolean_from_xml(attribute_name)
|
67
|
+
@original_slideshow_xml.search(attribute_name).first.content == '1'
|
68
|
+
end
|
69
|
+
|
70
|
+
def integer_from_xml(attribute_name)
|
71
|
+
text_from_xml(attribute_name).to_i
|
72
|
+
end
|
73
|
+
|
74
|
+
def integer_list_from_xml(attribute_name)
|
75
|
+
text_list_from_xml(attribute_name).map(&:to_i)
|
76
|
+
end
|
77
|
+
|
78
|
+
def status_from_xml
|
79
|
+
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
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def type_from_xml
|
88
|
+
case integer_from_xml('SlideshowType')
|
89
|
+
when 0 then :presentation
|
90
|
+
when 1 then :document
|
91
|
+
when 2 then :portfolio
|
92
|
+
else :video
|
93
|
+
end
|
94
|
+
end
|
69
95
|
end
|
70
96
|
end
|
71
97
|
end
|
data/slideshare_api.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = SlideshareApi::VERSION
|
9
9
|
spec.authors = ['Jeremy Venezia']
|
10
10
|
spec.email = ['veneziajeremy@gmail.com']
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
11
|
+
spec.summary = %q{Ruby wrapper for the Slideshare API.}
|
12
|
+
spec.description = %q{Ruby wrapper for the Slideshare API.}
|
13
13
|
spec.homepage = 'https://github.com/jvenezia/slideshare_api'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
+
spec.add_development_dependency 'coveralls', '~> 0.7'
|
24
25
|
|
25
26
|
spec.add_dependency 'faraday', '~> 0'
|
26
27
|
spec.add_dependency 'faraday_middleware', '~> 0'
|
@@ -7,10 +7,32 @@ describe SlideshareApi::Model::Slideshow do
|
|
7
7
|
subject { SlideshareApi::Model::Slideshow.new slideshow_xml }
|
8
8
|
|
9
9
|
it { expect(subject.original_slideshow_xml).to eq slideshow_xml }
|
10
|
-
it { expect(subject.id).to eq slideshow_xml.search('ID').text }
|
10
|
+
it { expect(subject.id).to eq slideshow_xml.search('ID').text.to_i }
|
11
11
|
it { expect(subject.title).to eq slideshow_xml.search('Title').text }
|
12
12
|
it { expect(subject.description).to eq slideshow_xml.search('Description').text }
|
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
|
19
|
+
|
20
|
+
context 'converting' do
|
21
|
+
before { slideshow_xml.search('Status').first.content = 1 }
|
22
|
+
it { expect(subject.status).to eq :converting }
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'converted' do
|
26
|
+
before { slideshow_xml.search('Status').first.content = 2 }
|
27
|
+
it { expect(subject.status).to eq :converted }
|
28
|
+
end
|
29
|
+
|
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
|
35
|
+
|
14
36
|
it { expect(subject.username).to eq slideshow_xml.search('Username').text }
|
15
37
|
it { expect(subject.url).to eq slideshow_xml.search('URL').text }
|
16
38
|
it { expect(subject.thumbnail_url).to eq slideshow_xml.search('ThumbnailURL').text }
|
@@ -32,7 +54,27 @@ describe SlideshareApi::Model::Slideshow do
|
|
32
54
|
it { expect(subject.is_downloadable).to eq false }
|
33
55
|
end
|
34
56
|
|
35
|
-
|
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
|
62
|
+
|
63
|
+
context 'document' do
|
64
|
+
before { slideshow_xml.search('SlideshowType').first.content = 1 }
|
65
|
+
it { expect(subject.type).to eq :document }
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'portfolio' do
|
69
|
+
before { slideshow_xml.search('SlideshowType').first.content = 2 }
|
70
|
+
it { expect(subject.type).to eq :portfolio }
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'video' do
|
74
|
+
before { slideshow_xml.search('SlideshowType').first.content = 3 }
|
75
|
+
it { expect(subject.type).to eq :video }
|
76
|
+
end
|
77
|
+
end
|
36
78
|
|
37
79
|
context 'it is in contest' do
|
38
80
|
before { slideshow_xml.search('InContest').first.content = 1 }
|
@@ -44,26 +86,35 @@ describe SlideshareApi::Model::Slideshow do
|
|
44
86
|
it { expect(subject.is_in_contest).to eq false }
|
45
87
|
end
|
46
88
|
|
47
|
-
it { expect(subject.user_id).to eq slideshow_xml.search('UserID').text }
|
89
|
+
it { expect(subject.user_id).to eq slideshow_xml.search('UserID').text.to_i }
|
48
90
|
it { expect(subject.ppt_location).to eq slideshow_xml.search('PPTLocation').text }
|
49
91
|
it { expect(subject.stripped_title).to eq slideshow_xml.search('StrippedTitle').text }
|
50
92
|
it { expect(subject.tags).to eq slideshow_xml.search('Tag').map(&:text) }
|
51
|
-
it { expect(subject.download_count).to eq slideshow_xml.search('NumDownloads').text }
|
52
|
-
it { expect(subject.view_count).to eq slideshow_xml.search('NumViews').text }
|
53
|
-
it { expect(subject.comment_count).to eq slideshow_xml.search('NumComments').text }
|
54
|
-
it { expect(subject.favorite_count).to eq slideshow_xml.search('NumFavorites').text }
|
55
|
-
it { expect(subject.slide_count).to eq slideshow_xml.search('NumSlides').text }
|
56
|
-
it { expect(subject.related_slideshow_ids).to eq slideshow_xml.search('RelatedSlideshowID').map(&:text) }
|
57
|
-
|
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
|
104
|
+
|
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
|
58
109
|
|
59
110
|
context 'it is flagged' do
|
60
111
|
before { slideshow_xml.search('FlagVisible').first.content = 1 }
|
61
|
-
it { expect(subject.
|
112
|
+
it { expect(subject.is_not_flagged).to eq true }
|
62
113
|
end
|
63
114
|
|
64
115
|
context 'it is not flagged' do
|
65
116
|
before { slideshow_xml.search('FlagVisible').first.content = 0 }
|
66
|
-
it { expect(subject.
|
117
|
+
it { expect(subject.is_not_flagged).to eq false }
|
67
118
|
end
|
68
119
|
|
69
120
|
context 'it is visible' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
1
4
|
require 'bundler/setup'
|
2
5
|
Bundler.setup
|
3
6
|
|
4
7
|
require 'slideshare_api'
|
5
8
|
|
6
9
|
RSpec.configure do |config|
|
10
|
+
# Use color in STDOUT
|
11
|
+
config.color = true
|
12
|
+
|
13
|
+
# Use color not only in STDOUT but also in pagers and files
|
14
|
+
config.tty = true
|
7
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Venezia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.7'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: faraday
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +108,7 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '1.6'
|
97
|
-
description:
|
111
|
+
description: Ruby wrapper for the Slideshare API.
|
98
112
|
email:
|
99
113
|
- veneziajeremy@gmail.com
|
100
114
|
executables: []
|
@@ -111,7 +125,6 @@ files:
|
|
111
125
|
- lib/slideshare_api/client.rb
|
112
126
|
- lib/slideshare_api/model/slideshow.rb
|
113
127
|
- lib/slideshare_api/version.rb
|
114
|
-
- slideshare_api-0.0.1.gem
|
115
128
|
- slideshare_api.gemspec
|
116
129
|
- spec/client_spec.rb
|
117
130
|
- spec/fixtures/slideshow.xml
|
@@ -140,7 +153,7 @@ rubyforge_project:
|
|
140
153
|
rubygems_version: 2.2.2
|
141
154
|
signing_key:
|
142
155
|
specification_version: 4
|
143
|
-
summary:
|
156
|
+
summary: Ruby wrapper for the Slideshare API.
|
144
157
|
test_files:
|
145
158
|
- spec/client_spec.rb
|
146
159
|
- spec/fixtures/slideshow.xml
|
data/slideshare_api-0.0.1.gem
DELETED
Binary file
|