cafepress_api 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,5 +15,5 @@
15
15
  # along with CafePressAPI. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
  module CafePressAPI
18
- VERSION = "0.1.4"
18
+ VERSION = "0.2.0"
19
19
  end
data/lib/cafepress_api.rb CHANGED
@@ -63,14 +63,27 @@ module CafePressAPI
63
63
  \nWARNING: the product with defaultCaption '#{product.attributes['defaultCaption']}' and merchandiseId #{product.attributes['merchandiseId']} does not exist in the gender mapping!\n
64
64
  Please send benjamin.lee.smith@gmail.com an email and copy/paste this warning message.\n
65
65
  Or better yet, add the mapping yourself in product_genders.rb and submit it back https://github.com/benjaminleesmith/cafepress_api\n
66
- %})
66
+ })
67
67
  end
68
68
  end
69
69
 
70
70
  # The CafePress API (at the time of this code) doesn't correctly return
71
71
  # product images only for the colors which are available for the product.
72
72
  # as such, I am filtering out "invalid" colors from the productUrl(s)
73
- valid_color_ids = product.get_elements('color').map{|color| color.attributes['id']}
73
+ valid_color_ids = []
74
+ product.get_elements('color').each do |color|
75
+ color_id = color.attributes['id']
76
+ valid_color_ids << color.attributes['id']
77
+
78
+ # Check to see if this color should be added to ProductColors
79
+ if COLORS[color_id].nil?
80
+ warn(%{
81
+ \nWARNING: the color with id "#{color_id}", name "#{color.attributes['name']}", merchandiseId "#{product.attributes['merchandiseId']}", and colorSwatchUrl "#{color.attributes['colorSwatchUrl']}" does not exist in the color mapping!\n
82
+ Please send benjamin.lee.smith@gmail.com an email and copy/paste this warning message.\n
83
+ Or better yet, add the mapping yourself in product_colors.rb and submit it back https://github.com/benjaminleesmith/cafepress_api\n
84
+ })
85
+ end
86
+ end
74
87
 
75
88
  image_urls = []
76
89
  product.get_elements("productImage").each do |product_image|
@@ -1,11 +1,644 @@
1
+ # Copyright 2011 Benjamin Lee Smith <benjamin.lee.smith@gmail.com>
2
+ #
3
+ # This file is part of CafePressAPI.
4
+ # CafePressAPI is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # CafePressAPI is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with CafePressAPI. If not, see <http://www.gnu.org/licenses/>.
16
+
1
17
  # Mapping between colors and colorIds
2
18
  module ProductColors
