onebox 1.5.18 → 1.5.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1ad782f96ff776d0d2266234a1a35c728fda673
4
- data.tar.gz: f6f790cb45621ec73844872684e855de29142484
3
+ metadata.gz: 1251f4223fba52393994afd37464bd4871ca7d50
4
+ data.tar.gz: 8d08a396a69afd7444ed606b680f62455b9ca772
5
5
  SHA512:
6
- metadata.gz: f5fccca33ea465d18f16ccd6d277f96065a07c20c9d807efdd7e59e85f28c8846267cea1f8ea763f0c909f8395eb8ba01d5c2f2f22250c18587879762e520f83
7
- data.tar.gz: e3b611db4ce5d131643102aa3642047a092ca0f16223329a367f02c4407c075fc9af1ab2949098fb7162c79c558a3e60d7c3455ce21675c62599602b9399d089
6
+ metadata.gz: 45b4ac31ab8c0d9d8f27e4b2a05ac356e03138631ddf3a357fa1a38ada58ff9178ea07b8893ac364beb2206331d6b5a8d53cba19f69531a7bb0e6284f6e0ff0e
7
+ data.tar.gz: 9161833850d7f2ef5434866c13900203f8d91efc3b62f93988e852184d1a265f4171bac87ba466a77fc324bcd3b26db056f18de5162dbf925314e2e81f518e9b
data/lib/onebox/engine.rb CHANGED
@@ -143,3 +143,4 @@ require_relative "engine/youku_onebox"
143
143
  require_relative "engine/douban_onebox"
144
144
  require_relative "engine/whitelisted_generic_onebox"
145
145
  require_relative "engine/pubmed_onebox"
146
+ require_relative "engine/soundcloud_onebox"
@@ -0,0 +1,24 @@
1
+ module Onebox
2
+ module Engine
3
+ class SoundCloudOnebox
4
+ include Engine
5
+ include StandardEmbed
6
+
7
+ matches_regexp(/^https?:\/\/.*soundcloud\.com/)
8
+
9
+ def to_html
10
+ get_oembed_data[:html].gsub!('height="400"', 'height="250"')
11
+ end
12
+
13
+ def placeholder_html
14
+ "<img src='#{get_oembed_data[:thumbnail_url]}'>"
15
+ end
16
+
17
+ private
18
+
19
+ def get_oembed_data
20
+ Onebox::Helpers.symbolize_keys(::MultiJson.load(Onebox::Helpers.fetch_response("http://soundcloud.com/oembed.json?url=#{url}").body))
21
+ end
22
+ end
23
+ end
24
+ end
@@ -18,7 +18,7 @@ module Onebox
18
18
  end
19
19
 
20
20
  def raw
21
- if client
21
+ if client && !client.twitter_credentials_missing?
22
22
  @raw ||= OpenStruct.new(client.status(match[:id]).to_hash)
23
23
  else
24
24
  super
@@ -91,7 +91,6 @@ module Onebox
91
91
  screenr.com
92
92
  scribd.com
93
93
  slideshare.net
94
- soundcloud.com
95
94
  sourceforge.net
96
95
  speakerdeck.com
97
96
  spotify.com
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.5.18"
2
+ VERSION = "1.5.19"
3
3
  end
@@ -94,6 +94,9 @@ describe Onebox::Engine::TwitterStatusOnebox do
94
94
  allow(@twitter_client).to receive("prettify_tweet") do
95
95
  "I'm a sucker for pledges. <a href='https://twitter.com/Peers' target='_blank'>@Peers</a> Pledge <a href='https://twitter.com/search?q=%23sharingeconomy' target='_blank'>#sharingeconomy</a> <a target='_blank' href='http://www.peers.org/action/peers-pledgea/'>peers.org/action/peers-p…</a>"
96
96
  end
97
+ allow(@twitter_client).to receive("twitter_credentials_missing?") do
98
+ false
99
+ end
97
100
  Onebox.options = { twitter_client: @twitter_client }
98
101
  end
99
102
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.18
4
+ version: 1.5.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-05-08 00:00:00.000000000 Z
13
+ date: 2015-05-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -301,6 +301,7 @@ files:
301
301
  - lib/onebox/engine/image_onebox.rb
302
302
  - lib/onebox/engine/json.rb
303
303
  - lib/onebox/engine/pubmed_onebox.rb
304
+ - lib/onebox/engine/soundcloud_onebox.rb
304
305
  - lib/onebox/engine/stack_exchange_onebox.rb
305
306
  - lib/onebox/engine/standard_embed.rb
306
307
  - lib/onebox/engine/twitter_status_onebox.rb