sucker 1.0.0.beta.4 → 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.
Files changed (71) hide show
  1. data/CHANGELOG.md +12 -2
  2. data/README.md +5 -2
  3. data/lib/sucker.rbc +341 -0
  4. data/lib/sucker/request.rb +1 -1
  5. data/lib/sucker/request.rbc +2481 -0
  6. data/lib/sucker/response.rb +19 -7
  7. data/lib/sucker/response.rbc +1554 -0
  8. data/lib/sucker/version.rb +2 -2
  9. data/lib/sucker/version.rbc +130 -0
  10. data/spec/fixtures/asins.txt +9406 -406
  11. data/spec/fixtures/cassette_library/integration/alternate_versions.yml +27 -0
  12. data/spec/fixtures/cassette_library/integration/errors.yml +27 -0
  13. data/spec/fixtures/cassette_library/integration/france.yml +27 -0
  14. data/spec/fixtures/cassette_library/integration/images.yml +27 -0
  15. data/spec/fixtures/cassette_library/integration/item_lookup/multiple.yml +27 -0
  16. data/spec/fixtures/cassette_library/integration/item_lookup/single.yml +27 -0
  17. data/spec/fixtures/cassette_library/integration/item_search.yml +27 -0
  18. data/spec/fixtures/cassette_library/integration/japan.yml +27 -0
  19. data/spec/fixtures/cassette_library/integration/keyword_search.yml +27 -0
  20. data/spec/fixtures/cassette_library/integration/kindle.yml +27 -0
  21. data/spec/fixtures/cassette_library/integration/kindle_2.yml +27 -0
  22. data/spec/fixtures/cassette_library/integration/multiple_locales.yml +157 -0
  23. data/spec/fixtures/cassette_library/integration/power_search.yml +27 -0
  24. data/spec/fixtures/cassette_library/integration/related_items/child.yml +27 -0
  25. data/spec/fixtures/cassette_library/integration/related_items/parent.yml +27 -0
  26. data/spec/fixtures/cassette_library/integration/seller_listings_search.yml +27 -0
  27. data/spec/fixtures/cassette_library/integration/twenty_items.yml +27 -0
  28. data/spec/fixtures/cassette_library/unit/sucker/request.yml +29 -0
  29. data/spec/fixtures/cassette_library/unit/sucker/response.yml +27 -0
  30. data/spec/integration/alternate_versions_spec.rb +28 -20
  31. data/spec/integration/alternate_versions_spec.rbc +843 -0
  32. data/spec/integration/errors_spec.rb +10 -6
  33. data/spec/integration/errors_spec.rbc +964 -0
  34. data/spec/integration/france_spec.rb +33 -25
  35. data/spec/integration/france_spec.rbc +1012 -0
  36. data/spec/integration/images_spec.rb +32 -24
  37. data/spec/integration/images_spec.rbc +1047 -0
  38. data/spec/integration/item_lookup_spec.rb +11 -3
  39. data/spec/integration/item_lookup_spec.rbc +1723 -0
  40. data/spec/integration/item_search_spec.rb +6 -2
  41. data/spec/integration/item_search_spec.rbc +926 -0
  42. data/spec/integration/japan_spec.rb +27 -19
  43. data/spec/integration/japan_spec.rbc +849 -0
  44. data/spec/integration/keyword_search_spec.rb +5 -0
  45. data/spec/integration/keyword_search_spec.rbc +838 -0
  46. data/spec/integration/kindle_spec.rb +13 -5
  47. data/spec/integration/kindle_spec.rbc +1425 -0
  48. data/spec/integration/multiple_locales_spec.rb +34 -26
  49. data/spec/integration/multiple_locales_spec.rbc +1090 -0
  50. data/spec/integration/power_search_spec.rb +5 -0
  51. data/spec/integration/power_search_spec.rbc +838 -0
  52. data/spec/integration/related_items_spec.rb +41 -29
  53. data/spec/integration/related_items_spec.rbc +1228 -0
  54. data/spec/integration/seller_listing_search_spec.rb +3 -0
  55. data/spec/integration/seller_listing_search_spec.rbc +852 -0
  56. data/spec/integration/twenty_items_spec.rb +41 -34
  57. data/spec/integration/twenty_items_spec.rbc +1166 -0
  58. data/spec/spec_helper.rbc +231 -0
  59. data/spec/support/amazon.yml +3 -0
  60. data/spec/support/amazon.yml.example +1 -0
  61. data/spec/support/amazon_credentials.rbc +154 -0
  62. data/spec/support/asins.rb +6 -1
  63. data/spec/support/asins.rbc +335 -0
  64. data/spec/support/vcr.rbc +360 -0
  65. data/spec/unit/sucker/request_spec.rb +57 -23
  66. data/spec/unit/sucker/request_spec.rbc +4031 -0
  67. data/spec/unit/sucker/response_spec.rb +100 -26
  68. data/spec/unit/sucker/response_spec.rbc +3787 -0
  69. data/spec/unit/sucker_spec.rb +5 -1
  70. data/spec/unit/sucker_spec.rbc +299 -0
  71. metadata +94 -12
