ur-product 0.9.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ require 'cucumber/formatter/unicode'
5
5
  $:.unshift(File.dirname(__FILE__) + '/../../lib')
6
6
 
7
7
  # UR Product
8
- require 'lib/ur-product'
8
+ require 'ur-product'
9
9
 
10
10
  Before do
11
11
  @product = nil
@@ -1,5 +1,6 @@
1
- require 'yajl/json_gem'
2
- require 'restclient'
1
+ require 'uri'
2
+ require 'yajl'
3
+ require 'yajl/http_stream'
3
4
 
4
5
  # Module for Utbildningsradion AB (http://ur.se/)
5
6
  module UR
@@ -30,14 +31,17 @@ module UR
30
31
  url = METADATA_PRODUCT_URL + "/#{id}.json"
31
32
  end
32
33
 
33
- # Get the JSON response from the Metadata Cache
34
- response = RestClient.get(url)
35
-
36
- # Make sure that we got a valid response
37
- raise UR::InvalidResponse if response.code != 200
34
+ begin
35
+ # Get the JSON response from the Metadata Cache
36
+ response = Yajl::HttpStream.get(URI.parse(url))
37
+ rescue Yajl::HttpStream::HttpError
38
+ # Raise an invalid response exception if there was
39
+ # a problem with the HTTP request
40
+ raise UR::InvalidResponse
41
+ end
38
42
 
39
43
  # Return the response as a parsed JSON object
40
- JSON.parse(response.body)
44
+ response
41
45
  end
42
46
  end
43
47
  end
data/lib/ur/product.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require 'time'
2
+ require 'restclient'
2
3
 
3
4
  # Module for Utbildningsradion AB (http://ur.se/)
4
5
  module UR
5
6
  # A product can be a tv show, a radio program or even a website
6
- class Product
7
-
7
+ class Product
8
8
  # Setup
9
9
  if !defined?(ASSETS_URL)
10
10
  ASSETS_URL = 'http://assets.ur.se'
@@ -18,7 +18,7 @@ module UR
18
18
  :created_at, :modified_at, :format, :duration, :aspect_ratio,
19
19
  :product_type, :product_sub_type, :typical_age_ranges,
20
20
  :publication_date, :storages, :distribution_events, :difficulty,
21
- :sli, :sli_sub, :sab, :sao, :related_product_ids
21
+ :sli, :sli_sub, :sab, :sao, :fao, :related_product_ids
22
22
 
23
23
  def initialize(data)
24
24
  unless !data['status'].nil? && data['status'] == 404
@@ -29,7 +29,7 @@ module UR
29
29
  self.class.define_boolean_methods([
30
30
  'distribution_events', 'storages', 'typical_age_ranges', 'languages',
31
31
  'duration', 'difficulty', 'producing_company', 'production_year',
32
- 'obsolete_order_id', 'sli', 'sli_sub', 'sab', 'sao'
32
+ 'obsolete_order_id', 'sli', 'sli_sub', 'sab', 'sao', 'fao'
33
33
  ])
34
34
  self.class.define_relation_boolean_methods([
35
35
  'siblings', 'packageseries', 'packageusageseries', 'website',
@@ -89,7 +89,7 @@ module UR
89
89
  'format', 'duration', 'aspect_ratio',
90
90
  'product_type', 'product_sub_type',
91
91
  'typicalagerange', 'difficulty',
92
- 'sli', 'sli_sub', 'sab', 'sao'
92
+ 'sli', 'sli_sub', 'sab', 'sao', 'fao'
93
93
  ]
94
94
 
95
95
  field_names = lambda do |name|
data/lib/ur/search.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rsolr-ext'
2
+ require 'yajl'
2
3
 
3
4
  # Module for Utbildningsradion AB (http://ur.se/)
4
5
  module UR
data/lib/ur/version.rb ADDED
@@ -0,0 +1,9 @@
1
+ module UR
2
+ module VERSION
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ TINY = 0
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
data/lib/ur-product.rb CHANGED
@@ -5,6 +5,7 @@ require File.dirname(__FILE__) + '/ur/product/related_product_id.rb'
5
5
  require File.dirname(__FILE__) + '/ur/product/storage.rb'
6
6
  require File.dirname(__FILE__) + '/ur/search'
7
7
  require File.dirname(__FILE__) + '/ur/streaming'
8
+ require File.dirname(__FILE__) + '/ur/version'
8
9
 
9
10
  module UR
10
11
  class InvalidProductID < Exception
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ur-product
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 9
9
- - 9
10
- version: 0.9.9
9
+ - 0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Peter Hellberg
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-13 00:00:00 +02:00
18
+ date: 2010-10-14 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -102,6 +102,7 @@ files:
102
102
  - lib/ur/product/storage.rb
103
103
  - lib/ur/search.rb
104
104
  - lib/ur/streaming.rb
105
+ - lib/ur/version.rb
105
106
  - features/product.feature
106
107
  - features/support/env.rb
107
108
  - features/step_definitions/product_steps.rb