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
@@ -2,26 +2,34 @@
2
2
  require "spec_helper"
3
3
 
4
4
  module Sucker
5
- describe "A Japanese request" do
6
- use_vcr_cassette "integration/japan", :record => :new_episodes
7
-
8
- let(:item) do
9
- worker = Sucker.new(
10
- :locale => "jp",
11
- :key => amazon["key"],
12
- :secret => amazon["secret"])
13
-
14
- worker << {
15
- "Operation" => "ItemLookup",
16
- "IdType" => "ASIN",
17
- "ResponseGroup" => ["ItemAttributes", "OfferFull"],
18
- "ItemId" => "482224816X" }
19
- worker.get.find("Item").first
20
- end
21
5
 
22
- it "returns an array of items" do
23
- item.should be_an_instance_of Hash
24
- item["ItemAttributes"]["Binding"].should eql "単行本(ソフトカバー)"
6
+ describe "Item lookup" do
7
+
8
+ context "in Japan" do
9
+
10
+ use_vcr_cassette "integration/japan", :record => :new_episodes
11
+
12
+ let(:item) do
13
+ worker = Sucker.new(
14
+ :locale => "jp",
15
+ :key => amazon["key"],
16
+ :secret => amazon["secret"])
17
+
18
+ worker << {
19
+ "Operation" => "ItemLookup",
20
+ "IdType" => "ASIN",
21
+ "ResponseGroup" => ["ItemAttributes", "OfferFull"],
22
+ "ItemId" => "482224816X" }
23
+ worker.get.find("Item").first
24
+ end
25
+
26
+ it "returns items in Japanese" do
27
+ item.should be_an_instance_of Hash
28
+ item["ItemAttributes"]["Binding"].should eql "単行本(ソフトカバー)"
29
+ end
30
+
25
31
  end
32
+
26
33
  end
34
+
27
35
  end
