lumiere 0.0.4 → 0.0.6

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: e20f4a873d50e02f09619cd156bf79f2cc7cefb8
4
- data.tar.gz: 7f7fe10f03c200211d4076111112d3c569112033
3
+ metadata.gz: 402cdd95d8d122a17a2e90b334738289cd92effb
4
+ data.tar.gz: 629b0493becd5354a9c658924b5ef40b8a458cd9
5
5
  SHA512:
6
- metadata.gz: bfd62f901fd6c5216bcf70309604cb5c6c8f614f56d564f61be3aec64b1b89f0dbc5f273f259b8ae7fbfb2c285d42387601babe28cf6f8c25fd2995841179426
7
- data.tar.gz: afe0be0945ea5f3eeac4c355041ffc821bb1cf44bdba6d7da7c449e92b80f5b0f9b345af132bd6a1c24a495ee751773f06b9196754169f1a51369f18e3b336cf
6
+ metadata.gz: ecd9905276cb5351e1fbadeae11e603226ea0f3df2c10b7ba6863735efdc2f505ee9bbfdbb39409fb8591ae4341294b5236e5a61807cfb9948558a92cd5547dd
7
+ data.tar.gz: a090003bbe50f509df7a74059dd19a01315c659080874d384c67ab392d9ccbd79973f3b28f95c6fafef7c4989bb53b5d173834dbe6f85714c7d0f95aa33d2e19
@@ -1,3 +1,3 @@
1
1
  module Lumiere
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/lumiere.rb CHANGED
@@ -18,6 +18,7 @@ class Elluminate
18
18
  @provider ||= Lumiere::Provider.delegate(url)
19
19
  end
20
20
 
21
+ def_delegators :@provider, :video_id, :playlist_id
21
22
  def_delegators :@provider, :provider, :upload_date
22
23
  def_delegators :@provider, :title, :description, :duration
23
24
  def_delegators :@provider, :thumbnail_small, :thumbnail_medium, :thumbnail_large
@@ -6,7 +6,7 @@ class Vimeo < Provider
6
6
 
7
7
  def self.useable?(url)
8
8
  uri = URISchemeless.parse(url)
9
- USEABLE.include?(uri.host.to_s)
9
+ USEABLE.include?(uri.host)
10
10
  end
11
11
 
12
12
  def initialize(url)
@@ -1,8 +1,6 @@
1
1
  module Lumiere
2
2
  module YouTubeVideoRepresenter
3
3
  include Representable::JSON
4
- self.representation_wrap = :entry
5
-
6
4
  nested 'title' do
7
5
  property :title, as: '$t'
8
6
  end
@@ -13,6 +11,10 @@ module Lumiere
13
11
  end
14
12
 
15
13
  nested 'media$group' do
14
+ nested 'yt$videoid' do
15
+ property :video_id, as: '$t'
16
+ end
17
+
16
18
  nested 'media$description' do
17
19
  property :description, as: '$t'
18
20
  end
@@ -27,4 +29,12 @@ module Lumiere
27
29
  end
28
30
  end
29
31
  end
32
+
33
+ module YouTubeVideoEntryRepresenter
34
+ include Representable::JSON
35
+ nested 'entry' do
36
+ include YouTubeVideoRepresenter
37
+ end
38
+ end
39
+
30
40
  end
@@ -6,14 +6,14 @@ class YouTube < Provider
6
6
 
7
7
  def self.useable?(url)
8
8
  uri = URISchemeless.parse(url)
9
- USEABLE.include?(uri.host.to_s)
9
+ USEABLE.include?(uri.host)
10
10
  end
11
11
 
12
12
  def self.new_from_video_id(video_id)
13
13
  new("http://www.youtube.com/watch?v=#{video_id}")
14
14
  end
15
15
 
16
- def initialize(url)
16
+ def initialize(url=nil)
17
17
  @url = url
18
18
  end
19
19
 
@@ -67,10 +67,10 @@ class YouTube < Provider
67
67
  attr_writer attribute
68
68
  end
69
69
 
70
- attr_writer :thumbnails
70
+ attr_writer :thumbnails, :video_id
71
71
 
72
72
  def fetch!
73
- self.extend(YouTubeVideoRepresenter).from_json(raw_response)
73
+ self.extend(YouTubeVideoEntryRepresenter).from_json(raw_response)
74
74
  end
75
75
 
76
76
  def calculate_video_id
@@ -1,3 +1,6 @@
1
+ require_relative '../youtube/youtube'
2
+ require_relative '../youtube/representer'
3
+
1
4
  module Lumiere
2
5
 
3
6
  module YouTubePlaylistRepresenter
@@ -23,20 +26,7 @@ module Lumiere
23
26
  end
24
27
  end
25
28
 
26
- collection :videos, as: :entry, class: OpenStruct do
27
-
28
- nested 'links' do
29
- property :url, :reader => lambda { |doc, args| self.url = doc[0]['href'] }
30
- end
31
-
32
- nested 'media$group' do
33
- nested 'yt$videoid' do
34
- property :video_id, as: '$t'
35
- end
36
- end
37
-
38
- end
39
-
29
+ collection :videos, as: :entry, extend: YouTubeVideoRepresenter, class: YouTube
40
30
  end
41
31
 
42
32
  end
@@ -6,7 +6,7 @@ class YouTubePlaylist < Provider
6
6
 
7
7
  def self.useable?(url)
8
8
  uri = URISchemeless.parse(url)
9
- USEABLE.include?(uri.host.to_s) && (uri.path == '/playlist' || uri.path == '/view_play_list')
9
+ USEABLE.include?(uri.host) && (uri.path == '/playlist' || uri.path == '/view_play_list')
10
10
  end
11
11
 
12
12
  def initialize(url, opts={})
data/lib/provider.rb CHANGED
@@ -18,6 +18,14 @@ module Lumiere
18
18
  raise NotImplementedError
19
19
  end
20
20
 
21
+ def video_id
22
+ raise NotImplementedError
23
+ end
24
+
25
+ def playlist_id
26
+ raise NotImplementedError
27
+ end
28
+
21
29
  def api_url
22
30
  raise NotImplementedError
23
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumiere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Entwistle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-24 00:00:00.000000000 Z
11
+ date: 2014-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: representable