iframely 0.0.2 → 0.0.3

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: b10b42b4cfb1617beb31f872e31014532e32fe7f
4
- data.tar.gz: f0b06bc1f36bd9700339fddeeb9da96d6535a9a4
3
+ metadata.gz: 6d85ce6fb09a8b3f3d37a9afd8ebe76cb0e8a690
4
+ data.tar.gz: d6767ac4f0be24979004f084c3f34152511b46f3
5
5
  SHA512:
6
- metadata.gz: 225cfb8074185548f48fd82012dfb8be19e38ca3de6d61809d8b8521f0faa5b9ab73adee0e9796819fb7eca46bb1ccb4d9a0476ec177e08256f1450246a87f75
7
- data.tar.gz: 5c15a3ea52ac36197207af9da0b2baae8a525dffcc211df557bc8d0d87213e39aa1d7d936af78d60fca2a744e55e4c080cca10a80a0ac11054cc9cb147d00406
6
+ metadata.gz: a1b2d3a45ca1cf95bd7237aec31d8616d459d9d77c7adcf9d36c343b2f39e463cceeb07d984b120691eef7c1a324a99e572531b6f37ca95b66c801293ea65eaa
7
+ data.tar.gz: 7618adc31fc435ef1382aaf3342d49b31a0b8fc0990c568748d853d68257a74d6869649127c67f75bd39f517c515ae6f7e67c30f821918e4fbffa4c986a079f1
@@ -17,7 +17,7 @@ module Iframely
17
17
  @cache_options = cache_options
18
18
  end
19
19
 
20
- def get_iframely embed_url
20
+ def get_iframely_json embed_url
21
21
  fetch cache_key(:iframely, embed_url) do
22
22
  response = iframely_connection.get do |req|
23
23
  req.params['api_key'] = api_key
@@ -29,7 +29,7 @@ module Iframely
29
29
  end
30
30
 
31
31
  def get_iframely_model embed_url
32
- json = get_json embed_url
32
+ json = get_iframely_json embed_url
33
33
  if json.has_key? 'error'
34
34
  raise Iframely::Error, json['error']
35
35
  else
@@ -37,7 +37,7 @@ module Iframely
37
37
  end
38
38
  end
39
39
 
40
- def get_oembed embed_url
40
+ def get_oembed_json embed_url
41
41
  fetch cache_key(:oembed, embed_url) do
42
42
  response = oembed_connection.get do |req|
43
43
  req.params['api_key'] = api_key
@@ -52,7 +52,6 @@ module Iframely
52
52
 
53
53
  def cache_key type, url
54
54
  CACHE_KEY_PREFIX + type.to_s + ':' + url.to_s
55
- return CACHE_KEY_PREFIX
56
55
  end
57
56
 
58
57
  def fetch cache_key, &block
@@ -1,3 +1,3 @@
1
1
  module Iframely
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -3,23 +3,31 @@ require './test/test_helper'
3
3
  class IframelyRequesterTers < Minitest::Test
4
4
  API_KEY = 'some_key'
5
5
  EMBED_URL = 'some_url'
