sucker 1.3.0.pre → 1.3.0.pre.1

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.
@@ -75,8 +75,9 @@ module Sucker #:nodoc:
75
75
  if node.keys.size == 1 && node['__content__']
76
76
  node['__content__']
77
77
  else
78
- node.inject({}) do |attributes, key_value|
79
- attributes.merge({ key_value.first => strip_content(key_value.last) })
78
+ node.inject({}) do |attributes, kv|
79
+ k, v = kv
80
+ attributes.merge({ k => strip_content(v) })
80
81
  end
81
82
  end
82
83
  else
@@ -368,7 +368,7 @@ I
368
368
  I
369
369
  0
370
370
  I
371
- 57
371
+ 58
372
372
  I
373
373
  1
374
374
  I
@@ -376,7 +376,7 @@ I
376
376
  I
377
377
  f
378
378
  I
379
- 57
379
+ 58
380
380
  I
381
381
  10
382
382
  I
@@ -1066,7 +1066,7 @@ x
1066
1066
  13
1067
1067
  strip_content
1068
1068
  i
1069
- 43
1069
+ 51
1070
1070
  58
1071
1071
  37
1072
1072
  19
@@ -1078,6 +1078,20 @@ i
1078
1078
  15
1079
1079
  15
1080
1080
  20
1081
+ 1
1082
+ 97
1083
+ 37
1084
+ 19
1085
+ 2
1086
+ 15
1087
+ 37
1088
+ 19
1089
+ 3
1090
+ 15
1091
+ 15
1092
+ 2
1093
+ 15
1094
+ 20
1081
1095
  0
1082
1096
  44
1083
1097
  43
@@ -1088,39 +1102,33 @@ i
1088
1102
  1
1089
1103
  13
1090
1104
  20
1091
- 1
1092
- 49
1093
1105
  2
1094
- 0
1095
1106
  5
1096
1107
  20
1097
- 1
1098
- 49
1099
1108
  3
1100
- 0
1101
1109
  47
1102
1110
  49
1103
- 4
1111
+ 2
1104
1112
  1
1105
1113
  49
1106
- 5
1114
+ 3
1107
1115
  2
1108
1116
  15
1109
1117
  49
1110
- 6
1118
+ 4
1111
1119
  1
1112
1120
  11
1113
1121
  I
1114
- 9
1122
+ b
1115
1123
  I
1116
- 2
1124
+ 4
1117
1125
  I
1118
1126
  2
1119
1127
  I
1120
1128
  2
1121
1129
  n
1122
1130
  p
1123
- 7
1131
+ 5
1124
1132
  x
1125
1133
  4
1126
1134
  Hash
@@ -1128,12 +1136,6 @@ x
1128
1136
  16
1129
1137
  new_from_literal
1130
1138
  x
1131
- 5
1132
- first
1133
- x
1134
- 4
1135
- last
1136
- x
1137
1139
  13
1138
1140
  strip_content
1139
1141
  x
@@ -1143,7 +1145,7 @@ x
1143
1145
  5
1144
1146
  merge
1145
1147
  p
1146
- 5
1148
+ 7
1147
1149
  I
1148
1150
  0
1149
1151
  I
@@ -1153,18 +1155,28 @@ a
1153
1155
  I
1154
1156
  4f
1155
1157
  I
1156
- 2b
1158
+ 18
1159
+ I
1160
+ 50
1161
+ I
1162
+ 33
1157
1163
  x
1158
1164
  53
1159
1165
  /Users/hakanensari/code/sucker/lib/sucker/response.rb
1160
1166
  p
1161
- 2
1167
+ 4
1162
1168
  x
1163
1169
  10
1164
1170
  attributes
1165
1171
  x
1166
- 9
1167
- key_value
1172
+ 2
1173
+ kv
1174
+ x
1175
+ 1
1176
+ k
1177
+ x
1178
+ 1
1179
+ v
1168
1180
  x
1169
1181
  6
1170
1182
  inject
@@ -1205,7 +1217,7 @@ I
1205
1217
  I
1206
1218
  55
1207
1219
  I
1208
- 53
1220
+ 54
1209
1221
  I
1210
1222
  58
1211
1223
  x
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Sucker #:nodoc:
4
- VERSION = '1.3.0.pre'
4
+ VERSION = '1.3.0.pre.1'
5
5
  end
