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.
15 16 17 |
# File 'lib/ur/streaming.rb', line 15 def initialize(data) @data = data end |
Class Method Details
.search(ids) ⇒ Object
27 28 29 30 31 |
# File 'lib/ur/streaming.rb', line 27 def self.search(ids) return [] if ids.empty? url = STREAMING_URL + '.json?ur_product_ids=' + ids.join(',') Streaming.new(Yajl::Parser.parse(RestClient.get(url))) end |
Instance Method Details
#[](product) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ur/streaming.rb', line 19 def [](product) if product.respond_to? :ur_product_id @data[product.ur_product_id.to_s] else @data[product.to_s] end end |