cafepress_api 0.2.2 → 0.2.3
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.
- data/lib/cafepress_api/version.rb +1 -1
- data/lib/cafepress_api.rb +16 -1
- data/lib/product_sizes.rb +22 -0
- metadata +5 -4
data/lib/cafepress_api.rb
CHANGED
@@ -114,6 +114,19 @@ Or better yet, add the mapping yourself in product_colors.rb and submit it back
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
sizes = []
|
118
|
+
default_size_id = nil
|
119
|
+
product.get_elements("size").each do |size|
|
120
|
+
sizes << {
|
121
|
+
:cafepress_size_id => size.attributes['id'],
|
122
|
+
:full_name => size.attributes['fullName'],
|
123
|
+
:display_sell_price => size.attributes['displaySellPrice']
|
124
|
+
}
|
125
|
+
if size.attributes['default'] == 'true'
|
126
|
+
default_size_id = size.attributes['id']
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
117
130
|
products << {
|
118
131
|
:name => product.attributes['name'],
|
119
132
|
:default_caption => product.attributes['defaultCaption'],
|
@@ -124,7 +137,9 @@ Or better yet, add the mapping yourself in product_colors.rb and submit it back
|
|
124
137
|
:gender => gender, # See comment above
|
125
138
|
:cafepress_merchandise_id => product.attributes['merchandiseId'],
|
126
139
|
:default_color_id => default_color_id,
|
127
|
-
:image_urls => image_urls
|
140
|
+
:image_urls => image_urls,
|
141
|
+
:default_cafepress_size_id => default_size_id,
|
142
|
+
:sizes => sizes
|
128
143
|
}
|
129
144
|
end
|
130
145
|
products
|
@@ -0,0 +1,22 @@
|
|
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
|
+
|
17
|
+
# I was going to create some static hash for sizes and their descriptions, but
|
18
|
+
# since price is linked directly to size and price seems highly volatile, I'm
|
19
|
+
# deciding a static hash for sizes would be pointless since you have to parse
|
20
|
+
# the size elements anyway.
|
21
|
+
module ProductSizes
|
22
|
+
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:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
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-
|
18
|
+
date: 2011-03-07 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/cafepress_api/version.rb
|
40
40
|
- lib/product_colors.rb
|
41
41
|
- lib/product_genders.rb
|
42
|
+
- lib/product_sizes.rb
|
42
43
|
has_rdoc: true
|
43
44
|
homepage: https://github.com/benjaminleesmith/cafepress_api
|
44
45
|
licenses: []
|