@@ -0,0 +1,26 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://ecs.amazonaws.com:80/onca/xml?AWSAccessKeyId=0ZVSQ33MDFPQS8H2PM02&AssociateTag=&Item.1.OfferListingId=WSReoMTNALmhJ3mGNmN%252F2qM5STM7XztgIbIq98B9udGTQ4i6%252BLF9vUkV2WtpuSLH5GOBdGViiaw3ua7d7dvZ5A7XW61Bp5El1qkYbnlEjZR7NBmVenMkDRcoVc%252FUWl2kiozSiltYkEs%253D&Item.1.Quantity=1&Operation=CartCreate&Service=AWSECommerceService&Signature=QCKGDO2XcdTQ99VyWiuL3odqvmkupfn7JmsKb75Fel0=&Timestamp=2011-02-17T15:45:42Z&Version=2010-11-01
6
+ body:
7
+ headers:
8
+ response: !ruby/struct:VCR::Response
9
+ status: !ruby/struct:VCR::ResponseStatus
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ date:
14
+ - Thu, 17 Feb 2011 15:45:42 GMT
15
+ server:
16
+ - Server
17
+ content-type:
18
+ - text/xml;charset=UTF-8
19
+ vary:
20
+ - Accept-Encoding,User-Agent
21
+ nncoection:
22
+ - close
23
+ transfer-encoding:
24
+ - chunked
25
+ body: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CartCreateResponse xmlns=\"http://webservices.amazon.com/AWSECommerceService/2010-11-01\"><OperationRequest><HTTPHeaders><Header Name=\"UserAgent\" Value=\"Ruby\"></Header></HTTPHeaders><RequestId>17QG3H7YESTS9XD3SXCF</RequestId><Arguments><Argument Name=\"AssociateTag\"></Argument><Argument Name=\"Service\" Value=\"AWSECommerceService\"></Argument><Argument Name=\"Signature\" Value=\"QCKGDO2XcdTQ99VyWiuL3odqvmkupfn7JmsKb75Fel0=\"></Argument><Argument Name=\"Item.1.OfferListingId\" Value=\"WSReoMTNALmhJ3mGNmN%2F2qM5STM7XztgIbIq98B9udGTQ4i6%2BLF9vUkV2WtpuSLH5GOBdGViiaw3ua7d7dvZ5A7XW61Bp5El1qkYbnlEjZR7NBmVenMkDRcoVc%2FUWl2kiozSiltYkEs%3D\"></Argument><Argument Name=\"Item.1.Quantity\" Value=\"1\"></Argument><Argument Name=\"Operation\" Value=\"CartCreate\"></Argument><Argument Name=\"AWSAccessKeyId\" Value=\"0ZVSQ33MDFPQS8H2PM02\"></Argument><Argument Name=\"Version\" Value=\"2010-11-01\"></Argument><Argument Name=\"Timestamp\" Value=\"2011-02-17T15:45:42Z\"></Argument></Arguments><RequestProcessingTime>0.106905221939087</RequestProcessingTime></OperationRequest><Cart><Request><IsValid>True</IsValid><CartCreateRequest><Items><Item><OfferListingId>WSReoMTNALmhJ3mGNmN%2F2qM5STM7XztgIbIq98B9udGTQ4i6%2BLF9vUkV2WtpuSLH5GOBdGViiaw3ua7d7dvZ5A7XW61Bp5El1qkYbnlEjZR7NBmVenMkDRcoVc%2FUWl2kiozSiltYkEs%3D</OfferListingId><Quantity>1</Quantity></Item></Items></CartCreateRequest></Request><CartId>185-6117230-6543660</CartId><HMAC>7Fy6BWTGMqMlccmkzGsBMtmAvYM=</HMAC><URLEncodedHMAC>7Fy6BWTGMqMlccmkzGsBMtmAvYM%3D</URLEncodedHMAC><PurchaseURL>https://www.amazon.com/gp/cart/aws-merge.html?cart-id=185-6117230-6543660%26associate-id=ws%26hmac=7Fy6BWTGMqMlccmkzGsBMtmAvYM=%26SubscriptionId=0ZVSQ33MDFPQS8H2PM02%26MergeCart=False</PurchaseURL><SubTotal><Amount>1698</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$16.98</FormattedPrice></SubTotal><CartItems><SubTotal><Amount>1698</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$16.98</FormattedPrice></SubTotal><CartItem><CartItemId>UR37WFOU7FIHB</CartItemId><ASIN>0816614024</ASIN><ExchangeId>Y11M5079532M1477840</ExchangeId><MerchantId>AM6SI1Y13JQ1J</MerchantId><SellerId>AM6SI1Y13JQ1J</SellerId><SellerNickname>booksrevisited</SellerNickname><Quantity>1</Quantity><Title>Thousand Plateaus: Capitalism and Schizophrenia</Title><ProductGroup>Book</ProductGroup><Price><Amount>1698</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$16.98</FormattedPrice></Price><ItemTotal><Amount>1698</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$16.98</FormattedPrice></ItemTotal></CartItem></CartItems></Cart></CartCreateResponse>"
26
+ http_version: "1.1"
@@ -19,9 +19,18 @@ module Sucker
19
19
  end