6
+ BODY = "{\n \"id\": \"g41eH1\",\n \"url\": \"http://www.youtube.com/embed/LG3oB2n0MU8\",\n \"meta\": {\n \"title\": \"Empire vs MVP.P, SLTV Lan Finals Day 1 Game 1\",\n \"date\": \"2014-04-17T16:37:31.000Z\",\n \"author\": \"dotasltv\",\n \"category\": \"Gaming\",\n \"description\": \"\xD0\x94\xD0\xB5\xD0\xB2\xD1\x8F\xD1\x82\xD1\x8B\xD0\xB9 \xD1\x81\xD0\xB5\xD0\xB7\xD0\xBE\xD0\xBD STARLADDER.TV \xD0\xB2 \xD1\x80\xD0\xB0\xD0\xB7\xD0\xB3\xD0\xB0\xD1\x80\xD0\xB5! \xD0\x9A\xD1\x83\xD0\xBF\xD0\xB8 \xD0\xB1\xD0\xB8\xD0\xBB\xD0\xB5\xD1\x82, \xD0\xBF\xD0\xBE\xD0\xB4\xD0\xB4\xD0\xB5\xD1\x80\xD0\xB6\xD0\xB8 \xD0\xBB\xD1\x8E\xD0\xB1\xD0\xB8\xD0\xBC\xD1\x8B\xD0\xB5 \xD0\xBA\xD0\xBE\xD0\xBC\xD0\xB0\xD0\xBD\xD0\xB4\xD1\x8B \xD0\xB8 \xD0\xBF\xD0\xBE\xD0\xBB\xD1\x83\xD1\x87\xD0\xB8 \xD1\x8D\xD0\xBA\xD1\x81\xD0\xBA\xD0\xBB\xD1\x8E\xD0\xB7\xD0\xB8\xD0\xB2\xD0\xBD\xD1\x8B\xD0\xB9 \xD1\x81\xD1\x8D\xD1\x82 \xD0\xBD\xD0\xB0 \xD0\x9B\xD0\xB8\xD1\x87\xD0\xB0, \xD0\xB0 \xD1\x82\xD0\xB0\xD0\xBA\xD0\xB6\xD0\xB5 \xD1\x83\xD0\xBD\xD0\xB8\xD0\xBA\xD0\xB0\xD0\xBB\xD1\x8C\xD0\xBD\xD1\x8B\xD0\xB9 Loading Screen.\\n\xD0\x9C\xD0\xB0\xD0\xB3\xD0\xB0\xD0\xB7\xD0\xB8\xD0\xBD \xD0\xB7\xD0\xB0 \xD1\x83\xD0\xB3\xD0\xBB\xD0\xBE\xD0\xBC \xE2\x86\x92 http://www.dota2.com/store/itemdetails/20417\\n\xE2\x80\x94\\n\xD0\x91\xD1\x83\xD0\xB4\xD1\x8C\xD1\x82\xD0\xB5 \xD0\xB2 \xD0\xBA\xD1\x83\xD1\x80\xD1\x81\xD0\xB5 \xD0\xB2\xD1\x81\xD0\xB5\xD1\x85 \xD0\xBF\xD0\xBE\xD1\x81\xD0\xBB\xD0\xB5\xD0\xB4\xD0\xBD\xD0\xB8\xD1\x85 \xD1\x81\xD0\xBE\xD0\xB1\xD1\x8B\xD1\x82\xD0\xB8\xD0\xB9 \xD0\xBD\xD0\xB0\xD1\x88\xD0\xB5\xD0\xB9 \xD0\xBB\xD0\xB8\xD0\xB3\xD0\xB8!\\nhttp://dota2.starladder.tv \\nhttp://vk.com/dotastarladder\\nhttp://facebook.com/dotasltv\\nhttp://twitter.com/dotasltv\\nhttp://twitch.tv/starladder1/new\",\n \"duration\": \"4642\",\n \"likes\": \"303\",\n \"views\": \"33476\",\n \"site\": \"YouTube\"\n },\n \"links\": {\n \"player\": [\n {\n \"href\": \"https://www.youtube.com/embed/LG3oB2n0MU8?wmode=transparent&rel=0&autohide=1&showinfo=0&enablejsapi=1\",\n \"rel\": [\n \"player\",\n \"html5\"\n ],\n \"type\": \"text/html\",\n \"media\": {\n \"aspect-ratio\": 1.778\n }\n }\n ],\n \"thumbnail\": [\n {\n \"href\": \"https://i1.ytimg.com/vi/LG3oB2n0MU8/mqdefault.jpg\",\n \"rel\": [\n \"thumbnail\"\n ],\n \"type\": \"image/jpeg\",\n \"media\": {\n \"width\": 320,\n \"height\": 180\n }\n },\n {\n \"href\": \"https://i1.ytimg.com/vi/LG3oB2n0MU8/maxresdefault.jpg\",\n \"rel\": [\n \"thumbnail\"\n ],\n \"type\": \"image/jpeg\",\n \"media\": {\n \"width\": 1280,\n \"height\": 720\n }\n }\n ],\n \"icon\": [\n {\n \"href\": \"https://s.ytimg.com/yts/img/favicon_32-vflWoMFGx.png\",\n \"type\": \"image/png\",\n \"rel\": [\n \"icon\"\n ],\n \"media\": {\n \"width\": 32,\n \"height\": 32\n }\n }\n ]\n },\n \"html\": \"<div style=\\\"left: 0px; width: 100%; height: 0px; position: relative; padding-bottom: 56.243%;\\\"><iframe src=\\\"//iframe.ly/g41eH1\\\" frameborder=\\\"0\\\" allowfullscreen=\\\"true\\\" webkitallowfullscreen=\\\"true\\\" mozallowfullscreen=\\\"true\\\" style=\\\"top: 0px; left: 0px; width: 100%; height: 100%; position: absolute;\\\"></iframe></div>\"\n}"
6
7
 
7
8
  def setup
8
9
  @iframely = Iframely::Requester.new api_key: API_KEY
9
10
  end
10
11
 
11
- def test_request_json
12
+ def test_request_iframely_json
12
13
  stub_request(:get, Iframely::IFRAMELY_API_URL + "?api_key=some_key&url=some_url").
13
- to_return(:status => 200, :body => "{}")
14
+ to_return(:status => 200, :body => BODY)
15
+
16
+ @iframely.get_iframely_json EMBED_URL
17
+ end
18
+
19
+ def test_request_iframely_model
20
+ stub_request(:get, Iframely::IFRAMELY_API_URL + "?api_key=some_key&url=some_url").
21
+ to_return(:status => 200, :body => BODY)
14
22
 
15
- @iframely.get_iframely EMBED_URL
23
+ @iframely.get_iframely_model EMBED_URL
16
24
  end
17
25
 
18
- def test_request_oembed
26
+ def test_request_oembed_json
19
27
  stub_request(:get, Iframely::OEMBED_API_URL + "?api_key=some_key&url=some_url").
20
28
  to_return(:status => 200, :body => "{}")
21
29
 
22
- @iframely.get_oembed EMBED_URL
30
+ @iframely.get_oembed_json EMBED_URL
23
31
  end
24
32
 
25
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iframely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danil Pismenny