onebox 1.8.13 → 1.8.14

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: 881354a49c26f3ff8f7f96286bfda2f1fe313cf5
4
- data.tar.gz: ff63ab334806ad83ba234af67d29eff74a40c0b2
3
+ metadata.gz: 4f00805e5c613840f9f98fefcb90c73d6d51b7f8
4
+ data.tar.gz: e792fae938aa9941c43b9dc2e777bc9989e5a1ff
5
5
  SHA512:
6
- metadata.gz: c7ce9b381f54dfa5c1ae033ee67c7c824a026b2eedb91e7569668e105745dc0e1158a683baeb5582850c79016c0d0f3178c17d155fa3eea3d2b9334f8fc70e5e
7
- data.tar.gz: 4099701a95bc9eb0c7a5d39df03f062f794f81c63aeb69ec96b489f193d3034e4d270dabeedbcc00972cbfd919b05f703fdb1f5b3303707a49cc80da7e24e7a4
6
+ metadata.gz: fac489547c2fe0b742a73e079976ce2ced75fbc700c52136b24406ab6765d8157ee02bb25ce64c2a6fbaa8d674163f4f998212ad5a4dd1628ebae5c705aad3b2
7
+ data.tar.gz: d1ab7cae2d6fee5348f161b50936fa4d7fbb64ba3ff607a58640751160c0294de5f29d4a45b31e1881f42450a83fae3dba354b5d484a924bc4724a9dd7b9fe94
data/lib/onebox/engine.rb CHANGED
@@ -180,3 +180,4 @@ require_relative "engine/pdf_onebox"
180
180
  require_relative "engine/twitch_clips_onebox"
181
181
  require_relative "engine/twitch_stream_onebox"
182
182
  require_relative "engine/twitch_video_onebox"
183
+ require_relative "engine/trello_onebox"
@@ -119,7 +119,8 @@ module Onebox
119
119
 
120
120
  when :canonical
121
121
  uri = URI(@url)
122
- query = Hash[*uri.query.split("&").map{|a|a.split("=")}.flatten]
122
+
123
+ query = URI::decode_www_form(uri.query).to_h
123
124
  if !query.has_key?("ll")
124
125
  raise ArgumentError, "canonical url lacks location argument" unless query.has_key?("sll")
125
126
  query["ll"] = query["sll"]
@@ -0,0 +1,30 @@
1
+ module Onebox
2
+ module Engine
3
+ class TrelloOnebox
4
+ include Engine
5
+ include StandardEmbed
6
+
7
+ matches_regexp(/^https:\/\/trello\.com\/[bc]\/\W*/)
8
+ always_https
9
+
10
+ def to_html
11
+ link = "https://trello.com/#{match[:type]}/#{match[:key]}.html"
12
+
13
+ height = match[:type] == 'b' ? 400 : 200
14
+
15
+ <<-HTML
16
+ <iframe src=\"#{link}\" width=\"100%\" height=\"#{height}\" frameborder=\"0\" style=\"border:0\"></iframe>
17
+ HTML
18
+ end
19
+
20
+ private
21
+ def match
22
+ return @match if @match
23
+
24
+ @match = @url.match(%{trello\.com/(?<type>[^/]+)/(?<key>[^/]+)/?\W*})
25
+
26
+ @match
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.8.13"
2
+ VERSION = "1.8.14"
3
3
  end
@@ -0,0 +1,30 @@
1
+ require "spec_helper"
2
+
3
+ describe Onebox::Engine::TrelloOnebox do
4
+ context "Boards" do
5
+ it "should onebox with SEF url corrrectly" do
6
+ expect(Onebox.preview('https://trello.com/b/nC8QJJoZ/trello-development-roadmap').to_s).to match('iframe src="https://trello.com/b/nC8QJJoZ.html"')
7
+ end
8
+
9
+ it "should onebox without SEF url corrrectly" do
10
+ expect(Onebox.preview('https://trello.com/b/nC8QJJoZ/').to_s).to match('iframe src="https://trello.com/b/nC8QJJoZ.html"')
11
+
12
+ # Without trailing slash
13
+ expect(Onebox.preview('https://trello.com/b/nC8QJJoZ').to_s).to match('iframe src="https://trello.com/b/nC8QJJoZ.html"')
14
+ end
15
+ end
16
+
17
+ context "Cards" do
18
+ it "should onebox with SEF url corrrectly" do
19
+ expect(Onebox.preview('https://trello.com/c/NIRpzVDM/1211-what-can-you-expect-from-this-board').to_s).to match('iframe src="https://trello.com/c/NIRpzVDM.html"')
20
+ end
21
+
22
+ it "should onebox without SEF url corrrectly" do
23
+ expect(Onebox.preview('https://trello.com/c/NIRpzVDM/').to_s).to match('iframe src="https://trello.com/c/NIRpzVDM.html"')
24
+
25
+ # Without trailing slash
26
+ expect(Onebox.preview('https://trello.com/c/NIRpzVDM').to_s).to match('iframe src="https://trello.com/c/NIRpzVDM.html"')
27
+ end
28
+ end
29
+
30
+ end
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.8.13
4
+ version: 1.8.14
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: 2017-06-22 00:00:00.000000000 Z
13
+ date: 2017-07-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -365,6 +365,7 @@ files:
365
365
  - lib/onebox/engine/stack_exchange_onebox.rb
366
366
  - lib/onebox/engine/standard_embed.rb
367
367
  - lib/onebox/engine/steam_store_onebox.rb
368
+ - lib/onebox/engine/trello_onebox.rb
368
369
  - lib/onebox/engine/twitch_clips_onebox.rb
369
370
  - lib/onebox/engine/twitch_stream_onebox.rb
370
371
  - lib/onebox/engine/twitch_video_onebox.rb
@@ -443,6 +444,7 @@ files:
443
444
  - spec/lib/onebox/engine/pubmed_onebox_spec.rb
444
445
  - spec/lib/onebox/engine/slides_onebox_spec.rb
445
446
  - spec/lib/onebox/engine/stack_exchange_onebox_spec.rb
447
+ - spec/lib/onebox/engine/trello_onebox_spec.rb
446
448
  - spec/lib/onebox/engine/twitch_clips_onebox_spec.rb
447
449
  - spec/lib/onebox/engine/twitch_stream_onebox_spec.rb
448
450
  - spec/lib/onebox/engine/twitch_video_onebox_spec.rb
@@ -563,6 +565,7 @@ test_files:
563
565
  - spec/lib/onebox/engine/pubmed_onebox_spec.rb
564
566
  - spec/lib/onebox/engine/slides_onebox_spec.rb
565
567
  - spec/lib/onebox/engine/stack_exchange_onebox_spec.rb
568
+ - spec/lib/onebox/engine/trello_onebox_spec.rb
566
569
  - spec/lib/onebox/engine/twitch_clips_onebox_spec.rb
567
570
  - spec/lib/onebox/engine/twitch_stream_onebox_spec.rb
568
571
  - spec/lib/onebox/engine/twitch_video_onebox_spec.rb