20
20
 
21
21
  describe '#get' do
22
- context 'when no argument is passed' do
23
- it 'returns a response' do
24
- worker.get.class.ancestors.should include Response
22
+ it 'returns a response' do
23
+ worker.get.class.ancestors.should include Response
24
+ end
25
+
26
+ context 'when local IP is specified' do
27
+ before do
28
+ worker.local_ip = '192.168.0.1'
29
+ end
30
+
31
+ it 'routes request through that IP' do
32
+ pending('Figure out how to test this')
33
+ worker.get
25
34
  end
26
35
  end
27
36
  end
@@ -83,11 +92,5 @@ module Sucker
83
92
  worker.send(:host).should eql 'ecs.amazonaws.fr'
84
93
  end
85
94
  end
86
-
87
- describe '#uri' do
88
- it 'returns the URI with which to query Amazon' do
89
- worker.send(:uri).should be_an_instance_of URI::HTTP
90
- end
91
- end
92
95
  end
93
96
  end
@@ -695,7 +695,7 @@ x
695
695
  6
696
696
  Sucker
697
697
  i
698
- 11
698
+ 22
699
699
  5
700
700
  7
701
701
  0
@@ -706,45 +706,16 @@ i
706
706
  50
707
707
  2
708
708
  1
709
- 11
710
- I
711
- 4
712
- I
713
- 0
714
- I
715
- 0
716
- I
717
- 0
718
- I
719
- -2
720
- p
721
- 3
722
- s
723
- 26
724
- when no argument is passed
725
- M
726
- 1
727
- p
728
- 2
729
- x
730
- 9
731
- for_block
732
- t
733
- n
734
- x
735
- 6
736
- Sucker
737
- i
738
- 11
709
+ 15
739
710
  5
740
711
  7
741
- 0
712
+ 3
742
713
  64
743
714
  56
744
- 1
715
+ 4
745
716
  47
746
717
  50
747
- 2
718
+ 5
748
719
  1
749
720
  11
750
721
  I
@@ -758,7 +729,7 @@ I
758
729
  I
759
730
  -2
760
731
  p
761
- 3
732
+ 6
762
733
  s
763
734
  18
764
735
  returns a response
@@ -839,7 +810,7 @@ p
839
810
  I
840
811
  0
841
812
  I
842
- 18
813
+ 17
843
814
  I
844
815
  18
845
816
  x
@@ -850,14 +821,208 @@ p
850
821
  x
851
822
  2
852
823
  it
824
+ s
825
+ 26
826
+ when local IP is specified
827
+ M
828
+ 1
853
829
  p
830
+ 2
831
+ x
832
+ 9
833
+ for_block
834
+ t
835
+ n
836
+ x
837
+ 6
838
+ Sucker
839
+ i
840
+ 19
841
+ 5
842
+ 56
843
+ 0
844
+ 47
845
+ 50
846
+ 1
847
+ 0
848
+ 15
849
+ 5
850
+ 7
851
+ 2
852
+ 64
853
+ 56
854
854
  3
855
+ 47
856
+ 50
857
+ 4
858
+ 1
859
+ 11
860
+ I
861
+ 4
855
862
  I
856
863
  0
857
864
  I
858
- 17
865
+ 0
859
866
  I
