Class: UR::Streaming
- Inherits:
-
Object
- Object
- UR::Streaming
- Defined in:
- lib/ur/streaming.rb
Overview
Streaming information for mp4/mp3 files
Constant Summary collapse
- STREAMING_URL =
'http://metadata.ur.se/streaming'
Class Method Summary collapse
Instance Method Summary collapse
- #[](product) ⇒ Object
-
#initialize(data) ⇒ Streaming
constructor
A new instance of Streaming.
Constructor Details
#initialize(data) ⇒ Streaming
Returns a new instance of Streaming.
12 13 14 |
# File 'lib/ur/streaming.rb', line 12 def initialize(data) @data = data end |
Class Method Details
.search(ids) ⇒ Object
24 25 26 27 28 |
# File 'lib/ur/streaming.rb', line 24 def self.search(ids) return [] if ids.empty? url = STREAMING_URL + '.json?ur_product_ids=' + ids.join(',') Streaming.new(Yajl::HttpStream.get(url)) end |
Instance Method Details
#[](product) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/ur/streaming.rb', line 16 def [](product) if product.respond_to? :ur_product_id @data[product.ur_product_id.to_s] else @data[product.to_s] end end |