reviewed 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/README.md +12 -5
  2. data/lib/faraday/api_key.rb +14 -0
  3. data/lib/faraday/errors.rb +14 -0
  4. data/lib/reviewed/article.rb +3 -1
  5. data/lib/reviewed/award.rb +4 -0
  6. data/lib/reviewed/base.rb +23 -11
  7. data/lib/reviewed/client.rb +47 -26
  8. data/lib/reviewed/collection.rb +8 -8
  9. data/lib/reviewed/product.rb +2 -0
  10. data/lib/reviewed/request.rb +43 -0
  11. data/lib/reviewed/version.rb +1 -1
  12. data/lib/reviewed.rb +13 -20
  13. data/reviewed.gemspec +1 -0
  14. data/spec/article_spec.rb +21 -21
  15. data/spec/award_spec.rb +4 -0
  16. data/spec/base_spec.rb +23 -49
  17. data/spec/client_spec.rb +97 -27
  18. data/spec/collection_spec.rb +6 -4
  19. data/spec/faraday/api_key_spec.rb +42 -0
  20. data/spec/faraday/errors_spec.rb +73 -0
  21. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/does_not_have_any_matching_attachments.yml +601 -0
  22. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/finds_attachments_by_tag.yml +601 -0
  23. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/has_many_attachments.yml +601 -0
  24. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/returns_all_attachments.yml +601 -0
  25. data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/returns_attachments_of_the_correct_class.yml +601 -0
  26. data/spec/fixtures/vcr/Reviewed_Article/associations/pages/has_many_pages.yml +601 -0
  27. data/spec/fixtures/vcr/Reviewed_Article/associations/products/has_many_products.yml +582 -0
  28. data/spec/fixtures/vcr/Reviewed_Article/associations/products/returns_products_of_the_correct_class.yml +601 -0
  29. data/spec/fixtures/vcr/Reviewed_Article/find_page/finds_a_page_with_a_matching_slug.yml +784 -0
  30. data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_a_product_of_the_correct_class.yml +1199 -0
  31. data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_nil_if_does_not_respond_to_products.yml +1199 -0
  32. data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_the_primary_product.yml +1199 -0
  33. data/spec/fixtures/vcr/Reviewed_Client/_perform/request_params/not_set/has_nil_query_params.yml +254 -0
  34. data/spec/fixtures/vcr/Reviewed_Client/_perform/request_params/set/merges_quest_params.yml +98 -0
  35. data/spec/fixtures/vcr/Reviewed_Collection/collection_data/fetches_the_first_page_by_default.yml +183 -0
  36. data/spec/fixtures/vcr/Reviewed_Collection/collection_data/is_enumerable.yml +183 -0
  37. data/spec/fixtures/vcr/Reviewed_Collection/next_page/fetches_the_next_page_of_results.yml +310 -0
  38. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/indicates_if_the_page_number_is_out_of_bounds.yml +183 -0
  39. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/indicates_whether_this_is_the_first_or_last_page.yml +183 -0
  40. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_limit_value_max_per_page_.yml +183 -0
  41. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_number_of_entries_on_the_current_page.yml +183 -0
  42. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_offset.yml +183 -0
  43. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_total_item_count.yml +183 -0
  44. data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_total_number_of_pages.yml +183 -0
  45. data/spec/fixtures/vcr/Reviewed_Collection/previous_page/fetches_the_previous_page_of_results.yml +490 -0
  46. data/spec/fixtures/vcr/Reviewed_Collection/previous_page/returns_nil_if_there_is_no_previous_page.yml +183 -0
  47. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/does_not_have_any_matching_attachments.yml +116 -0
  48. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/finds_attachments_by_tag.yml +116 -0
  49. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/has_many_attachments.yml +119 -0
  50. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/returns_all_attachments.yml +116 -0
  51. data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/returns_attachments_of_the_correct_class.yml +119 -0
  52. data/spec/fixtures/vcr/Reviewed_Product/manufacturer_specs/has_many_manufacturer_specs.yml +116 -0
  53. data/spec/fixtures/vcr/Reviewed_Product/manufacturer_specs/returns_attachments_of_the_correct_class.yml +116 -0
  54. data/spec/fixtures/vcr/Reviewed_Request/_where/filters_collections_using_other_supported_options.yml +110 -0
  55. data/spec/fixtures/vcr/Reviewed_Request/_where/returns_a_collection.yml +254 -0
  56. data/spec/fixtures/vcr/Reviewed_Request/_where/returns_an_empty_set_if_no_matching_data_was_found.yml +86 -0
  57. data/spec/fixtures/vcr/Reviewed_Request/_where/returns_the_appropriate_page_of_results.yml +288 -0
  58. data/spec/fixtures/vcr/Reviewed_Request/collection_from_response/returns_a_collection_object.yml +254 -0
  59. data/spec/fixtures/vcr/Reviewed_Request/collection_from_response/returns_objects_of_the_correct_class.yml +254 -0
  60. data/spec/fixtures/vcr/Reviewed_Request/object_from_response/returns_an_object_of_the_correct_class.yml +601 -0
  61. data/spec/product_spec.rb +8 -6
  62. data/spec/request_spec.rb +117 -0
  63. data/spec/reviewed_spec.rb +5 -31
  64. data/spec/spec_helper.rb +6 -5
  65. data/spec/website_spec.rb +1 -2
  66. metadata +111 -40
  67. data/lib/faraday/global_params.rb +0 -21
  68. data/lib/reviewed/configurable.rb +0 -26
  69. data/lib/reviewed/utils.rb +0 -21
  70. data/spec/configurable_spec.rb +0 -44
  71. data/spec/faraday/global_params_spec.rb +0 -33
  72. data/spec/fixtures/vcr/article/attachments.yml +0 -1065
  73. data/spec/fixtures/vcr/article/find_page.yml +0 -383
  74. data/spec/fixtures/vcr/article/products.yml +0 -1065
  75. data/spec/fixtures/vcr/base/article/find.yml +0 -14825
  76. data/spec/fixtures/vcr/base/where_collection.yml +0 -1203
  77. data/spec/fixtures/vcr/collection/products.yml +0 -922
  78. data/spec/fixtures/vcr/faraday/global_params/request.yml +0 -109
  79. data/spec/fixtures/vcr/faraday/global_params/request_no_params.yml +0 -885
  80. data/spec/fixtures/vcr/faraday/global_params/request_params.yml +0 -405
  81. data/spec/fixtures/vcr/product/attachments.yml +0 -221
  82. data/spec/fixtures/vcr/product/manufacturer_specs.yml +0 -194
  83. data/spec/fixtures/vcr/utils/collection.yml +0 -644
  84. data/spec/fixtures/vcr/utils/object.yml +0 -7658
  85. data/spec/fixtures/vcr/utils.yml +0 -7961
  86. data/spec/utils_spec.rb +0 -33
data/spec/utils_spec.rb DELETED
@@ -1,33 +0,0 @@
1
- require 'spec_helper.rb'
2
-
3
- describe Reviewed::Utils do
4
-
5
- class MockUtils < Reviewed::Base; end
6
-
7
- describe 'object_from_response' do
8
- use_vcr_cassette "utils/object"
9
-
10
- let(:article_id) { '509d166d60de7db97c05ce71' }
11
-
12
- it 'returns an object of the correct class' do
13
- response = MockUtils.object_from_response(:get, "articles/#{article_id}")
14
- response.should be_an_instance_of(MockUtils)
15
- end
16
- end
17
-
18
- describe 'collection_from_response' do
19
- use_vcr_cassette "utils/collection"
20
-
21
- it 'returns a collection object' do
22
- collection = MockUtils.collection_from_response(:get, "articles")
23
- collection.should be_an_instance_of(Reviewed::Collection)
24
- end
25
-
26
- it 'returns objects of the correct class' do
27
- collection = MockUtils.collection_from_response(:get, "articles")
28
- collection.items.each do |obj|
29
- obj.should be_an_instance_of(MockUtils)
30
- end
31
- end
32
- end
33
- end