860
- b
867
+ 0
868
+ I
869
+ -2
870
+ p
871
+ 5
872
+ M
873
+ 1
874
+ p
875
+ 2
876
+ x
877
+ 9
878
+ for_block
879
+ t
880
+ n
881
+ x
882
+ 6
883
+ Sucker
884
+ i
885
+ 14
886
+ 5
887
+ 48
888
+ 0
889
+ 7
890
+ 1
891
+ 64
892
+ 13
893
+ 18
894
+ 2
895
+ 49
896
+ 2
897
+ 1
898
+ 15
899
+ 11
900
+ I
901
+ 4
902
+ I
903
+ 0
904
+ I
905
+ 0
906
+ I
907
+ 0
908
+ I
909
+ -2
910
+ p
911
+ 3
912
+ x
913
+ 6
914
+ worker
915
+ s
916
+ 11
917
+ 192.168.0.1
918
+ x
919
+ 9
920
+ local_ip=
921
+ p
922
+ 3
923
+ I
924
+ 0
925
+ I
926
+ 1c
927
+ I
928
+ e
929
+ x
930
+ 58
931
+ /Users/hakanensari/code/sucker/spec/sucker/request_spec.rb
932
+ p
933
+ 0
934
+ x
935
+ 6
936
+ before
937
+ s
938
+ 30
939
+ routes request through that IP
940
+ M
941
+ 1
942
+ p
943
+ 2
944
+ x
945
+ 9
946
+ for_block
947
+ t
948
+ n
949
+ x
950
+ 6
951
+ Sucker
952
+ i
953
+ 16
954
+ 5
955
+ 7
956
+ 0
957
+ 64
958
+ 47
959
+ 49
960
+ 1
961
+ 1
962
+ 15
963
+ 5
964
+ 48
965
+ 2
966
+ 49
967
+ 3
968
+ 0
969
+ 11
970
+ I
971
+ 3
972
+ I
973
+ 0
974
+ I
975
+ 0
976
+ I
977
+ 0
978
+ I
979
+ -2
980
+ p
981
+ 4
982
+ s
983
+ 27
984
+ Figure out how to test this
985
+ x
986
+ 7
987
+ pending
988
+ x
989
+ 6
990
+ worker
991
+ x
992
+ 3
993
+ get
994
+ p
995
+ 5
996
+ I
997
+ 0
998
+ I
999
+ 20
1000
+ I
1001
+ 9
1002
+ I
1003
+ 21
1004
+ I
1005
+ 10
1006
+ x
1007
+ 58
1008
+ /Users/hakanensari/code/sucker/spec/sucker/request_spec.rb
1009
+ p
1010
+ 0
1011
+ x
1012
+ 2
1013
+ it
1014
+ p
1015
+ 5
1016
+ I
1017
+ 0
1018
+ I
1019
+ 1b
1020
+ I
1021
+ 8
1022
+ I
1023
+ 1f
1024
+ I
1025
+ 13
861
1026
  x
862
1027
  58
863
1028
  /Users/hakanensari/code/sucker/spec/sucker/request_spec.rb
@@ -867,13 +1032,17 @@ x
867
1032
  7
868
1033
  context
869
1034
  p
870
- 3
1035
+ 5
871
1036
  I
872
1037
  0
873
1038
  I
874
1039
  16
875
1040
  I
876
1041
  b
1042
+ I
1043
+ 1a
1044
+ I
1045
+ 16
877
1046
  x
878
1047
  58
879
1048
  /Users/hakanensari/code/sucker/spec/sucker/request_spec.rb
@@ -1015,11 +1184,11 @@ p
1015
1184
  I
1016
1185
  0
1017
1186
  I
1018
- 1f
1187
+ 28
1019
1188
  I
1020
1189
  e
1021
1190
  I
1022
- 20
1191
+ 29
1023
1192
  I
1024
1193
  26
1025
1194
  x
@@ -1035,7 +1204,7 @@ p
1035
1204
  I
1036
1205
  0
1037
1206
  I
1038
- 1e
1207
+ 27
1039
1208
  I
1040
1209
  b
1041
1210
  x
@@ -1167,7 +1336,7 @@ p
1167
1336
  I
1168
1337
  0
1169
1338
  I
1170
- 26
1339
+ 2f
1171
1340
  I
1172
1341
  9
1173
1342
  x
@@ -1261,7 +1430,7 @@ p
1261
1430
  I
1262
1431
  0
1263
1432
  I
1264
- 2a
1433
+ 33
1265
1434
  I
1266
1435
  1e
1267
1436
  x
@@ -1333,7 +1502,7 @@ p
1333
1502
  I
1334
1503
  0
1335
1504
  I
1336
- 2e
1505
+ 37
1337
1506
  I
1338
1507
  f
1339
1508
  x
@@ -1459,11 +1628,11 @@ p
1459
1628
  I
1460
1629
  0
1461
1630
  I
1462
- 32
1631
+ 3b
1463
1632
  I
1464
1633
  14
1465
1634
  I
1466
- 33
1635
+ 3c
1467
1636
  I
1468
1637
  32
1469
1638
  x
@@ -1476,19 +1645,19 @@ p
1476
1645
  I