@@ -0,0 +1,849 @@
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
+ 8
151
+ in Japan
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
+ 46
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
+ 11
212
+ I
213
+ 7
214
+ I
215
+ 0
216
+ I
217
+ 0
218
+ I
219
+ 0
220
+ I
221
+ -2
222
+ p
223
+ 13
224
+ s
225
+ 17
226
+ integration/japan
227
+ x
228
+ 4
229
+ Hash
230
+ x
231
+ 16
232
+ new_from_literal
233
+ x
234
+ 6
235
+ record
236
+ x
237
+ 12
238
+ new_episodes
239
+ x
240
+ 3
241
+ []=
242
+ x
243
+ 16
244
+ use_vcr_cassette
245
+ x
246
+ 4
247
+ item
248
+ M
249
+ 1
250
+ p
251
+ 2
252
+ x
253
+ 9
254
+ for_block
255
+ t
256
+ n
257
+ x
258
+ 6
259
+ Sucker
260
+ i
261
+ 205
262
+ 45
263
+ 0
264
+ 1
265
+ 13
266
+ 71
267
+ 2
268
+ 47
269
+ 9
270
+ 71
271
+ 47
272
+ 49
273
+ 3
274
+ 0
275
+ 13
276
+ 44
277
+ 43
278
+ 4
279
+ 4
280
+ 3
281
+ 49
282
+ 5
283
+ 1
284
+ 13
285
+ 7
286
+ 6
287
+ 7
288
+ 7
289
+ 64
290
+ 49
291
+ 8
292
+ 2
293
+ 15
294
+ 13
295
+ 7
296
+ 9
297
+ 5
298
+ 48
299
+ 10
300
+ 7
301
+ 11
302
+ 64
303
+ 49
304
+ 12
305
+ 1
306
+ 49
307
+ 8
308
+ 2
309
+ 15
310
+ 13
311
+ 7
312
+ 13
313
+ 5
314
+ 48
315
+ 10
316
+ 7
317
+ 14
318
+ 64
319
+ 49
320
+ 12
321
+ 1
322
+ 49
323
+ 8
324
+ 2
325
+ 15
326
+ 47
327
+ 49
328
+ 15
329
+ 1
330
+ 15
331
+ 8
332
+ 124
333
+ 44
334
+ 43
335
+ 4
336
+ 4
337
+ 3
338
+ 49
339
+ 5
340
+ 1
341
+ 13
342
+ 7
343
+ 6
344
+ 7
345
+ 7
346
+ 64
347
+ 49
348
+ 8
349
+ 2
350
+ 15
351
+ 13
352
+ 7
353
+ 9
354
+ 5
355
+ 48
356
+ 10
357
+ 7
358
+ 11
359
+ 64
360
+ 49
361
+ 12
362
+ 1
363
+ 49
364
+ 8
365
+ 2
366
+ 15
367
+ 13
368
+ 7
369
+ 13
370
+ 5
371
+ 48
372
+ 10
373
+ 7
374
+ 14
375
+ 64
376
+ 49
377
+ 12
378
+ 1
379
+ 49
380
+ 8
381
+ 2
382
+ 15
383
+ 49
384
+ 2
385
+ 1
386
+ 19
387
+ 0
388
+ 15
389
+ 20
390
+ 0
391
+ 44
392
+ 43
393
+ 4
394
+ 4
395
+ 4
396
+ 49
397
+ 5
398
+ 1
399
+ 13
400
+ 7
401
+ 16
402
+ 64
403
+ 7
404
+ 17
405
+ 64
406
+ 49
407
+ 8
408
+ 2
409
+ 15
410
+ 13
411
+ 7
412
+ 18
413
+ 64
414
+ 7
415
+ 19
416
+ 64
417
+ 49
418
+ 8
419
+ 2
420
+ 15
421
+ 13
422
+ 7
423
+ 20
424
+ 64
425
+ 7
426
+ 21
427
+ 64
428
+ 7
429
+ 22
430
+ 64
431
+ 35
432
+ 2
433
+ 49
434
+ 8
435
+ 2
436
+ 15
437
+ 13
438
+ 7
439
+ 23
440
+ 64
441
+ 7
442
+ 24
443
+ 64
444
+ 49
445
+ 8
446
+ 2
447
+ 15
448
+ 49
449
+ 25
450
+ 1
451
+ 15
452
+ 20
453
+ 0
454
+ 49
455
+ 26
456
+ 0
457
+ 7
458
+ 27
459
+ 64
460
+ 49
461
+ 28
462
+ 1
463
+ 49
464
+ 29
465
+ 0
466
+ 11
467
+ I
468
+ 9
469
+ I
470
+ 1
471
+ I
472
+ 0
473
+ I
474
+ 0
475
+ I
476
+ -2
477
+ p
478
+ 30
479
+ x
480
+ 6
481
+ Sucker
482
+ n
483
+ x
484
+ 3
485
+ new
486
+ x
487
+ 8
488
+ allocate
489
+ x
490
+ 4
491
+ Hash
492
+ x
493
+ 16
494
+ new_from_literal
495
+ x
496
+ 6
497
+ locale
498
+ s
499
+ 2
500
+ jp
501
+ x
502
+ 3
503
+ []=
504
+ x
505
+ 3
506
+ key
507
+ x
508
+ 6
509
+ amazon
510
+ s
511
+ 3
512
+ key
513
+ x
514
+ 2
515
+ []
516
+ x
517
+ 6
518
+ secret
519
+ s
520
+ 6
521
+ secret
522
+ x
523
+ 10
524
+ initialize
525
+ s
526
+ 9
527
+ Operation
528
+ s
529
+ 10
530
+ ItemLookup
531
+ s
532
+ 6
533
+ IdType
534
+ s
535
+ 4
536
+ ASIN
537
+ s
538
+ 13
539
+ ResponseGroup
540
+ s
541
+ 14
542
+ ItemAttributes
543
+ s
544
+ 9
545
+ OfferFull
546
+ s
547
+ 6
548
+ ItemId
549
+ s
550
+ 10
551
+ 482224816X
552
+ x
553
+ 2
554
+ <<
555
+ x
556
+ 3
557
+ get
558
+ s
559
+ 4
560
+ Item
561
+ x
562
+ 4
563
+ find
564
+ x
565
+ 5
566
+ first
567
+ p
568
+ 33
569
+ I
570
+ 0
571
+ I
572
+ c
573
+ I
574
+ 0
575
+ I
576
+ d
577
+ I
578
+ e
579
+ I
580
+ 10
581
+ I
582
+ 17
583
+ I
584
+ e
585
+ I
586
+ 21
587
+ I
588
+ f
589
+ I
590
+ 31
591
+ I
592
+ 10
593
+ I
594
+ 50
595
+ I
596
+ e
597
+ I
598
+ 5a
599
+ I
600
+ f
601
+ I
602
+ 6a
603
+ I
604
+ 10
605
+ I
606
+ 7f
607
+ I
608
+ 12
609
+ I
610
+ 81
611
+ I
612
+ 16
613
+ I
614
+ 8a
615
+ I
616
+ 13
617
+ I
618
+ 95
619
+ I
620
+ 14
621
+ I
622
+ a0
623
+ I
624
+ 15
625
+ I
626
+ b0
627
+ I
628
+ 16
629
+ I
630
+ be
631
+ I
632
+ 17
633
+ I
634
+ cd
635
+ x
636
+ 53
637
+ /Users/snl/code/sucker/spec/integration/japan_spec.rb
638
+ p
639
+ 1
640
+ x
641
+ 6
642
+ worker
643
+ x
644
+ 3
645
+ let
646
+ s
647
+ 25
648
+ returns items in Japanese
649
+ M
650
+ 1
651
+ p
652
+ 2
653
+ x
654
+ 9
655
+ for_block
656
+ t
657
+ n
658
+ x
659
+ 6
660
+ Sucker
661
+ i
662
+ 42
663
+ 5
664
+ 48
665
+ 0
666
+ 5
667
+ 45
668
+ 1
669
+ 2
670
+ 47
671
+ 49
672
+ 3
673
+ 1
674
+ 49
675
+ 4
676
+ 1
677
+ 15
678
+ 5
679
+ 48
680
+ 0
681
+ 7
682
+ 5
683
+ 64
684
+ 49
685
+ 6
686
+ 1
687
+ 7
688
+ 7
689
+ 64
690
+ 49
691
+ 6
692
+ 1
693
+ 5
694
+ 7
695
+ 8
696
+ 64
697
+ 47
698
+ 49
699
+ 9
700
+ 1
701
+ 49
702
+ 4
703
+ 1
704
+ 11
705
+ I
706
+ 4
707
+ I
708
+ 0
709
+ I
710
+ 0
711
+ I
712
+ 0
713
+ I
714
+ -2
715
+ p
716
+ 10
717
+ x
718
+ 4
719
+ item
720
+ x
721
+ 4
722
+ Hash
723
+ n
724
+ x
725
+ 17
726
+ be_an_instance_of
727
+ x
728
+ 6
729
+ should
730
+ s
731
+ 14
732
+ ItemAttributes
733
+ x
734
+ 2
735
+ []
736
+ s
737
+ 7
738
+ Binding
739
+ s
740
+ 33
741
+ 単行本(ソフトカバー)
742
+ x
743
+ 3
744
+ eql
745
+ p
746
+ 7
747
+ I
748
+ 0
749
+ I
750
+ 1a
751
+ I
752
+ 0
753
+ I
754
+ 1b
755
+ I
756
+ f
757
+ I
758
+ 1c
759
+ I
760
+ 2a
761
+ x
762
+ 53
763
+ /Users/snl/code/sucker/spec/integration/japan_spec.rb
764
+ p
765
+ 0
766
+ x
767
+ 2
768
+ it
769
+ p
770
+ 9
771
+ I
772
+ 0
773
+ I
774
+ 8
775
+ I
776
+ 0
777
+ I
778
+ a
779
+ I
780
+ 19
781
+ I
782
+ c
783
+ I
784
+ 23
785
+ I
786
+ 1a
787
+ I
788
+ 2e
789
+ x
790
+ 53
791
+ /Users/snl/code/sucker/spec/integration/japan_spec.rb
792
+ p
793
+ 0
794
+ x
795
+ 7
796
+ context
797
+ p
798
+ 5
799
+ I
800
+ 0
801
+ I
802
+ 6
803
+ I
804
+ 0
805
+ I
806
+ 8
807
+ I
808
+ b
809
+ x
810
+ 53
811
+ /Users/snl/code/sucker/spec/integration/japan_spec.rb
812
+ p
813
+ 0
814
+ x
815
+ 8
816
+ describe
817
+ p
818
+ 3
819
+ I
820
+ 2
821
+ I
822
+ 6
823
+ I
824
+ d
825
+ x
826
+ 53
827
+ /Users/snl/code/sucker/spec/integration/japan_spec.rb
828
+ p
829
+ 0
830
+ x
831
+ 13
832
+ attach_method
833
+ p
834
+ 5
835
+ I
836
+ 0
837
+ I
838
+ 2
839
+ I
840
+ 9
841
+ I
842
+ 4
843
+ I
844
+ 25
845
+ x
846
+ 53
847
+ /Users/snl/code/sucker/spec/integration/japan_spec.rb
848
+ p
849
+ 0