3
- # color_id => color_description
4
- COLOR_DESCRIPTIONS = {
5
- '6' => 'Black',
6
- '9' => 'Red',
7
- '26' => 'Navy',
8
- '28' => 'Brown',
9
- '89' => 'SportGrey'
19
+ COLORS = {
20
+ '1' => {
21
+ :description => 'White',
22
+ :merchandise_swatches => {
23
+ '2' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
24
+ '4' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_sweatshirt_white.gif',
25
+ '5' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
26
+ '6' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womens_jrjersey_white.jpg',
27
+ '15' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
28
+ '23' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_hoodedsweatshirt_white.gif',
29
+ '26' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_cap_white.gif',
30
+ '42' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_42_c1.gif',
31
+ '45' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
32
+ '69' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_infanttoddlertshirt_white.gif',
33
+ '70' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
34
+ '80' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
35
+ '89' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
36
+ '96' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_infantbodysuit_white.gif',
37
+ '103' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
38
+ '106' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
39
+ '110' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
40
+ '112' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
41
+ '115' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
42
+ '140' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_cap_white.gif',
43
+ '165' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
44
+ '166' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
45
+ '183' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
46
+ '185' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
47
+ '189' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_white.gif',
48
+ '250' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_250_c1.gif',
49
+ '252' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_252_c1.gif',
50
+ '280' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_280_c1.gif',
51
+ '281' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_281_c1.gif',
52
+ '288' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_288_c1.gif',
53
+ '358' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_358_c1.gif',
54
+ '359' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_359_c1.gif',
55
+ '434' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_434_c1.gif',
56
+ '441' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_441_c1.gif',
57
+ '443' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_443_c1.gif',
58
+ '444' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_444_c1.gif',
59
+ '459' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_459_c1.gif',
60
+ '460' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_460_c1.gif',
61
+ }
62
+ },
63
+ '2' => {
64
+ :description => 'Khaki',
65
+ :merchandise_swatches => {
66
+ '42' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_42_c2.gif',
67
+ '140' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_cap_khaki.gif',
68
+ }
69
+ },
70
+ '4' => {
71
+ :description => 'Black/White',
72
+ :merchandise_swatches => {
73
+ '38' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_baseballjersey_blackwhite.gif',
74
+ '101' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_truckerhat_blackwhite.gif',
75
+ '102' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_jrraglan_blackwhite.gif',
76
+ '126' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_ringert_blackwhite.gif',
77
+ '128' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womensraglanhoodie_blackwhite.gif',
78
+ '129' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenstracksuit_blackwhite.gif',
79
+ '134' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenscapsleevetshirt_blackwhite.gif',
80
+ '136' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_kidsbaseballjersey_blackwhite.gif',
81
+ '296' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_296_c4.gif',
82
+ }
83
+ },
84
+ '5' => {
85
+ :description => 'Red/White',
86
+ :merchandise_swatches => {
87
+ '38' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_baseballjersey_redwhite.gif',
88
+ '126' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_baseballjersey_redwhite.gif',
89
+ '134' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenscapsleevetshirt_redwhite.gif',
90
+ '136' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_kidsbaseballjersey_redwhite.gif',
91
+ '295' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_295_c5.gif',
92
+ '296' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_296_c5.gif',
93
+ }
94
+ },
95
+ '6' => {
96
+ :description => 'Black',
97
+ :merchandise_swatches => {
98
+ '86' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_tilebox_black.gif',
99
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
100
+ '155' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
101
+ '159' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_159_c6.gif',
102
+ '161' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
103
+ '164' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
104
+ '167' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
105
+ '181' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
106
+ '184' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
107
+ '186' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
108
+ '190' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
109
+ '218' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
110
+ '219' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
111
+ '221' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
112
+ '222' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_black.gif',
113
+ '223' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_223_c6.gif',
114
+ '244' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_244_c6.gif',
115
+ '246' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_246_c6.gif',
116
+ '249' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_249_c6.gif',
117
+ '253' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_253_c6.gif',
118
+ '257' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_257_c6.gif',
119
+ '260' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_260_c6.gif',
120
+ '262' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_262_c6.gif',
121
+ '263' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_263_c6.gif',
122
+ '365' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_365_c6.gif',
123
+ '366' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_366_c6.gif',
124
+ '444' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_444_c6.gif',
125
+ '459' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_459_c6.gif',
126
+ }
127
+ },
128
+ '7' => {
129
+ :description => 'Natural',
130
+ :merchandise_swatches => {
131
+ '7' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_lighttshirt_natural.gif',
132
+ '111' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_111_c7.gif',
133
+ '254' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_254_c7.gif',
134
+ '256' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_256_c7.gif',
135
+ '258' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_258_c7.gif',
136
+ '259' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_259_c7.gif',
137
+ '261' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_261_c7.gif',
138
+ }
139
+ },
140
+ '8' => {
141
+ :description => 'Blue/White',
142
+ :merchandise_swatches => {
143
+ '38' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_baseballjersey_bluewhite.gif',
144
+ }
145
+ },
146
+ '9' => {
147
+ :description => 'Red',
148
+ :merchandise_swatches => {
149
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_red.gif',
150
+ '161' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_red.gif',
151
+ '181' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_red.gif',
152
+ '218' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_218_c9.gif',
153
+ '435' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_435_c9.gif',
154
+ }
155
+ },
156
+ '10' => {
157
+ :description => 'Silver',
158
+ :merchandise_swatches => {
159
+ '233' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_233_c10.gif',
160
+ '443' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_443_c10.gif',
161
+ }
162
+ },
163
+ '13' => {
164
+ :description => 'Yellow',
165
+ :merchandise_swatches => {
166
+ '107' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_107_c13.gif',
167
+ }
168
+ },
169
+ '14' => {
170
+ :description => 'Pink/White',
171
+ :merchandise_swatches => {
172
+ '102' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_jrraglan_pinkwhite.gif',
173
+ '128' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womensraglanhoodie_pinkwhite.gif',
174
+ '129' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenstracksuit_pinkwhite.gif',
175
+ }
176
+ },
177
+ '15' => {
178
+ :description => 'Baby Blue/White',
179
+ :merchandise_swatches => {
180
+ '102' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_jrraglan_babybluewhite.gif',
181
+ '128' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womensraglanhoodie_babybluewhite.gif',
182
+ '129' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenstracksuit_babybluewhite.gif',
183
+ }
184
+ },
185
+ '16' => {
186
+ :description => 'Pink/Salmon',
187
+ :merchandise_swatches => {
188
+ '113' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_jrringertshirt_pinksalmon.gif',
189
+ }
190
+ },
191
+ '17' => {
192
+ :description => 'Yellow/Gold',
193
+ :merchandise_swatches => {
194
+ '113' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_jrringertshirt_yellowgold.gif',
195
+ }
196
+ },
197
+ '18' => {
198
+ :description => 'Mint/Avocado',
199
+ :merchandise_swatches => {
200
+ '113' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_jrringertshirt_mintavocado.gif',
201
+ }
202
+ },
203
+ '20' => {
204
+ :description => 'Brown/White',
205
+ :merchandise_swatches => {
206
+ '134' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenscapsleevetshirt_brownwhite.gif',
207
+ }
208
+ },
209
+ '21' => {
210
+ :description => 'Navy/White',
211
+ :merchandise_swatches => {
212
+ '126' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_ringert_bluewhite.gif',
213
+ '136' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_kidsbaseballjersey_navywhite.gif',
214
+ }
215
+ },
216
+ '22' => {
217
+ :description => 'Cardinal',
218
+ :merchandise_swatches => {
219
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_cardinal.gif',
220
+ }
221
+ },
222
+ '23' => {
223
+ :description => 'Ash Grey',
224
+ :merchandise_swatches => {
225
+ '4' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_sweatshirt_ashgrey.gif',
226
+ '5' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_longsleevetshirt_ashgrey.gif',
227
+ '7' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_lighttshirt_ashgrey.gif',
228
+ '70' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_lighttshirt_ashgrey.gif',
229
+ '133' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_sweatshirt_ashgrey.gif',
230
+ '135' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_sweatshirt_ashgrey.gif',
231
+ }
232
+ },
233
+ '24' => {
234
+ :description => 'Pink',
235
+ :merchandise_swatches => {
236
+ '6' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_6_c24.gif',
237
+ '69' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_infanttoddlertshirt_pink.gif',
238
+ '443' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_443_c24.gif',
239
+ }
240
+ },
241
+ '25' => {
242
+ :description => 'Baby Blue',
243
+ :merchandise_swatches => {
244
+ '69' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_infanttoddlertshirt_babyblue.gif',
245
+ }
246
+ },
247
+ '26' => {
248
+ :description => 'Navy',
249
+ :merchandise_swatches => {
250
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_navy.gif',
251
+ '155' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_navy.gif',
252
+ '159' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_159_c26.gif',
253
+ '181' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_navy.gif',
254
+ '218' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_218_c26.gif',
255
+ '219' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_219_c26.gif',
256
+ '221' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_221_c26.gif',
257
+ '244' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_244_c26.gif',
258
+ '246' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_246_c26.gif',
259
+ '249' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_249_c26.gif',
260
+ '287' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_287_c26.gif',
261
+ '289' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_289_c26.gif',
262
+ }
263
+ },
264
+ '27' => {
265
+ :description => 'Military Green',
266
+ :merchandise_swatches => {
267
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_green.gif',
268
+ }
269
+ },
270
+ '28' => {
271
+ :description => 'Brown',
272
+ :merchandise_swatches => {
273
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_brown.gif',
274
+ '164' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darkwomenslongsleeve_brown.gif',
275
+ }
276
+ },
277
+ '29' => {
278
+ :description => 'Royal',
279
+ :merchandise_swatches => {
280
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_royal.gif',
281
+ '181' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_royal.gif',
282
+ }
283
+ },
284
+ '30' => {
285
+ :description => 'Charcoal',
286
+ :merchandise_swatches => {
287
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_darktshirt_charcoal.gif',
288
+ }
289
+ },
290
+ '31' => {
291
+ :description => 'Light Blue',
292
+ :merchandise_swatches => {
293
+ '7' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_lighttshirt_lightblue.gif',
294
+ '96' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_spagtank_lightblue.gif',
295
+ '109' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenslighttshirt_lightblue.gif',
296
+ '459' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_459_c31.gif',
297
+ }
298
+ },
299
+ '32' => {
300
+ :description => 'Caribbean Blue',
301
+ :merchandise_swatches => {
302
+ '161' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womensdarktshirt_teal.gif',
303
+ }
304
+ },
305
+ '33' => {
306
+ :description => 'Violet',
307
+ :merchandise_swatches => {
308
+ '161' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womensdarktshirt_violet.gif',
309
+ }
310
+ },
311
+ '34' => {
312
+ :description => 'Light Yellow',
313
+ :merchandise_swatches => {
314
+ '109' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenslighttshirt_lightyellow.gif',
315
+ }
316
+ },
317
+ '35' => {
318
+ :description => 'Light Pink',
319
+ :merchandise_swatches => {
320
+ '96' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_spagtank_lightpink.gif',
321
+ '109' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womenslighttshirt_lightpink.gif',
322
+ '189' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_189_c35.gif',
323
+ }
324
+ },
325
+ '36' => {
326
+ :description => 'Heather Grey',
327
+ :merchandise_swatches => {
328
+ '23' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_23_c36.gif',
329
+ '159' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_159_c36.gif',
330
+ '167' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_womensvneck_heathergrey.gif',
331
+ '245' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_245_c36.gif',
332
+ }
333
+ },
334
+ '37' => {
335
+ :description => 'Light Steel',
336
+ :merchandise_swatches => {
337
+ '247' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_247_c37.gif',
338
+ }
339
+ },
340
+ '38' => {
341
+ :description => 'Daffodil Yellow',
342
+ :merchandise_swatches => {
343
+ '69' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_infanttoddlertshirt_daffodilyellow.gif',
344
+ }
345
+ },
346
+ '43' => {
347
+ :description => 'Lemon',
348
+ :merchandise_swatches => {
349
+ '42' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_42_c43.gif',
350
+ '96' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_spagtank_lemon.gif',
351
+ }
352
+ },
353
+ '44' => {
354
+ :description => 'Mahogany',
355
+ :merchandise_swatches => {
356
+ '86' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_tilebox_cherry.gif',
357
+ }
358
+ },
359
+ '46' => {
360
+ :description => 'Olive',
361
+ :merchandise_swatches => {
362
+ '159' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_159_c46.gif',
363
+ '223' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_223_c46.gif',
364
+ '251' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_251_c46.gif',
365
+ }
366
+ },
367
+ '47' => {
368
+ :description => 'Raspberry',
369
+ :merchandise_swatches => {
370
+ '224' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_224_c47.gif',
371
+ }
372
+ },
373
+ '48' => {
374
+ :description => 'Deck Blue',
375
+ :merchandise_swatches => {
376
+ '224' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_224_c48.gif',
377
+ }
378
+ },
379
+ '49' => {
380
+ :description => 'Ivy',
381
+ :merchandise_swatches => {
382
+ '224' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_224_c49.gif',
383
+ }
384
+ },
385
+ '51' => {
386
+ :description => 'Mocha',
387
+ :merchandise_swatches => {
388
+ '223' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_223_c51.gif',
389
+ }
390
+ },
391
+ '54' => {
392
+ :description => 'Galaxy',
393
+ :merchandise_swatches => {
394
+ '255' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_255_c54.gif',
395
+ '257' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_257_c54.gif',
396
+ '262' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_262_c54.gif',
397
+ }
398
+ },
399
+ '55' => {
400
+ :description => 'Pale Pink',
401
+ :merchandise_swatches => {
402
+ '247' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_247_c55.gif',
403
+ }
404
+ },
405
+ '56' => {
406
+ :description => 'Pacific',
407
+ :merchandise_swatches => {
408
+ '251' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_251_c56.gif',
409
+ }
410
+ },
411
+ '58' => {
412
+ :description => 'Wasabi',
413
+ :merchandise_swatches => {
414
+ '253' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_253_c58.gif',
415
+ }
416
+ },
417
+ '59' => {
418
+ :description => 'Cinder',
419
+ :merchandise_swatches => {
420
+ '260' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_260_c59.gif',
421
+ }
422
+ },
423
+ '60' => {
424
+ :description => 'Kelly Green',
425
+ :merchandise_swatches => {
426
+ '152' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_152_c60.gif',
427
+ '159' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_159_c60.gif',
428
+ '263' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_263_c60.gif',
429
+ }
430
+ },
431
+ '64' => {
432
+ :description => 'Orange',
433
+ :merchandise_swatches => {
434
+ '159' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_159_c64.gif',
435
+ '263' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_263_c64.gif',
436
+ }
437
+ },
438
+ '70' => {
439
+ :description => 'Pomegranate',
440
+ :merchandise_swatches => {
441
+ '255' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_255_c70.gif',
442
+ }
443
+ },
444
+ '72' => {
445
+ :description => 'Asphalt',
446
+ :merchandise_swatches => {
447
+ '159' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_159_c72.gif',
448
+ '263' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_263_c72.gif',
449
+ }
450
+ },
451
+ '76' => {
452
+ :description => 'Aqua',
453
+ :merchandise_swatches => {
454
+ '263' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_263_c76.gif',
455
+ }
456
+ },
457
+ '95' => {
458
+ :description => 'Green',
459
+ :merchandise_swatches => {
460
+ '108' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_108_c95.gif',
461
+ '435' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_435_c95.gif',
462
+ }
463
+ },
464
+ '96' => {
465
+ :description => 'Fuchsia',
466
+ :merchandise_swatches => {
467
+ '289' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_289_c96.gif',
468
+ }
469
+ },
470
+ '97' => {
471
+ :description => 'Mocha',
472
+ :merchandise_swatches => {
473
+ '289' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_289_c97.gif',
474
+ }
475
+ },
476
+ '98' => {
477
+ :description => 'Sky Blue',
478
+ :merchandise_swatches => {
479
+ '72' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_72_c98.gif',
480
+ '73' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_73_c98.gif',
481
+ '360' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_360_c98.gif',
482
+ '361' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_361_c98.gif',
483
+ '362' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_362_c98.gif',
484
+ '363' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_363_c98.gif',
485
+ '440' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_440_c98.gif',
486
+ }
487
+ },
488
+ '102' => {
489
+ :description => 'MultiColor',
490
+ :merchandise_swatches => {
491
+ '293' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_293_c102.gif',
492
+ }
493
+ },
494
+ '103' => {
495
+ :description => 'Asphalt/White',
496
+ :merchandise_swatches => {
497
+ '296' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_296_c103.gif',
498
+ }
499
+ },
500
+ '104' => {
501
+ :description => 'Fuchsia/Pink',
502
+ :merchandise_swatches => {
503
+ '295' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_295_c104.gif',
504
+ }
505
+ },
506
+ '105' => {
507
+ :description => 'White/Red',
508
+ :merchandise_swatches => {
509
+ '295' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_295_c105.gif',
510
+ }
511
+ },
512
+ '106' => {
513
+ :description => 'White with Black',
514
+ :merchandise_swatches => {
515
+ '305' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_305_c106.gif',
516
+ }
517
+ },
518
+ '107' => {
519
+ :description => 'White with Black/Red',
520
+ :merchandise_swatches => {
521
+ '305' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_305_c107.gif',
522
+ }
523
+ },
524
+ '108' => {
525
+ :description => 'Clear with Black',
526
+ :merchandise_swatches => {
527
+ '305' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_305_c108.gif',
528
+ }
529
+ },
530
+ '109' => {
531
+ :description => 'Clear with Black/Red',
532
+ :merchandise_swatches => {
533
+ '305' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_305_c109.gif',
534
+ }
535
+ },
536
+ '170' => {
537
+ :description => 'Hot Pink',
538
+ :merchandise_swatches => {
539
+ '459' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_459_c170.gif',
540
+ }
541
+ },
542
+ '171' => {
543
+ :description => 'Key Lime',
544
+ :merchandise_swatches => {
545
+ '459' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_459_c171.gif',
546
+ }
547
+ },
548
+ '173' => {
549
+ :description => 'Petal Pink',
550
+ :merchandise_swatches => {
551
+ '72' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_72_c173.gif',
552
+ '73' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_73_c173.gif',
553
+ '360' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_360_c173.gif',
554
+ '361' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_361_c173.gif',
555
+ '362' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_362_c173.gif',
556
+ '363' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_363_c173.gif',
557
+ '440' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_440_c173.gif',
558
+ }
559
+ },
560
+ '174' => {
561
+ :description => 'Kiwi',
562
+ :merchandise_swatches => {
563
+ '72' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_72_c174.gif',
564
+ '73' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_73_c174.gif',
565
+ '360' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_360_c174.gif',
566
+ '361' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_361_c174.gif',
567
+ '362' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_362_c174.gif',
568
+ '440' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_440_c174.gif',
569
+ }
570
+ },
571
+ '175' => {
572
+ :description => 'Cloud White',
573
+ :merchandise_swatches => {
574
+ '72' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_72_c175.gif',
575
+ '73' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_73_c175.gif',
576
+ '360' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_360_c175.gif',
577
+ '361' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_361_c175.gif',
578
+ '362' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_362_c175.gif',
579
+ '440' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_440_c175.gif',
580
+ }
581
+ },
582
+ '176' => {
583
+ :description => 'Stainless Steel',
584
+ :merchandise_swatches => {
585
+ '367' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_367_c176.gif',
586
+ }
587
+ },
588
+ '211' => {
589
+ :description => 'Matte Black',
590
+ :merchandise_swatches => {
591
+ '460' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_460_c211.gif',
592
+ }
593
+ },
594
+ '212' => {
595
+ :description => 'Metallic Bronze',
596
+ :merchandise_swatches => {
597
+ '460' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_460_c212.gif',
598
+ }
599
+ },
600
+ '232' => {
601
+ :description => 'White T/Checker Pant',
602
+ :merchandise_swatches => {
603
+ '498' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_498_c232.gif',
604
+ '500' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_500_c232.gif',
605
+ }
606
+ },
607
+ '233' => {
608
+ :description => 'Black T/Checker Pant',
609
+ :merchandise_swatches => {
610
+ '497' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_497_c233.gif',
611
+ '499' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_499_c233.gif',
612
+ }
613
+ },
614
+ '234' => {
615
+ :description => 'White T/Pink Pant',
616
+ :merchandise_swatches => {
617
+ '500' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_500_c234.gif',
618
+ '501' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_501_c234.gif',
619
+ }
620
+ },
621
+ '235' => {
622
+ :description => 'Black T/Pink Pant',
623
+ :merchandise_swatches => {
624
+ '499' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_499_c235.gif',
625
+ }
626
+ },
627
+ '236' => {
628
+ :description => 'White T/Navy Pant',
629
+ :merchandise_swatches => {
630
+ '501' => 'http://www.cafepress.com/content/marketplace/img/swatches/swatch_501_c236.gif',
631
+ }
632
+ }
10
633
  }
634
+
635
+ module ClassMethods
636
+ def lookup_swatch(color_id, merchandise_id)
637
+ COLORS[color_id][:merchandise_swatches][merchandise_id]
638
+ end
639
+ end
640
+
641
+ def self.included(base)
642
+ base.extend(ClassMethods)
643
+ end
11
644
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafepress_api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 4
10
- version: 0.1.4
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Lee Smith
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-05 00:00:00 -07:00
18
+ date: 2011-03-06 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21