slideshare_api 0.0.6 → 0.0.7
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/README.md +20 -2
- data/lib/slideshare_api/client.rb +29 -6
- data/lib/slideshare_api/version.rb +1 -1
- data/spec/client_spec.rb +52 -0
- data/spec/fixtures/slideshows.xml +68 -0
- 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: 497ca141ee3192469f5725420b1a827dcd81ab0b
|
|
4
|
+
data.tar.gz: 55c5d07bc04b62ed921b458dfce531692d0c72fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e7176c421b163f99edee739e4b26e1f02400dabd58add23fad12c00a21755bce2c45319bc9e696e3e6587113a294259ff77593a3cecce97c10d76261bd2deab
|
|
7
|
+
data.tar.gz: c352950eb94d6bfd62d64167c09f24fabe537967d67a11fd34ca6cab4c1142fa884cb79fad70bb2286ac411adeddbc4d6a4ae1c1f9ad11539fd1e326f7a17eee
|
data/README.md
CHANGED
|
@@ -33,17 +33,35 @@ client = SlideshareApi::Client.new api_key, shared_secret
|
|
|
33
33
|
Get a slideshow:
|
|
34
34
|
```ruby
|
|
35
35
|
# from url...
|
|
36
|
-
slideshow_url = 'http://fr.slideshare.net/
|
|
36
|
+
slideshow_url = 'http://fr.slideshare.net/awesome/slideshow'
|
|
37
37
|
slideshow = client.slideshow(slideshow_url: slideshow_url) #=> returns a SlideshareApi::Model::Slideshow
|
|
38
38
|
|
|
39
39
|
# from id...
|
|
40
40
|
slideshow_id = '1234'
|
|
41
41
|
slideshow = client.slideshow(slideshow_id: slideshow_id) #=> returns a SlideshareApi::Model::Slideshow
|
|
42
42
|
|
|
43
|
-
# with optional
|
|
43
|
+
# with optional data...
|
|
44
44
|
slideshow = client.slideshow(slideshow_id: slideshow_id, detailed: true) #=> returns a SlideshareApi::Model::Slideshow
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
Get slideshows:
|
|
48
|
+
```ruby
|
|
49
|
+
# by tag...
|
|
50
|
+
tag = 'ruby'
|
|
51
|
+
slideshow = client.slideshows(tag: tag) #=> returns an array of SlideshareApi::Model::Slideshow
|
|
52
|
+
|
|
53
|
+
# by group...
|
|
54
|
+
group = 'group'
|
|
55
|
+
slideshow = client.slideshows(group: group) #=> returns an array of SlideshareApi::Model::Slideshow
|
|
56
|
+
|
|
57
|
+
# by user...
|
|
58
|
+
user = 'username'
|
|
59
|
+
slideshow = client.slideshows(user: user) #=> returns an array of SlideshareApi::Model::Slideshow
|
|
60
|
+
|
|
61
|
+
# with optional data...
|
|
62
|
+
slideshow = client.slideshows(user: user, detailed: true) #=> returns an array of SlideshareApi::Model::Slideshow
|
|
63
|
+
```
|
|
64
|
+
|
|
47
65
|
## Contributing
|
|
48
66
|
Feel free to contribute!
|
|
49
67
|
|
|
@@ -17,16 +17,39 @@ module SlideshareApi
|
|
|
17
17
|
|
|
18
18
|
def slideshow(options = {})
|
|
19
19
|
params = {}
|
|
20
|
-
params.merge!(
|
|
21
|
-
params.merge!(
|
|
22
|
-
params.merge!(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
params.merge!(slideshow_url: cleaned_url(options[:slideshow_url])) if options[:slideshow_url]
|
|
21
|
+
params.merge!(slideshow_id: options[:slideshow_id]) if options[:slideshow_id]
|
|
22
|
+
params.merge!(detailed: 1) if options[:detailed]
|
|
23
|
+
SlideshareApi::Model::Slideshow.new get('get_slideshow', params)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def slideshows(options = {})
|
|
27
|
+
params = {}
|
|
28
|
+
if options[:tag]
|
|
29
|
+
params.merge!(tag: options[:tag])
|
|
30
|
+
path = 'get_slideshows_by_tag'
|
|
31
|
+
elsif options[:group]
|
|
32
|
+
params.merge!(group_name: options[:group])
|
|
33
|
+
path = 'get_slideshows_by_group'
|
|
34
|
+
elsif options[:user]
|
|
35
|
+
params.merge!(username_for: options[:user])
|
|
36
|
+
path = 'get_slideshows_by_user'
|
|
37
|
+
else
|
|
38
|
+
raise SlideshareApi::Error, 'Required Parameter Missing'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
params.merge!(detailed: 1) if options[:detailed]
|
|
42
|
+
get(path, params).search('Slideshow').map { |s| SlideshareApi::Model::Slideshow.new(s) }
|
|
26
43
|
end
|
|
27
44
|
|
|
28
45
|
private
|
|
29
46
|
|
|
47
|
+
def get(path, params)
|
|
48
|
+
xml_response = Nokogiri::XML(@connection.get(path, api_validation_params.merge(params)).body)
|
|
49
|
+
check_error xml_response
|
|
50
|
+
xml_response
|
|
51
|
+
end
|
|
52
|
+
|
|
30
53
|
def cleaned_url(url)
|
|
31
54
|
url.split('?')[0]
|
|
32
55
|
end
|
data/spec/client_spec.rb
CHANGED
|
@@ -65,4 +65,56 @@ describe SlideshareApi::Client do
|
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
|
+
|
|
69
|
+
describe 'slideshows' do
|
|
70
|
+
context 'there is an error' do
|
|
71
|
+
context 'there is a param' do
|
|
72
|
+
let(:error_xml) { open('spec/fixtures/error.xml').read }
|
|
73
|
+
|
|
74
|
+
before { expect(connection).to receive(:get).and_return(connection) }
|
|
75
|
+
before { expect(connection).to receive(:body).and_return(error_xml) }
|
|
76
|
+
|
|
77
|
+
it { expect(-> { slideshare_client.slideshows user: '' }).to raise_error(SlideshareApi::Error) }
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
context 'param is missing' do
|
|
81
|
+
it { expect(-> { slideshare_client.slideshows }).to raise_error(SlideshareApi::Error) }
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
context 'there is no error' do
|
|
86
|
+
let(:slideshows_raw_xml) { open('spec/fixtures/slideshows.xml').read }
|
|
87
|
+
before { expect(connection).to receive(:body).and_return(slideshows_raw_xml) }
|
|
88
|
+
|
|
89
|
+
context 'by tag' do
|
|
90
|
+
let(:tag) { 'ruby' }
|
|
91
|
+
|
|
92
|
+
before { expect(connection).to receive(:get).with('get_slideshows_by_tag', api_validation_params.merge({tag: tag})).and_return(connection) }
|
|
93
|
+
|
|
94
|
+
subject { slideshare_client.slideshows tag: tag }
|
|
95
|
+
|
|
96
|
+
it { should eql? Nokogiri::XML(slideshows_raw_xml).search('Slideshow').map { |s| SlideshareApi::Model::Slideshow.new(s) } }
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
context 'by group' do
|
|
100
|
+
let(:group) { 'group' }
|
|
101
|
+
|
|
102
|
+
before { expect(connection).to receive(:get).with('get_slideshows_by_group', api_validation_params.merge({group_name: group})).and_return(connection) }
|
|
103
|
+
|
|
104
|
+
subject { slideshare_client.slideshows group: group }
|
|
105
|
+
|
|
106
|
+
it { should eql? Nokogiri::XML(slideshows_raw_xml).search('Slideshow').map { |s| SlideshareApi::Model::Slideshow.new(s) } }
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
context 'by user' do
|
|
110
|
+
let(:user) { 'jeremyvenezia' }
|
|
111
|
+
|
|
112
|
+
before { expect(connection).to receive(:get).with('get_slideshows_by_user', api_validation_params.merge({username_for: user})).and_return(connection) }
|
|
113
|
+
|
|
114
|
+
subject { slideshare_client.slideshows user: user }
|
|
115
|
+
|
|
116
|
+
it { should eql? Nokogiri::XML(slideshows_raw_xml).search('Slideshow').map { |s| SlideshareApi::Model::Slideshow.new(s) } }
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
68
120
|
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<User>
|
|
2
|
+
<Name>jeremyvenezia</Name>
|
|
3
|
+
<Count>2</Count>
|
|
4
|
+
<Slideshow>
|
|
5
|
+
<ID>34187090</ID>
|
|
6
|
+
<Title>Prerequis pour appliquer le Lean Startup en entreprise</Title>
|
|
7
|
+
<Description/>
|
|
8
|
+
<Status>2</Status>
|
|
9
|
+
<Username>jeremyvenezia</Username>
|
|
10
|
+
<URL>http://www.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise</URL>
|
|
11
|
+
<ThumbnailURL>
|
|
12
|
+
//cdn.slidesharecdn.com/ss_thumbnails/prerequispourappliquerleleanstartupdanslentreprise-140430023146-phpapp02-140501195007-phpapp01-thumbnail.jpg?cb=1398991939
|
|
13
|
+
</ThumbnailURL>
|
|
14
|
+
<ThumbnailSize>[170,130]</ThumbnailSize>
|
|
15
|
+
<ThumbnailSmallURL>
|
|
16
|
+
//cdn.slidesharecdn.com/ss_thumbnails/prerequispourappliquerleleanstartupdanslentreprise-140430023146-phpapp02-140501195007-phpapp01-thumbnail-2.jpg?cb=1398991939
|
|
17
|
+
</ThumbnailSmallURL>
|
|
18
|
+
<Embed><iframe src="https://www.slideshare.net/slideshow/embed_code/34187090" width="427" height="356"
|
|
19
|
+
frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px;
|
|
20
|
+
margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px">
|
|
21
|
+
<strong> <a
|
|
22
|
+
href="https://www.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise"
|
|
23
|
+
title="Prerequis pour appliquer le Lean Startup en entreprise" target="_blank">Prerequis pour appliquer le Lean
|
|
24
|
+
Startup en entreprise</a> </strong> from <strong><a
|
|
25
|
+
href="http://www.slideshare.net/jeremyvenezia" target="_blank">Jeremy Venezia</a></strong> </div>
|
|
26
|
+
|
|
27
|
+
</Embed>
|
|
28
|
+
<Created>2014-05-02 00:50:06 UTC</Created>
|
|
29
|
+
<Updated>2014-05-02 00:52:19 UTC</Updated>
|
|
30
|
+
<Language>fr</Language>
|
|
31
|
+
<Format>pptx</Format>
|
|
32
|
+
<Download>0</Download>
|
|
33
|
+
<SlideshowType>0</SlideshowType>
|
|
34
|
+
<InContest>0</InContest>
|
|
35
|
+
</Slideshow>
|
|
36
|
+
<Slideshow>
|
|
37
|
+
<ID>34187074</ID>
|
|
38
|
+
<Title>Un an dans la peau d&rsquo;une équipe Lean Startup chez OCTO Technology</Title>
|
|
39
|
+
<Description/>
|
|
40
|
+
<Status>2</Status>
|
|
41
|
+
<Username>jeremyvenezia</Username>
|
|
42
|
+
<URL>http://www.slideshare.net/jeremyvenezia/un-an-dans-la-peau-dune-quipe-lean-startup-chez-octo-technology</URL>
|
|
43
|
+
<ThumbnailURL>
|
|
44
|
+
//cdn.slidesharecdn.com/ss_thumbnails/unandanslapeauduneequipeleanstartupchezocto-140430045943-phpapp01-140501194919-phpapp02-thumbnail.jpg?cb=1398992057
|
|
45
|
+
</ThumbnailURL>
|
|
46
|
+
<ThumbnailSize>[170,130]</ThumbnailSize>
|
|
47
|
+
<ThumbnailSmallURL>
|
|
48
|
+
//cdn.slidesharecdn.com/ss_thumbnails/unandanslapeauduneequipeleanstartupchezocto-140430045943-phpapp01-140501194919-phpapp02-thumbnail-2.jpg?cb=1398992057
|
|
49
|
+
</ThumbnailSmallURL>
|
|
50
|
+
<Embed><iframe src="https://www.slideshare.net/slideshow/embed_code/34187074" width="427" height="356"
|
|
51
|
+
frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px;
|
|
52
|
+
margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px">
|
|
53
|
+
<strong> <a
|
|
54
|
+
href="https://www.slideshare.net/jeremyvenezia/un-an-dans-la-peau-dune-quipe-lean-startup-chez-octo-technology"
|
|
55
|
+
title="Un an dans la peau d&#x27;une équipe Lean Startup chez OCTO Technology" target="_blank">Un an dans
|
|
56
|
+
la peau d&#x27;une équipe Lean Startup chez OCTO Technology</a> </strong> from <strong><a
|
|
57
|
+
href="http://www.slideshare.net/jeremyvenezia" target="_blank">Jeremy Venezia</a></strong> </div>
|
|
58
|
+
|
|
59
|
+
</Embed>
|
|
60
|
+
<Created>2014-05-02 00:49:19 UTC</Created>
|
|
61
|
+
<Updated>2014-05-02 00:54:17 UTC</Updated>
|
|
62
|
+
<Language>fr</Language>
|
|
63
|
+
<Format>pptx</Format>
|
|
64
|
+
<Download>0</Download>
|
|
65
|
+
<SlideshowType>0</SlideshowType>
|
|
66
|
+
<InContest>0</InContest>
|
|
67
|
+
</Slideshow>
|
|
68
|
+
</User>
|
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.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Venezia
|
|
@@ -131,6 +131,7 @@ files:
|
|
|
131
131
|
- spec/fixtures/error.xml
|
|
132
132
|
- spec/fixtures/slideshow.xml
|
|
133
133
|
- spec/fixtures/slideshow_detailed.xml
|
|
134
|
+
- spec/fixtures/slideshows.xml
|
|
134
135
|
- spec/model/slideshow_spec.rb
|
|
135
136
|
- spec/spec_helper.rb
|
|
136
137
|
homepage: https://github.com/jvenezia/slideshare_api
|
|
@@ -162,5 +163,6 @@ test_files:
|
|
|
162
163
|
- spec/fixtures/error.xml
|
|
163
164
|
- spec/fixtures/slideshow.xml
|
|
164
165
|
- spec/fixtures/slideshow_detailed.xml
|
|
166
|
+
- spec/fixtures/slideshows.xml
|
|
165
167
|
- spec/model/slideshow_spec.rb
|
|
166
168
|
- spec/spec_helper.rb
|