reviewed 0.1.31 → 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +15 -0
  2. data/lib/reviewed/article.rb +3 -1
  3. data/lib/reviewed/version.rb +1 -1
  4. data/spec/article_spec.rb +6 -1
  5. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/does_not_have_any_matching_attachments.yml +528 -290
  6. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/finds_attachments_by_tag.yml +578 -319
  7. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/has_many_attachments.yml +528 -290
  8. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/returns_all_attachments.yml +528 -290
  9. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/returns_attachments_of_the_correct_class.yml +578 -319
  10. data/spec/fixtures/vcr/Reviewed_Article/associations/pages/has_many_pages.yml +528 -290
  11. data/spec/fixtures/vcr/Reviewed_Article/associations/products/has_many_products.yml +559 -340
  12. data/spec/fixtures/vcr/Reviewed_Article/associations/products/returns_products_of_the_correct_class.yml +528 -290
  13. data/spec/fixtures/vcr/Reviewed_Article/find_page/finds_a_page_with_a_matching_slug.yml +641 -410
  14. data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_a_product_of_the_correct_class.yml +1056 -580
  15. data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_nil_if_does_not_respond_to_products.yml +1199 -0
  16. data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_the_primary_product.yml +1056 -580
  17. data/spec/fixtures/vcr/Reviewed_Client/_perform/request_params/not_set/has_nil_query_params.yml +181 -297
  18. data/spec/fixtures/vcr/Reviewed_Client/_perform/request_params/set/merges_quest_params.yml +27 -54
  19. data/spec/fixtures/vcr/Reviewed_Collection/collection_data/fetches_the_first_page_by_default.yml +112 -58
  20. data/spec/fixtures/vcr/Reviewed_Collection/collection_data/is_enumerable.yml +110 -56
  21. data/spec/fixtures/vcr/Reviewed_Collection/next_page/fetches_the_next_page_of_results.yml +167 -120
  22. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/indicates_if_the_page_number_is_out_of_bounds.yml +110 -56
  23. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/indicates_whether_this_is_the_first_or_last_page.yml +110 -56
  24. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_limit_value_max_per_page_.yml +112 -58
  25. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_number_of_entries_on_the_current_page.yml +110 -56
  26. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_offset.yml +110 -56
  27. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_total_item_count.yml +110 -56
  28. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_total_number_of_pages.yml +110 -56
  29. data/spec/fixtures/vcr/Reviewed_Collection/previous_page/fetches_the_previous_page_of_results.yml +279 -178
  30. data/spec/fixtures/vcr/Reviewed_Collection/previous_page/returns_nil_if_there_is_no_previous_page.yml +110 -56
  31. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/does_not_have_any_matching_attachments.yml +43 -54
  32. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/finds_attachments_by_tag.yml +45 -56
  33. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/has_many_attachments.yml +44 -52
  34. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/returns_all_attachments.yml +43 -54
  35. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/returns_attachments_of_the_correct_class.yml +45 -53
  36. data/spec/fixtures/vcr/Reviewed_Product/manufacturer_specs/has_many_manufacturer_specs.yml +43 -54
  37. data/spec/fixtures/vcr/Reviewed_Product/manufacturer_specs/returns_attachments_of_the_correct_class.yml +43 -54
  38. data/spec/fixtures/vcr/Reviewed_Request/_where/filters_collections_using_other_supported_options.yml +39 -46
  39. data/spec/fixtures/vcr/Reviewed_Request/_where/returns_a_collection.yml +181 -297
  40. data/spec/fixtures/vcr/Reviewed_Request/_where/returns_an_empty_set_if_no_matching_data_was_found.yml +12 -20
  41. data/spec/fixtures/vcr/Reviewed_Request/_where/returns_the_appropriate_page_of_results.yml +215 -325
  42. data/spec/fixtures/vcr/Reviewed_Request/collection_from_response/returns_a_collection_object.yml +181 -297
  43. data/spec/fixtures/vcr/Reviewed_Request/collection_from_response/returns_objects_of_the_correct_class.yml +181 -297
  44. data/spec/fixtures/vcr/Reviewed_Request/object_from_response/returns_an_object_of_the_correct_class.yml +528 -290
  45. data/spec/spec_helper.rb +1 -1
  46. metadata +7 -29
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWM3YWI3Zjg0MDA3N2ZlYzBjZjQ5MmYxNWFiOGY1NzU0YWJlMjlmMw==
5
+ data.tar.gz: !binary |-
6
+ MmZmZTMyMWM2MDg2ZTAzMzM1YWU4OGM5MzdhMDg2YmUxZmY2MzAzNg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YTY4NmJmYjYxNmFmYTY3YTU3MDI4ZDg1OGM5MTA3MzY4Y2JkYmJlN2Y0MmZj
10
+ ZGQyNmVjOTU2YTcyNjFjYjc1ZGFjNDFhNmFiZmExYTQ3YTVkZTBiZjJlMzFl
11
+ MTI4Mzg0ODZmMDBlNjQwMTFkNzNjYmUxNDU0NDc0YmI2NmFlNWM=
12
+ data.tar.gz: !binary |-
13
+ MjMyYThmOGNkY2M0NjBmZDBiN2MwZTI0M2IwMjdhMTM1MTE4OTEzZGRjYWZk
14
+ ZTJiZmEyMjEwMmQ0NDQ0MDBlNDBjM2EyNTFmZTQzODBiYzYyMDhmODEyMzBk
15
+ NzlmNDg5ZGRjYzQ5Y2QwZDIyMjQxNmRhYTE0ZGYwNmZlZWE5ODM=
@@ -13,7 +13,9 @@ module Reviewed
13
13
  end
14
14
 
15
15
  def primary_product
16
- products.select { |p| p.id == primary_product_id }.first
16
+ if respond_to?(:products)
17
+ products.select { |p| p.id == primary_product_id }.first
18
+ end
17
19
  end
18
20
 
19
21
  def attachments(tag=nil)
@@ -1,4 +1,4 @@
1
1
  module Reviewed
2
- VERSION = "0.1.31"
2
+ VERSION = "0.1.32"
3
3
  API_VERSION = 'v1'
4
4
  end
data/spec/article_spec.rb CHANGED
@@ -67,7 +67,7 @@ describe Reviewed::Article, vcr: true do
67
67
 
68
68
  it 'finds a page with a matching slug' do
69
69
  article = client.articles.find('minden-master-ii-grill-review')
70
- article.pages.length.should == 5
70
+ article.pages.length.should == 4
71
71
  page = article.find_page('performance')
72
72
  page.should == article.pages[2]
73
73
  page.name.should == 'Performance'
@@ -89,5 +89,10 @@ describe Reviewed::Article, vcr: true do
89
89
  it "returns a product of the correct class" do
90
90
  @product.class.should == Reviewed::Product
91
91
  end
92
+
93
+ it 'returns nil if does not respond to products' do
94
+ @article.attributes.delete(:products)
95
+ @article.primary_product.should be_nil
96
+ end
92
97
  end
93
98
  end