reviewed 0.9.1 → 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.
- checksums.yaml +4 -4
- data/lib/reviewed/award.rb +3 -0
- data/lib/reviewed/embeddable.rb +15 -20
- data/lib/reviewed/version.rb +1 -1
- data/spec/article_spec.rb +5 -5
- data/spec/award_spec.rb +24 -0
- data/spec/embeddable_spec.rb +7 -40
- data/spec/fixtures/vcr/Reviewed_Award/associations/articles/has_many_articles.yml +137 -0
- data/spec/fixtures/vcr/Reviewed_Award/associations/articles/returns_attachments_of_the_correct_class.yml +137 -0
- data/spec/product_spec.rb +2 -2
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 137aeb665ec32dd554606f031b18612f32b64a69
|
4
|
+
data.tar.gz: b04ade2d3920b619a54175a41ebb779795a43c4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bb7cdc75da4892e4ce1813f035c5854fc1f128b99151d3b82a9828396c602f5d7394e46c3f1c6191e29c3f789cd5bff04599ec0620a6c84ba530af3235a82b0
|
7
|
+
data.tar.gz: fe47671af92c1468520d8d13a23c396aece4d684c9c8ecd64babc2908bc9a812f62c6f743568f1fb393e0592e9c6cafac5c25f75d474ba7a371e37766864f678
|
data/lib/reviewed/award.rb
CHANGED
data/lib/reviewed/embeddable.rb
CHANGED
@@ -6,13 +6,8 @@ module Reviewed
|
|
6
6
|
end
|
7
7
|
|
8
8
|
class << self
|
9
|
-
|
10
|
-
|
11
|
-
name = opts_name ? opts_name : embedded_name(name)
|
12
|
-
name.constantize
|
13
|
-
end
|
14
|
-
|
15
|
-
def embedded_name(name)
|
9
|
+
def embedded_name(name, opts_name=nil)
|
10
|
+
return opts_name if opts_name
|
16
11
|
["Reviewed", name.singularize.classify].join("::")
|
17
12
|
end
|
18
13
|
end
|
@@ -25,11 +20,11 @@ module Reviewed
|
|
25
20
|
|
26
21
|
def objectify_has_many(json)
|
27
22
|
self.class._embedded_many.each do |map|
|
28
|
-
|
29
|
-
|
30
|
-
if json.has_key?(
|
31
|
-
json[
|
32
|
-
|
23
|
+
assoc_name, klass_name = [map.keys[0], map.values[0]]
|
24
|
+
klass = klass_name.constantize
|
25
|
+
if json.has_key?(assoc_name)
|
26
|
+
json[assoc_name] = json[assoc_name].map do |obj|
|
27
|
+
klass.new(obj)
|
33
28
|
end
|
34
29
|
end
|
35
30
|
end
|
@@ -38,10 +33,10 @@ module Reviewed
|
|
38
33
|
|
39
34
|
def objectify_has_one(json)
|
40
35
|
self.class._embedded_one.each do |map|
|
41
|
-
|
42
|
-
|
43
|
-
if json.has_key?(
|
44
|
-
json[
|
36
|
+
assoc_name, klass_name = [map.keys[0], map.values[0]]
|
37
|
+
klass = klass_name.constantize
|
38
|
+
if json.has_key?(assoc_name)
|
39
|
+
json[assoc_name] = klass.new(json[assoc_name])
|
45
40
|
end
|
46
41
|
end
|
47
42
|
return json
|
@@ -55,15 +50,15 @@ module Reviewed
|
|
55
50
|
end
|
56
51
|
|
57
52
|
def has_many(name, opts={})
|
58
|
-
|
53
|
+
klass_string = Reviewed::Embeddable.embedded_name(name.to_s, opts[:class_name])
|
59
54
|
association = opts[:as] || name
|
60
|
-
_embedded_many << { association.to_s =>
|
55
|
+
_embedded_many << { association.to_s => klass_string }
|
61
56
|
end
|
62
57
|
|
63
58
|
def has_one(name, opts={})
|
64
|
-
|
59
|
+
klass_string = Reviewed::Embeddable.embedded_name(name.to_s, opts[:class_name])
|
65
60
|
association = opts[:as] || name
|
66
|
-
_embedded_one << { association.to_s =>
|
61
|
+
_embedded_one << { association.to_s => klass_string }
|
67
62
|
end
|
68
63
|
|
69
64
|
def _embedded_many
|
data/lib/reviewed/version.rb
CHANGED
data/spec/article_spec.rb
CHANGED
@@ -16,27 +16,27 @@ describe Reviewed::Article, vcr: true do
|
|
16
16
|
describe 'pages' do
|
17
17
|
|
18
18
|
it 'has_many :pages' do
|
19
|
-
Reviewed::Article._embedded_many.should include({"pages"=>Reviewed::Page})
|
19
|
+
Reviewed::Article._embedded_many.should include({"pages"=>"Reviewed::Page"})
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe 'deals' do
|
24
24
|
|
25
25
|
it 'has_many :deals' do
|
26
|
-
Reviewed::Article._embedded_many.should include({"deals"=>Reviewed::Deal})
|
26
|
+
Reviewed::Article._embedded_many.should include({"deals"=>"Reviewed::Deal"})
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe 'related_articles' do
|
31
31
|
it 'has_many :related_articles' do
|
32
|
-
Reviewed::Article._embedded_many.should include({"related_articles"=>Reviewed::Article})
|
32
|
+
Reviewed::Article._embedded_many.should include({"related_articles"=>"Reviewed::Article"})
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
describe 'products' do
|
37
37
|
|
38
38
|
it 'has_many :products' do
|
39
|
-
Reviewed::Article._embedded_many.should include({"products"=>Reviewed::Product})
|
39
|
+
Reviewed::Article._embedded_many.should include({"products"=>"Reviewed::Product"})
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'returns products of the correct class' do
|
@@ -49,7 +49,7 @@ describe Reviewed::Article, vcr: true do
|
|
49
49
|
describe 'attachments' do
|
50
50
|
|
51
51
|
it 'does not has_many :attachments' do
|
52
|
-
Reviewed::Article._embedded_many.should_not include({"attachments"=>Reviewed::Attachment})
|
52
|
+
Reviewed::Article._embedded_many.should_not include({"attachments"=>"Reviewed::Attachment"})
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'gets gallery attachments' do
|
data/spec/award_spec.rb
CHANGED
@@ -1,4 +1,28 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Reviewed::Award do
|
4
|
+
|
5
|
+
let(:client) do
|
6
|
+
Reviewed::Client.new(api_key: TEST_KEY, base_uri: TEST_URL)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'associations' do
|
10
|
+
|
11
|
+
describe 'articles', vcr: true do
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
@award = client.awards.find('best-of-year')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'has_many :articles' do
|
18
|
+
Reviewed::Award._embedded_many.should include({"articles"=>"Reviewed::Article"})
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns attachments of the correct class' do
|
22
|
+
@award.articles.each do |article|
|
23
|
+
article.should be_an_instance_of(Reviewed::Article)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
4
28
|
end
|
data/spec/embeddable_spec.rb
CHANGED
@@ -35,16 +35,7 @@ describe Reviewed::Embeddable do
|
|
35
35
|
it 'stores the correct embedded relationship' do
|
36
36
|
Reviewed::MockEmbeddable._embedded_many.should be_empty
|
37
37
|
Reviewed::MockEmbeddable.has_many("mock_embeddables")
|
38
|
-
Reviewed::MockEmbeddable._embedded_many.should eql([{ "mock_embeddables" => Reviewed::MockEmbeddable }])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'invalid name' do
|
43
|
-
|
44
|
-
it 'errors' do
|
45
|
-
expect {
|
46
|
-
Reviewed::MockEmbeddable.has_many("bad_name")
|
47
|
-
}.to raise_error
|
38
|
+
Reviewed::MockEmbeddable._embedded_many.should eql([{ "mock_embeddables" => "Reviewed::MockEmbeddable" }])
|
48
39
|
end
|
49
40
|
end
|
50
41
|
end
|
@@ -54,7 +45,7 @@ describe Reviewed::Embeddable do
|
|
54
45
|
it 'stores the correct embedded relationship' do
|
55
46
|
Reviewed::MockEmbeddable._embedded_many.should be_empty
|
56
47
|
Reviewed::MockEmbeddable.has_many("mock_embeddables", as: "test")
|
57
|
-
Reviewed::MockEmbeddable._embedded_many.should eql([{ "test" => Reviewed::MockEmbeddable }])
|
48
|
+
Reviewed::MockEmbeddable._embedded_many.should eql([{ "test" => "Reviewed::MockEmbeddable" }])
|
58
49
|
end
|
59
50
|
end
|
60
51
|
|
@@ -63,7 +54,7 @@ describe Reviewed::Embeddable do
|
|
63
54
|
it 'stores the correct embedded relationship' do
|
64
55
|
Reviewed::MockEmbeddable._embedded_many.should be_empty
|
65
56
|
Reviewed::MockEmbeddable.has_many("mock_embeddables", class_name: "Reviewed::Article")
|
66
|
-
Reviewed::MockEmbeddable._embedded_many.should eql([{ "mock_embeddables" => Reviewed::Article }])
|
57
|
+
Reviewed::MockEmbeddable._embedded_many.should eql([{ "mock_embeddables" => "Reviewed::Article" }])
|
67
58
|
end
|
68
59
|
end
|
69
60
|
end
|
@@ -73,7 +64,7 @@ describe Reviewed::Embeddable do
|
|
73
64
|
it 'stores the correct embedded relationship' do
|
74
65
|
Reviewed::MockEmbeddable._embedded_one.should be_empty
|
75
66
|
Reviewed::MockEmbeddable.has_one("mock_embeddable")
|
76
|
-
Reviewed::MockEmbeddable._embedded_one.should eql([{ "mock_embeddable" => Reviewed::MockEmbeddable }])
|
67
|
+
Reviewed::MockEmbeddable._embedded_one.should eql([{ "mock_embeddable" => "Reviewed::MockEmbeddable" }])
|
77
68
|
end
|
78
69
|
end
|
79
70
|
|
@@ -98,7 +89,7 @@ describe Reviewed::Embeddable do
|
|
98
89
|
let(:mocked) { Reviewed::MockEmbeddable.new }
|
99
90
|
|
100
91
|
before(:each) do
|
101
|
-
Reviewed::MockEmbeddable._embedded_many = [ { "articles" => Reviewed::Article } ]
|
92
|
+
Reviewed::MockEmbeddable._embedded_many = [ { "articles" => "Reviewed::Article" } ]
|
102
93
|
end
|
103
94
|
|
104
95
|
context 'relationship exists in json' do
|
@@ -129,7 +120,7 @@ describe Reviewed::Embeddable do
|
|
129
120
|
let(:mocked) { Reviewed::MockEmbeddable.new }
|
130
121
|
|
131
122
|
before(:each) do
|
132
|
-
Reviewed::MockEmbeddable._embedded_one = [ { "article" => Reviewed::Article } ]
|
123
|
+
Reviewed::MockEmbeddable._embedded_one = [ { "article" => "Reviewed::Article" } ]
|
133
124
|
end
|
134
125
|
|
135
126
|
it 'objectifies' do
|
@@ -152,37 +143,13 @@ describe Reviewed::Embeddable do
|
|
152
143
|
Reviewed::Embeddable.embedded_name("mock_embeddable").should eql("Reviewed::MockEmbeddable")
|
153
144
|
end
|
154
145
|
end
|
155
|
-
end
|
156
|
-
|
157
|
-
describe '.embedded_class' do
|
158
146
|
|
159
147
|
context 'opts_name' do
|
160
148
|
|
161
149
|
context 'valid' do
|
162
150
|
|
163
151
|
it 'returns a class_constant' do
|
164
|
-
Reviewed::Embeddable.
|
165
|
-
.should eql(Reviewed::MockEmbeddable)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
context 'invalid' do
|
170
|
-
|
171
|
-
it 'errors' do
|
172
|
-
expect {
|
173
|
-
Reviewed::Embeddable.embedded_class("test", "Reviewed::MockBad")
|
174
|
-
}.to raise_error
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
context 'name' do
|
180
|
-
|
181
|
-
context 'valid' do
|
182
|
-
|
183
|
-
it 'returns a class_constant' do
|
184
|
-
Reviewed::Embeddable.embedded_class("mock_embeddables")
|
185
|
-
.should eql(Reviewed::MockEmbeddable)
|
152
|
+
Reviewed::Embeddable.embedded_name("test", "Reviewed::MockEmbeddable").should eql("Reviewed::MockEmbeddable")
|
186
153
|
end
|
187
154
|
end
|
188
155
|
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://the-guide-staging.herokuapp.com/api/v1/products/best-of-year
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Reviewed-Authorization:
|
11
|
+
- 38e397252ec670ec441733a95204f141
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- '*/*'
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 404
|
21
|
+
message: Not Found
|
22
|
+
headers:
|
23
|
+
Access-Control-Allow-Credentials:
|
24
|
+
- 'true'
|
25
|
+
Access-Control-Allow-Headers:
|
26
|
+
- x-pagination, x-requested-with, x-requested-by, x-reviewed-authorization,
|
27
|
+
x-skip-cache, Content-Type
|
28
|
+
Access-Control-Allow-Methods:
|
29
|
+
- OPTIONS, GET, POST, PUT, DELETE
|
30
|
+
Access-Control-Allow-Origin:
|
31
|
+
- '*'
|
32
|
+
Access-Control-Max-Age:
|
33
|
+
- '1000'
|
34
|
+
Cache-Control:
|
35
|
+
- no-cache, no-store
|
36
|
+
Content-Type:
|
37
|
+
- application/json; charset=utf-8
|
38
|
+
Date:
|
39
|
+
- Wed, 23 Oct 2013 20:26:06 GMT
|
40
|
+
Etag:
|
41
|
+
- '"e0aa021e21dddbd6d8cecec71e9cf564"'
|
42
|
+
Status:
|
43
|
+
- 404 Not Found
|
44
|
+
Strict-Transport-Security:
|
45
|
+
- max-age=31536000
|
46
|
+
Vary:
|
47
|
+
- Accept-Encoding
|
48
|
+
X-Rack-Cache:
|
49
|
+
- miss
|
50
|
+
X-Request-Id:
|
51
|
+
- dd3ae6ddb7599b7e77a8452fbc99d009
|
52
|
+
X-Runtime:
|
53
|
+
- '0.000745'
|
54
|
+
X-Ua-Compatible:
|
55
|
+
- IE=Edge,chrome=1
|
56
|
+
Transfer-Encoding:
|
57
|
+
- chunked
|
58
|
+
Connection:
|
59
|
+
- keep-alive
|
60
|
+
body:
|
61
|
+
encoding: UTF-8
|
62
|
+
string: '{"message":"Record Not Found"}'
|
63
|
+
http_version:
|
64
|
+
recorded_at: Wed, 23 Oct 2013 20:26:21 GMT
|
65
|
+
- request:
|
66
|
+
method: get
|
67
|
+
uri: https://the-guide-staging.herokuapp.com/api/v1/awards/best-of-year
|
68
|
+
body:
|
69
|
+
encoding: US-ASCII
|
70
|
+
string: ''
|
71
|
+
headers:
|
72
|
+
X-Reviewed-Authorization:
|
73
|
+
- 38e397252ec670ec441733a95204f141
|
74
|
+
Accept-Encoding:
|
75
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
76
|
+
Accept:
|
77
|
+
- '*/*'
|
78
|
+
User-Agent:
|
79
|
+
- Ruby
|
80
|
+
response:
|
81
|
+
status:
|
82
|
+
code: 200
|
83
|
+
message: OK
|
84
|
+
headers:
|
85
|
+
Access-Control-Allow-Credentials:
|
86
|
+
- 'true'
|
87
|
+
Access-Control-Allow-Headers:
|
88
|
+
- x-pagination, x-requested-with, x-requested-by, x-reviewed-authorization,
|
89
|
+
x-skip-cache, Content-Type
|
90
|
+
Access-Control-Allow-Methods:
|
91
|
+
- OPTIONS, GET, POST, PUT, DELETE
|
92
|
+
Access-Control-Allow-Origin:
|
93
|
+
- '*'
|
94
|
+
Access-Control-Max-Age:
|
95
|
+
- '1000'
|
96
|
+
Cache-Control:
|
97
|
+
- no-cache, no-store
|
98
|
+
Content-Type:
|
99
|
+
- application/json; charset=utf-8
|
100
|
+
Date:
|
101
|
+
- Wed, 23 Oct 2013 20:26:36 GMT
|
102
|
+
Etag:
|
103
|
+
- '"e0aa021e21dddbd6d8cecec71e9cf564"'
|
104
|
+
Last-Modified:
|
105
|
+
- Tue, 22 Oct 2013 22:00:41 GMT
|
106
|
+
Status:
|
107
|
+
- 200 OK
|
108
|
+
Strict-Transport-Security:
|
109
|
+
- max-age=31536000
|
110
|
+
Vary:
|
111
|
+
- Accept-Encoding
|
112
|
+
X-Rack-Cache:
|
113
|
+
- miss
|
114
|
+
X-Request-Id:
|
115
|
+
- 61a50ad8fd2bb86b35243656a36792fe
|
116
|
+
X-Runtime:
|
117
|
+
- '0.000745'
|
118
|
+
X-Ua-Compatible:
|
119
|
+
- IE=Edge,chrome=1
|
120
|
+
Transfer-Encoding:
|
121
|
+
- chunked
|
122
|
+
Connection:
|
123
|
+
- keep-alive
|
124
|
+
body:
|
125
|
+
encoding: UTF-8
|
126
|
+
string: '{"id":"50fef5cf85b7580c5100000c","created_at":"2013-01-22T20:25:51Z","updated_at":"2013-10-22T22:00:41Z","name":"Best
|
127
|
+
of Year","year":"2012","description":"It''s hard to know what to buy. There
|
128
|
+
are tons of electronics and home good our there with conflicting user reviews
|
129
|
+
everywhere you turn. How do you know which to trust? Our advice is simple:
|
130
|
+
let good science decide! Our labs test hundred of products each year. Only
|
131
|
+
a precious few are great enough to earn a prestigious Best of Year award.
|
132
|
+
\n\nThe Best of Year awards are just that: the absolute best products of the
|
133
|
+
last calendar year. There are options at every price point, and lots of special
|
134
|
+
award categories to help you find just what you need.","slug":"best-of-year","resource_uri":"http://www.reviewed.com/awards/best-of-year","article_ids":[],"image_badge":{"small":"http://reviewed-staging.s3.amazonaws.com/uploads/award/image_badge/50fef5cf85b7580c5100000c/small_leapaxlr8r-banner-companies.png","medium":"http://reviewed-staging.s3.amazonaws.com/uploads/award/image_badge/50fef5cf85b7580c5100000c/medium_leapaxlr8r-banner-companies.png","large":"http://reviewed-staging.s3.amazonaws.com/uploads/award/image_badge/50fef5cf85b7580c5100000c/large_leapaxlr8r-banner-companies.png"},"articles":[],"permissions":{"read":true,"create":false,"update":false,"destroy":false},"api_links":{"collection":{"rel":"/api/v1/awards","href":"https://the-guide-staging.herokuapp.com/api/v1/awards"},"resource":{"rel":"/api/v1/awards/50fef5cf85b7580c5100000c","href":"https://the-guide-staging.herokuapp.com/api/v1/awards/50fef5cf85b7580c5100000c"}}}'
|
135
|
+
http_version:
|
136
|
+
recorded_at: Wed, 23 Oct 2013 20:26:51 GMT
|
137
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,137 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://the-guide-staging.herokuapp.com/api/v1/products/best-of-year
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Reviewed-Authorization:
|
11
|
+
- 38e397252ec670ec441733a95204f141
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- '*/*'
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 404
|
21
|
+
message: Not Found
|
22
|
+
headers:
|
23
|
+
Access-Control-Allow-Credentials:
|
24
|
+
- 'true'
|
25
|
+
Access-Control-Allow-Headers:
|
26
|
+
- x-pagination, x-requested-with, x-requested-by, x-reviewed-authorization,
|
27
|
+
x-skip-cache, Content-Type
|
28
|
+
Access-Control-Allow-Methods:
|
29
|
+
- OPTIONS, GET, POST, PUT, DELETE
|
30
|
+
Access-Control-Allow-Origin:
|
31
|
+
- '*'
|
32
|
+
Access-Control-Max-Age:
|
33
|
+
- '1000'
|
34
|
+
Cache-Control:
|
35
|
+
- no-cache, no-store
|
36
|
+
Content-Type:
|
37
|
+
- application/json; charset=utf-8
|
38
|
+
Date:
|
39
|
+
- Wed, 23 Oct 2013 20:26:07 GMT
|
40
|
+
Etag:
|
41
|
+
- '"e0aa021e21dddbd6d8cecec71e9cf564"'
|
42
|
+
Status:
|
43
|
+
- 404 Not Found
|
44
|
+
Strict-Transport-Security:
|
45
|
+
- max-age=31536000
|
46
|
+
Vary:
|
47
|
+
- Accept-Encoding
|
48
|
+
X-Rack-Cache:
|
49
|
+
- miss
|
50
|
+
X-Request-Id:
|
51
|
+
- 5413449a8c611eaec9856053f581cae0
|
52
|
+
X-Runtime:
|
53
|
+
- '0.001468'
|
54
|
+
X-Ua-Compatible:
|
55
|
+
- IE=Edge,chrome=1
|
56
|
+
Transfer-Encoding:
|
57
|
+
- chunked
|
58
|
+
Connection:
|
59
|
+
- keep-alive
|
60
|
+
body:
|
61
|
+
encoding: UTF-8
|
62
|
+
string: '{"message":"Record Not Found"}'
|
63
|
+
http_version:
|
64
|
+
recorded_at: Wed, 23 Oct 2013 20:26:22 GMT
|
65
|
+
- request:
|
66
|
+
method: get
|
67
|
+
uri: https://the-guide-staging.herokuapp.com/api/v1/awards/best-of-year
|
68
|
+
body:
|
69
|
+
encoding: US-ASCII
|
70
|
+
string: ''
|
71
|
+
headers:
|
72
|
+
X-Reviewed-Authorization:
|
73
|
+
- 38e397252ec670ec441733a95204f141
|
74
|
+
Accept-Encoding:
|
75
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
76
|
+
Accept:
|
77
|
+
- '*/*'
|
78
|
+
User-Agent:
|
79
|
+
- Ruby
|
80
|
+
response:
|
81
|
+
status:
|
82
|
+
code: 200
|
83
|
+
message: OK
|
84
|
+
headers:
|
85
|
+
Access-Control-Allow-Credentials:
|
86
|
+
- 'true'
|
87
|
+
Access-Control-Allow-Headers:
|
88
|
+
- x-pagination, x-requested-with, x-requested-by, x-reviewed-authorization,
|
89
|
+
x-skip-cache, Content-Type
|
90
|
+
Access-Control-Allow-Methods:
|
91
|
+
- OPTIONS, GET, POST, PUT, DELETE
|
92
|
+
Access-Control-Allow-Origin:
|
93
|
+
- '*'
|
94
|
+
Access-Control-Max-Age:
|
95
|
+
- '1000'
|
96
|
+
Cache-Control:
|
97
|
+
- no-cache, no-store
|
98
|
+
Content-Type:
|
99
|
+
- application/json; charset=utf-8
|
100
|
+
Date:
|
101
|
+
- Wed, 23 Oct 2013 20:26:36 GMT
|
102
|
+
Etag:
|
103
|
+
- '"e0aa021e21dddbd6d8cecec71e9cf564"'
|
104
|
+
Last-Modified:
|
105
|
+
- Tue, 22 Oct 2013 22:00:41 GMT
|
106
|
+
Status:
|
107
|
+
- 200 OK
|
108
|
+
Strict-Transport-Security:
|
109
|
+
- max-age=31536000
|
110
|
+
Vary:
|
111
|
+
- Accept-Encoding
|
112
|
+
X-Rack-Cache:
|
113
|
+
- miss
|
114
|
+
X-Request-Id:
|
115
|
+
- 0bb629f64ebf293f804af3a9db3f51c9
|
116
|
+
X-Runtime:
|
117
|
+
- '0.000919'
|
118
|
+
X-Ua-Compatible:
|
119
|
+
- IE=Edge,chrome=1
|
120
|
+
Transfer-Encoding:
|
121
|
+
- chunked
|
122
|
+
Connection:
|
123
|
+
- keep-alive
|
124
|
+
body:
|
125
|
+
encoding: UTF-8
|
126
|
+
string: '{"id":"50fef5cf85b7580c5100000c","created_at":"2013-01-22T20:25:51Z","updated_at":"2013-10-22T22:00:41Z","name":"Best
|
127
|
+
of Year","year":"2012","description":"It''s hard to know what to buy. There
|
128
|
+
are tons of electronics and home good our there with conflicting user reviews
|
129
|
+
everywhere you turn. How do you know which to trust? Our advice is simple:
|
130
|
+
let good science decide! Our labs test hundred of products each year. Only
|
131
|
+
a precious few are great enough to earn a prestigious Best of Year award.
|
132
|
+
\n\nThe Best of Year awards are just that: the absolute best products of the
|
133
|
+
last calendar year. There are options at every price point, and lots of special
|
134
|
+
award categories to help you find just what you need.","slug":"best-of-year","resource_uri":"http://www.reviewed.com/awards/best-of-year","article_ids":[],"image_badge":{"small":"http://reviewed-staging.s3.amazonaws.com/uploads/award/image_badge/50fef5cf85b7580c5100000c/small_leapaxlr8r-banner-companies.png","medium":"http://reviewed-staging.s3.amazonaws.com/uploads/award/image_badge/50fef5cf85b7580c5100000c/medium_leapaxlr8r-banner-companies.png","large":"http://reviewed-staging.s3.amazonaws.com/uploads/award/image_badge/50fef5cf85b7580c5100000c/large_leapaxlr8r-banner-companies.png"},"articles":[],"permissions":{"read":true,"create":false,"update":false,"destroy":false},"api_links":{"collection":{"rel":"/api/v1/awards","href":"https://the-guide-staging.herokuapp.com/api/v1/awards"},"resource":{"rel":"/api/v1/awards/50fef5cf85b7580c5100000c","href":"https://the-guide-staging.herokuapp.com/api/v1/awards/50fef5cf85b7580c5100000c"}}}'
|
135
|
+
http_version:
|
136
|
+
recorded_at: Wed, 23 Oct 2013 20:26:51 GMT
|
137
|
+
recorded_with: VCR 2.4.0
|
data/spec/product_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe Reviewed::Product do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'no longer has_many :attachments' do
|
19
|
-
Reviewed::Product._embedded_many.should_not include({"attachments"=>Reviewed::Attachment})
|
19
|
+
Reviewed::Product._embedded_many.should_not include({"attachments"=>"Reviewed::Attachment"})
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns attachments of the correct class' do
|
@@ -50,7 +50,7 @@ describe Reviewed::Product do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'has_many :manufacturer_specs' do
|
53
|
-
Reviewed::Product._embedded_many.should include({"manufacturer_specs"=>Reviewed::ManufacturerSpec})
|
53
|
+
Reviewed::Product._embedded_many.should include({"manufacturer_specs"=>"Reviewed::ManufacturerSpec"})
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'returns attachments of the correct class' do
|
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.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Plante
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -277,6 +277,8 @@ files:
|
|
277
277
|
- spec/fixtures/vcr/Reviewed_Article/returns_local_attachments_when_available.yml
|
278
278
|
- spec/fixtures/vcr/Reviewed_Article/uses_the_client_to_fetch.yml
|
279
279
|
- spec/fixtures/vcr/Reviewed_Article/uses_the_client_to_fetch_scoped_attachments.yml
|
280
|
+
- spec/fixtures/vcr/Reviewed_Award/associations/articles/has_many_articles.yml
|
281
|
+
- spec/fixtures/vcr/Reviewed_Award/associations/articles/returns_attachments_of_the_correct_class.yml
|
280
282
|
- spec/fixtures/vcr/Reviewed_Client/_perform/request_params/not_set/has_nil_query_params.yml
|
281
283
|
- spec/fixtures/vcr/Reviewed_Client/_perform/request_params/set/merges_quest_params.yml
|
282
284
|
- spec/fixtures/vcr/Reviewed_Collection/collection_data/fetches_the_first_page_by_default.yml
|
@@ -369,6 +371,8 @@ test_files:
|
|
369
371
|
- spec/fixtures/vcr/Reviewed_Article/returns_local_attachments_when_available.yml
|
370
372
|
- spec/fixtures/vcr/Reviewed_Article/uses_the_client_to_fetch.yml
|
371
373
|
- spec/fixtures/vcr/Reviewed_Article/uses_the_client_to_fetch_scoped_attachments.yml
|
374
|
+
- spec/fixtures/vcr/Reviewed_Award/associations/articles/has_many_articles.yml
|
375
|
+
- spec/fixtures/vcr/Reviewed_Award/associations/articles/returns_attachments_of_the_correct_class.yml
|
372
376
|
- spec/fixtures/vcr/Reviewed_Client/_perform/request_params/not_set/has_nil_query_params.yml
|
373
377
|
- spec/fixtures/vcr/Reviewed_Client/_perform/request_params/set/merges_quest_params.yml
|
374
378
|
- spec/fixtures/vcr/Reviewed_Collection/collection_data/fetches_the_first_page_by_default.yml
|