1477
1646
  0
1478
1647
  I
1479
- 25
1648
+ 2e
1480
1649
  I
1481
1650
  a
1482
1651
  I
1483
- 29
1652
+ 32
1484
1653
  I
1485
1654
  15
1486
1655
  I
1487
- 2d
1656
+ 36
1488
1657
  I
1489
1658
  20
1490
1659
  I
1491
- 31
1660
+ 3a
1492
1661
  I
1493
1662
  2b
1494
1663
  x
@@ -1620,7 +1789,7 @@ p
1620
1789
  I
1621
1790
  0
1622
1791
  I
1623
- 38
1792
+ 41
1624
1793
  I
1625
1794
  9
1626
1795
  x
@@ -1715,11 +1884,11 @@ p
1715
1884
  I
1716
1885
  0
1717
1886
  I
1718
- 3b
1887
+ 44
1719
1888
  I
1720
1889
  e
1721
1890
  I
1722
- 3c
1891
+ 45
1723
1892
  I
1724
1893
  1d
1725
1894
  x
@@ -1814,11 +1983,11 @@ p
1814
1983
  I
1815
1984
  0
1816
1985
  I
1817
- 40
1986
+ 49
1818
1987
  I
1819
1988
  e
1820
1989
  I
1821
- 41
1990
+ 4a
1822
1991
  I
1823
1992
  1d
1824
1993
  x
@@ -1903,11 +2072,11 @@ p
1903
2072
  I
1904
2073
  0
1905
2074
  I
1906
- 45
2075
+ 4e
1907
2076
  I
1908
2077
  b
1909
2078
  I
1910
- 46
2079
+ 4f
1911
2080
  I
1912
2081
  19
1913
2082
  x
@@ -1923,19 +2092,19 @@ p
1923
2092
  I
1924
2093
  0
1925
2094
  I
1926
- 38
2095
+ 41
1927
2096
  I
1928
2097
  a
1929
2098
  I
1930
- 3a
2099
+ 43
1931
2100
  I
1932
2101
  15
1933
2102
  I
1934
- 3f
2103
+ 48
1935
2104
  I
1936
2105
  20
1937
2106
  I
1938
- 44
2107
+ 4d
1939
2108
  I
1940
2109
  2b
1941
2110
  x
@@ -2061,7 +2230,7 @@ p
2061
2230
  I
2062
2231
  0
2063
2232
  I
2064
- 4c
2233
+ 55
2065
2234
  I
2066
2235
  17
2067
2236
  x
@@ -2077,7 +2246,7 @@ p
2077
2246
  I
2078
2247
  0
2079
2248
  I
2080
- 4b
2249
+ 54
2081
2250
  I
2082
2251
  b
2083
2252
  x
@@ -2216,11 +2385,11 @@ p
2216
2385
  I
2217
2386
  0
2218
2387
  I
2219
- 52
2388
+ 5b
2220
2389
  I
2221
2390
  d
2222
2391
  I
2223
- 53
2392
+ 5c
2224
2393
  I
2225
2394
  21
2226
2395
  x
@@ -2236,7 +2405,7 @@ p
2236
2405
  I
2237
2406
  0
2238
2407
  I
2239
- 51
2408
+ 5a
2240
2409
  I
2241
2410
  b
2242
2411
  x
@@ -2362,7 +2531,7 @@ p
2362
2531
  I
2363
2532
  0
2364
2533
  I
2365
- 59
2534
+ 62
2366
2535
  I
2367
2536
  16
2368
2537
  x
@@ -2378,7 +2547,7 @@ p
2378
2547
  I
2379
2548
  0
2380
2549
  I
2381
- 58
2550
+ 61
2382
2551
  I
2383
2552
  b
2384
2553
  x
@@ -2407,27 +2576,27 @@ I
2407
2576
  I
2408
2577
  39
2409
2578
  I
2410
- 1d
2579
+ 26
2411
2580
  I
2412
2581
  44
2413
2582
  I
2414
- 24
2583
+ 2d
2415
2584
  I
2416
2585
  4f
2417
2586
  I
2418
- 37
2587
+ 40
2419
2588
  I
2420
2589
  5a
2421
2590
  I
2422
- 4a
2591
+ 53
2423
2592
  I
2424
2593
  65
2425
2594
  I
2426
- 50
2595
+ 59
2427
2596
  I
2428
2597
  70
2429
2598
  I
2430
- 57
2599
+ 60
2431
2600
  I
2432
2601
  7b
2433
2602
  x