@@ -2,33 +2,41 @@
2
2
  require "spec_helper"
3
3
 
4
4
  module Sucker
5
- describe "A French lookup" do
6
- use_vcr_cassette "integration/france", :record => :new_episodes
7
-
8
- let(:item) do
9
- worker = Sucker.new(
10
- :locale => "fr",
11
- :key => amazon["key"],
12
- :secret => amazon["secret"])
13
-
14
- worker << {
15
- "Operation" => "ItemLookup",
16
- "IdType" => "ASIN",
17
- "Condition" => "All",
18
- "MerchantId" => "All",
19
- "ResponseGroup" => ["ItemAttributes", "OfferFull"],
20
- "ItemId" => "2070119874" }
21
- worker.get.find("Item").first
22
- end
23
5
 
24
- it "returns an item" do
25
- item.should be_an_instance_of Hash
26
- end
6
+ describe "Item lookup" do
7
+
8
+ context "in France" do
9
+
10
+ use_vcr_cassette "integration/france", :record => :new_episodes
11
+
12
+ let(:item) do
13
+ worker = Sucker.new(
14
+ :locale => "fr",
15
+ :key => amazon["key"],
16
+ :secret => amazon["secret"])
17
+
18
+ worker << {
19
+ "Operation" => "ItemLookup",
20
+ "IdType" => "ASIN",
21
+ "Condition" => "All",
22
+ "MerchantId" => "All",
23
+ "ResponseGroup" => ["ItemAttributes", "OfferFull"],
24
+ "ItemId" => "2070119874" }
25
+ worker.get.find("Item").first
26
+ end
27
+
28
+ it "returns an item" do
29
+ item.should be_an_instance_of Hash
30
+ end
31
+
32
+ it "includes requested response groups" do
33
+ item["ItemAttributes"].should be_an_instance_of Hash
34
+ item["Offers"].should be_an_instance_of Hash
35
+ item["ItemAttributes"]["Binding"].should eql "Broché"
36
+ end
27
37
 
28
- it "includes requested response groups" do
29
- item["ItemAttributes"].should be_an_instance_of Hash
30
- item["Offers"].should be_an_instance_of Hash
31
- item["ItemAttributes"]["Binding"].should eql "Broché"
32
38
  end
39
+
33
40
  end
41
+
34
42
  end
@@ -0,0 +1,1012 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 37
13
+ 5
14
+ 7
15
+ 0
16
+ 64
17
+ 47
18
+ 49
19
+ 1
20
+ 1
21
+ 15
22
+ 99
23
+ 7
24
+ 2
25
+ 65
26
+ 49
27
+ 3
28
+ 2
29
+ 13
30
+ 99
31
+ 12
32
+ 7
33
+ 4
34
+ 12
35
+ 7
36
+ 5
37
+ 12
38
+ 65
39
+ 12
40
+ 49
41
+ 6
42
+ 4
43
+ 15
44
+ 49
45
+ 4
46
+ 0
47
+ 15
48
+ 2
49
+ 11
50
+ I
51
+ 6
52
+ I
53
+ 0
54
+ I
55
+ 0
56
+ I
57
+ 0
58
+ n
59
+ p
60
+ 7
61
+ s
62
+ 11
63
+ spec_helper
64
+ x
65
+ 7
66
+ require
67
+ x
68
+ 6
69
+ Sucker
70
+ x
71
+ 11
72
+ open_module
73
+ x
74
+ 15
75
+ __module_init__
76
+ M
77
+ 1
78
+ n
79
+ n
80
+ x
81
+ 6
82
+ Sucker
83
+ i
84
+ 13
85
+ 5
86
+ 66
87
+ 5
88
+ 7
89
+ 0
90
+ 64
91
+ 56
92
+ 1
93
+ 47
94
+ 50
95
+ 2
96
+ 1
97
+ 11
98
+ I
99
+ 3
100
+ I
101
+ 0
102
+ I
103
+ 0
104
+ I
105
+ 0
106
+ n
107
+ p
108
+ 3
109
+ s
110
+ 11
111
+ Item lookup
112
+ M
113
+ 1
114
+ p
115
+ 2
116
+ x
117
+ 9
118
+ for_block
119
+ t
120
+ n
121
+ x
122
+ 6
123
+ Sucker
124
+ i
125
+ 11
126
+ 5
127
+ 7
128
+ 0
129
+ 64
130
+ 56
131
+ 1
132
+ 47
133
+ 50
134
+ 2
135
+ 1
136
+ 11
137
+ I
138
+ 4
139
+ I
140
+ 0
141
+ I
142
+ 0
143
+ I
144
+ 0
145
+ I
146
+ -2
147
+ p
148
+ 3
149
+ s
150
+ 9
151
+ in France
152
+ M
153
+ 1
154
+ p
155
+ 2
156
+ x
157
+ 9
158
+ for_block
159
+ t
160
+ n
161
+ x
162
+ 6
163
+ Sucker
164
+ i
165
+ 57
166
+ 5
167
+ 7
168
+ 0
169
+ 64
170
+ 44
171
+ 43
172
+ 1
173
+ 79
174
+ 49
175
+ 2
176
+ 1
177
+ 13
178
+ 7
179
+ 3
180
+ 7
181
+ 4
182
+ 49
183
+ 5
184
+ 2
185
+ 15
186
+ 47
187
+ 49
188
+ 6
189
+ 2
190
+ 15
191
+ 5
192
+ 7
193
+ 7
194
+ 56
195
+ 8
196
+ 47
197
+ 50
198
+ 9
199
+ 1
200
+ 15
201
+ 5
202
+ 7
203
+ 10
204
+ 64
205
+ 56
206
+ 11
207
+ 47
208
+ 50
209
+ 12
210
+ 1
211
+ 15
212
+ 5
213
+ 7
214
+ 13
215
+ 64
216
+ 56
217
+ 14
218
+ 47
219
+ 50
220
+ 12
221
+ 1
222
+ 11
223
+ I
224
+ 7
225
+ I
226
+ 0
227
+ I
228
+ 0
229
+ I
230
+ 0
231
+ I
232
+ -2
233
+ p
234
+ 15
235
+ s
236
+ 18
237
+ integration/france
238
+ x
239
+ 4
240
+ Hash
241
+ x
242
+ 16
243
+ new_from_literal
244
+ x
245
+ 6
246
+ record
247
+ x
248
+ 12
249
+ new_episodes
250
+ x
251
+ 3
252
+ []=
253
+ x
254
+ 16
255
+ use_vcr_cassette
256
+ x
257
+ 4
258
+ item
259
+ M
260
+ 1
261
+ p
262
+ 2
263
+ x
264
+ 9
265
+ for_block
266
+ t
267
+ n
268
+ x
269
+ 6
270
+ Sucker
271
+ i
272
+ 227
273
+ 45
274
+ 0
275
+ 1
276
+ 13
277
+ 71
278
+ 2
279
+ 47
280
+ 9
281
+ 71
282
+ 47
283
+ 49
284
+ 3
285
+ 0
286
+ 13
287
+ 44
288
+ 43
289
+ 4
290
+ 4
291
+ 3
292
+ 49
293
+ 5
294
+ 1
295
+ 13
296
+ 7
297
+ 6
298
+ 7
299
+ 7
300
+ 64
301
+ 49
302
+ 8
303
+ 2
304
+ 15
305
+ 13
306
+ 7
307
+ 9
308
+ 5
309
+ 48
310
+ 10
311
+ 7
312
+ 11
313
+ 64
314
+ 49
315
+ 12
316
+ 1
317
+ 49
318
+ 8
319
+ 2
320
+ 15
321
+ 13
322
+ 7
323
+ 13
324
+ 5
325
+ 48
326
+ 10
327
+ 7
328
+ 14
329
+ 64
330
+ 49
331
+ 12
332
+ 1
333
+ 49
334
+ 8
335
+ 2
336
+ 15
337
+ 47
338
+ 49
339
+ 15
340
+ 1
341
+ 15
342
+ 8
343
+ 124
344
+ 44
345
+ 43
346
+ 4
347
+ 4
348
+ 3
349
+ 49
350
+ 5
351
+ 1
352
+ 13
353
+ 7
354
+ 6
355
+ 7
356
+ 7
357
+ 64
358
+ 49
359
+ 8
360
+ 2
361
+ 15
362
+ 13
363
+ 7
364
+ 9
365
+ 5
366
+ 48
367
+ 10
368
+ 7
369
+ 11
370
+ 64
371
+ 49
372
+ 12
373
+ 1
374
+ 49
375
+ 8
376
+ 2
377
+ 15
378
+ 13
379
+ 7
380
+ 13
381
+ 5
382
+ 48
383
+ 10
384
+ 7
385
+ 14
386
+ 64
387
+ 49
388
+ 12
389
+ 1
390
+ 49
391
+ 8
392
+ 2
393
+ 15
394
+ 49
395
+ 2
396
+ 1
397
+ 19
398
+ 0
399
+ 15
400
+ 20
401
+ 0
402
+ 44
403
+ 43
404
+ 4
405
+ 4
406
+ 6
407
+ 49
408
+ 5
409
+ 1
410
+ 13
411
+ 7
412
+ 16
413
+ 64
414
+ 7
415
+ 17
416
+ 64
417
+ 49
418
+ 8
419
+ 2
420
+ 15
421
+ 13
422
+ 7
423
+ 18
424
+ 64
425
+ 7
426
+ 19
427
+ 64
428
+ 49
429
+ 8
430
+ 2
431
+ 15
432
+ 13
433
+ 7
434
+ 20
435
+ 64
436
+ 7
437
+ 21
438
+ 64
439
+ 49
440
+ 8
441
+ 2
442
+ 15
443
+ 13
444
+ 7
445
+ 22
446
+ 64
447
+ 7
448
+ 21
449
+ 64
450
+ 49
451
+ 8
452
+ 2
453
+ 15
454
+ 13
455
+ 7
456
+ 23
457
+ 64
458
+ 7
459
+ 24
460
+ 64
461
+ 7
462
+ 25
463
+ 64
464
+ 35
465
+ 2
466
+ 49
467
+ 8
468
+ 2
469
+ 15
470
+ 13
471
+ 7
472
+ 26
473
+ 64
474
+ 7
475
+ 27
476
+ 64
477
+ 49
478
+ 8
479
+ 2
480
+ 15
481
+ 49
482
+ 28
483
+ 1
484
+ 15
485
+ 20
486
+ 0
487
+ 49
488
+ 29
489
+ 0
490
+ 7
491
+ 30
492
+ 64
493
+ 49
494
+ 31
495
+ 1
496
+ 49
497
+ 32
498
+ 0
499
+ 11
500
+ I
501
+ 9
502
+ I
503
+ 1
504
+ I
505
+ 0
506
+ I
507
+ 0
508
+ I
509
+ -2
510
+ p
511
+ 33
512
+ x
513
+ 6
514
+ Sucker
515
+ n
516
+ x
517
+ 3
518
+ new
519
+ x
520
+ 8
521
+ allocate
522
+ x
523
+ 4
524
+ Hash
525
+ x
526
+ 16
527
+ new_from_literal
528
+ x
529
+ 6
530
+ locale
531
+ s
532
+ 2
533
+ fr
534
+ x
535
+ 3
536
+ []=
537
+ x
538
+ 3
539
+ key
540
+ x
541
+ 6
542
+ amazon
543
+ s
544
+ 3
545
+ key
546
+ x
547
+ 2
548
+ []
549
+ x
550
+ 6
551
+ secret
552
+ s
553
+ 6
554
+ secret
555
+ x
556
+ 10
557
+ initialize
558
+ s
559
+ 9
560
+ Operation
561
+ s
562
+ 10
563
+ ItemLookup
564
+ s
565
+ 6
566
+ IdType
567
+ s
568
+ 4
569
+ ASIN
570
+ s
571
+ 9
572
+ Condition
573
+ s
574
+ 3
575
+ All
576
+ s
577
+ 10
578
+ MerchantId
579
+ s
580
+ 13
581
+ ResponseGroup
582
+ s
583
+ 14
584
+ ItemAttributes
585
+ s
586
+ 9
587
+ OfferFull
588
+ s
589
+ 6
590
+ ItemId
591
+ s
592
+ 10
593
+ 2070119874
594
+ x
595
+ 2
596
+ <<
597
+ x
598
+ 3
599
+ get
600
+ s
601
+ 4
602
+ Item
603
+ x
604
+ 4
605
+ find
606
+ x
607
+ 5
608
+ first
609
+ p
610
+ 37
611
+ I
612
+ 0
613
+ I
614
+ c
615
+ I
616
+ 0
617
+ I
618
+ d
619
+ I
620
+ e
621
+ I
622
+ 10
623
+ I
624
+ 17
625
+ I
626
+ e
627
+ I
628
+ 21
629
+ I
630
+ f
631
+ I
632
+ 31
633
+ I
634
+ 10
635
+ I
636
+ 50
637
+ I
638
+ e
639
+ I
640
+ 5a
641
+ I
642
+ f
643
+ I
644
+ 6a
645
+ I
646
+ 10
647
+ I
648
+ 7f
649
+ I
650
+ 12
651
+ I
652
+ 81
653
+ I
654
+ 18
655
+ I
656
+ 8a
657
+ I
658
+ 13
659
+ I
660
+ 95
661
+ I
662
+ 14
663
+ I
664
+ a0
665
+ I
666
+ 15
667
+ I
668
+ ab
669
+ I
670
+ 16
671
+ I
672
+ b6
673
+ I
674
+ 17
675
+ I
676
+ c6
677
+ I
678
+ 18
679
+ I
680
+ d4
681
+ I
682
+ 19
683
+ I
684
+ e3
685
+ x
686
+ 54
687
+ /Users/snl/code/sucker/spec/integration/france_spec.rb
688
+ p
689
+ 1
690
+ x
691
+ 6
692
+ worker
693
+ x
694
+ 3
695
+ let
696
+ s
697
+ 15
698
+ returns an item
699
+ M
700
+ 1
701
+ p
702
+ 2
703
+ x
704
+ 9
705
+ for_block
706
+ t
707
+ n
708
+ x
709
+ 6
710
+ Sucker
711
+ i
712
+ 15
713
+ 5
714
+ 48
715
+ 0
716
+ 5
717
+ 45
718
+ 1
719
+ 2
720
+ 47
721
+ 49
722
+ 3
723
+ 1
724
+ 49
725
+ 4
726
+ 1
727
+ 11
728
+ I
729
+ 4
730
+ I
731
+ 0
732
+ I
733
+ 0
734
+ I
735
+ 0
736
+ I
737
+ -2
738
+ p
739
+ 5
740
+ x
741
+ 4
742
+ item
743
+ x
744
+ 4
745
+ Hash
746
+ n
747
+ x
748
+ 17
749
+ be_an_instance_of
750
+ x
751
+ 6
752
+ should
753
+ p
754
+ 5
755
+ I
756
+ 0
757
+ I
758
+ 1c
759
+ I
760
+ 0
761
+ I
762
+ 1d
763
+ I
764
+ f
765
+ x
766
+ 54
767
+ /Users/snl/code/sucker/spec/integration/france_spec.rb
768
+ p
769
+ 0
770
+ x
771
+ 2
772
+ it
773
+ s
774
+ 34
775
+ includes requested response groups
776
+ M
777
+ 1
778
+ p
779
+ 2
780
+ x
781
+ 9
782
+ for_block
783
+ t
784
+ n
785
+ x
786
+ 6
787
+ Sucker
788
+ i
789
+ 69
790
+ 5
791
+ 48
792
+ 0
793
+ 7
794
+ 1
795
+ 64
796
+ 49
797
+ 2
798
+ 1
799
+ 5
800
+ 45
801
+ 3
802
+ 4
803
+ 47
804
+ 49
805
+ 5
806
+ 1
807
+ 49
808
+ 6
809
+ 1
810
+ 15
811
+ 5
812
+ 48
813
+ 0
814
+ 7
815
+ 7
816
+ 64
817
+ 49
818
+ 2
819
+ 1
820
+ 5
821
+ 45
822
+ 3
823
+ 8
824
+ 47
825
+ 49
826
+ 5
827
+ 1
828
+ 49
829
+ 6
830
+ 1
831
+ 15
832
+ 5
833
+ 48
834
+ 0
835
+ 7
836
+ 1
837
+ 64
838
+ 49
839
+ 2
840
+ 1
841
+ 7
842
+ 9
843
+ 64
844
+ 49
845
+ 2
846
+ 1
847
+ 5
848
+ 7
849
+ 10
850
+ 64
851
+ 47
852
+ 49
853
+ 11
854
+ 1
855
+ 49
856
+ 6
857
+ 1
858
+ 11
859
+ I
860
+ 4
861
+ I
862
+ 0
863
+ I
864
+ 0
865
+ I
866
+ 0
867
+ I
868
+ -2
869
+ p
870
+ 12
871
+ x
872
+ 4
873
+ item
874
+ s
875
+ 14
876
+ ItemAttributes
877
+ x
878
+ 2
879
+ []
880
+ x
881
+ 4
882
+ Hash
883
+ n
884
+ x
885
+ 17
886
+ be_an_instance_of
887
+ x
888
+ 6
889
+ should
890
+ s
891
+ 6
892
+ Offers
893
+ n
894
+ s
895
+ 7
896
+ Binding
897
+ s
898
+ 7
899
+ Broché
900
+ x
901
+ 3
902
+ eql
903
+ p
904
+ 9
905
+ I
906
+ 0
907
+ I
908
+ 20
909
+ I
910
+ 0
911
+ I
912
+ 21
913
+ I
914
+ 15
915
+ I
916
+ 22
917
+ I
918
+ 2a
919
+ I
920
+ 23
921
+ I
922
+ 45
923
+ x
924
+ 54
925
+ /Users/snl/code/sucker/spec/integration/france_spec.rb
926
+ p
927
+ 0
928
+ p
929
+ 11
930
+ I
931
+ 0
932
+ I
933
+ 8
934
+ I
935
+ 0
936
+ I
937
+ a
938
+ I
939
+ 19
940
+ I
941
+ c
942
+ I
943
+ 23
944
+ I
945
+ 1c
946
+ I
947
+ 2e
948
+ I
949
+ 20
950
+ I
951
+ 39
952
+ x
953
+ 54
954
+ /Users/snl/code/sucker/spec/integration/france_spec.rb
955
+ p
956
+ 0
957
+ x
958
+ 7
959
+ context
960
+ p
961
+ 5
962
+ I
963
+ 0
964
+ I
965
+ 6
966
+ I
967
+ 0
968
+ I
969
+ 8
970
+ I
971
+ b
972
+ x
973
+ 54
974
+ /Users/snl/code/sucker/spec/integration/france_spec.rb
975
+ p
976
+ 0
977
+ x
978
+ 8
979
+ describe
980
+ p
981
+ 3
982
+ I
983
+ 2
984
+ I
985
+ 6
986
+ I
987
+ d
988
+ x
989
+ 54
990
+ /Users/snl/code/sucker/spec/integration/france_spec.rb
991
+ p
992
+ 0
993
+ x
994
+ 13
995
+ attach_method
996
+ p
997
+ 5
998
+ I
999
+ 0
1000
+ I
1001
+ 2
1002
+ I
1003
+ 9
1004
+ I
1005
+ 4
1006
+ I
1007
+ 25
1008
+ x
1009
+ 54
1010
+ /Users/snl/code/sucker/spec/integration/france_spec.rb
1011
+ p
1012
+ 0