slideshare_api 0.0.4 → 0.0.5

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: 63dba4aeab650366a2a5d89c7a150bf294841f0c
4
- data.tar.gz: 5abdd7c7222d6e350040a39b2440d6a2664d8b5a
3
+ metadata.gz: 12b16a7b8fd697bcf195e1f8d5909b3a46b41dc8
4
+ data.tar.gz: 6005c7902fa67bd5bc58920f44c849f8ea34e912
5
5
  SHA512:
6
- metadata.gz: 5031fd4b932932dd96ec8a81a06b98de66624a3dcdd8bfb8c205fbd9d11d76fcb80754c29cf6da8816e032a4e210a9783284523daec2002806ca45788e08146d
7
- data.tar.gz: 8845fc91dc22218c6c494d368163f7bea082aaf65ab7a737b05ded7bcc30351daeb611ce2f935193b84bf006602438db46f23cdee0588a7fdf92d70e76e30329
6
+ metadata.gz: d59ca225e637d18aeeaeb1f5bda7ff39cb6881731f6efd657d9b86c28d1033d99f29c5862d9ecde3fb28c602ef331e707cab603c705328cadddebb9b31345df4
7
+ data.tar.gz: 546739411465c909ba600afd6cc17905ea57f571629cca33948b58cf0a8e913c18c9a5a95ca0c5b53c5320ae46200680194fbd0334a71d573cefdd4d13f1fc88
@@ -17,7 +17,7 @@ module SlideshareApi
17
17
 
18
18
  def slideshow(options = {})
19
19
  params = {}
20
- params.merge!({slideshow_url: options[:slideshow_url]}) if options[:slideshow_url]
20
+ params.merge!({slideshow_url: cleaned_url(options[:slideshow_url])}) if options[:slideshow_url]
21
21
  params.merge!({slideshow_id: options[:slideshow_id]}) if options[:slideshow_id]
22
22
  params.merge!({detailed: 1}) if options[:detailed]
23
23
  SlideshareApi::Model::Slideshow.new Nokogiri::XML(@connection.get('get_slideshow', api_validation_params.merge(params)).body)
@@ -25,6 +25,10 @@ module SlideshareApi
25
25
 
26
26
  private
27
27
 
28
+ def cleaned_url(url)
29
+ url.split('?')[0]
30
+ end
31
+
28
32
  def build_connection
29
33
  @connection = Faraday.new(url: SLIDESHARE_API_URL) do |faraday|
30
34
  faraday.request :json
@@ -1,3 +1,3 @@
1
1
  module SlideshareApi
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -23,13 +23,26 @@ describe SlideshareApi::Client do
23
23
  before { expect(connection).to receive(:body).and_return(slideshow_raw_xml) }
24
24
 
25
25
  context 'get from slideshow url' do
26
- let(:slideshow_url) { 'http://fr.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise' }
26
+ context 'url has params' do
27
+ let(:slideshow_url_with_params) { 'http://fr.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise?ref=http://fr.slideshare.net/?ss' }
28
+ let(:slideshow_url) { 'http://fr.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise' }
27
29
 
28
- before { expect(connection).to receive(:get).with('get_slideshow', api_validation_params.merge({slideshow_url: slideshow_url})).and_return(connection) }
30
+ before { expect(connection).to receive(:get).with('get_slideshow', api_validation_params.merge({slideshow_url: slideshow_url})).and_return(connection) }
29
31
 
30
- subject { slideshare_client.slideshow slideshow_url: slideshow_url }
32
+ subject { slideshare_client.slideshow slideshow_url: slideshow_url_with_params }
31
33
 
32
- it { should eql? SlideshareApi::Model::Slideshow.new(Nokogiri::XML(slideshow_raw_xml)) }
34
+ it { should eql? SlideshareApi::Model::Slideshow.new(Nokogiri::XML(slideshow_raw_xml)) }
35
+ end
36
+
37
+ context 'url has no params' do
38
+ let(:slideshow_url) { 'http://fr.slideshare.net/jeremyvenezia/prerequis-pour-appliquer-le-lean-startup-en-entreprise' }
39
+
40
+ before { expect(connection).to receive(:get).with('get_slideshow', api_validation_params.merge({slideshow_url: slideshow_url})).and_return(connection) }
41
+
42
+ subject { slideshare_client.slideshow slideshow_url: slideshow_url }
43
+
44
+ it { should eql? SlideshareApi::Model::Slideshow.new(Nokogiri::XML(slideshow_raw_xml)) }
45
+ end
33
46
  end
34
47
 
35
48
  context 'get from slideshow id' do
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
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Venezia