sucker 1.0.0.beta.4 → 1.0.0

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