reviewed 0.0.3 → 0.0.4

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.
@@ -10,6 +10,10 @@ module Reviewed
10
10
  end
11
11
  end
12
12
 
13
+ def primary_product
14
+ products.select { |p| p.id == primary_product_id }.first
15
+ end
16
+
13
17
  def attachments(tag=nil)
14
18
  if tag.present?
15
19
  @attributes[:attachments].select do |attachment|
@@ -1,4 +1,4 @@
1
1
  module Reviewed
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  API_VERSION = 'v1'
4
4
  end
data/spec/article_spec.rb CHANGED
@@ -28,6 +28,23 @@ describe Reviewed::Article do
28
28
  end
29
29
  end
30
30
 
31
+ describe 'primary_product' do
32
+ use_vcr_cassette 'article/products'
33
+
34
+ before(:each) do
35
+ @article = Reviewed::Article.find('big-green-egg-medium-charcoal-grill-review')
36
+ @product = @article.primary_product
37
+ end
38
+
39
+ it "returns the primary product" do
40
+ @product.id.should eql('506b06970494340f51809caf')
41
+ end
42
+
43
+ it "returns a product of the correct class" do
44
+ @product.class.should == Reviewed::Product
45
+ end
46
+ end
47
+
31
48
  describe 'attachments' do
32
49
  use_vcr_cassette 'article/attachments'
33
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reviewed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-03 00:00:00.000000000 Z
13
+ date: 2012-10-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport