Skip to content

Commit

Permalink
added merchandise id and default color id to data returned for products
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminleesmith committed Mar 7, 2011
1 parent 8d409c1 commit ae06c9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/cafepress_api.rb
Expand Up @@ -100,6 +100,14 @@ def self.get_store_products(cafepress_store_id, app_key = ENV['cp_app_key'])
end
end

# for whatever reason, some products don't have a default color
begin
default_color_id = product.get_elements("color[@default='true']").first.attributes['id']
rescue
default_color_id = nil
end


products << {
:name => product.attributes['name'],
:default_caption => product.attributes['defaultCaption'],
Expand All @@ -108,6 +116,8 @@ def self.get_store_products(cafepress_store_id, app_key = ENV['cp_app_key'])
:cafepress_design_id => product.get_elements("mediaConfiguration[@perspectives='Front']").first.attributes['designId'],
:cafepress_back_design_id => cafepress_back_design_id,
:gender => gender, # See comment above
:cafepress_merchandise_id => product.attributes['merchandiseId'],
:default_color_id => default_color_id,
:image_urls => image_urls
}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cafepress_api/version.rb
Expand Up @@ -15,5 +15,5 @@
# along with CafePressAPI. If not, see <http://www.gnu.org/licenses/>.

module CafePressAPI
VERSION = "0.2.0"
VERSION = "0.2.1"
end

0 comments on commit ae06c9f

Please sign in to comment.