lib/amee/profile_item.rb in Floppy-amee-2.0.3 vs lib/amee/profile_item.rb in Floppy-amee-2.0.4
- old
+ new
@@ -228,12 +228,12 @@
options[:duration] = "PT#{options[:duration] * 86400}S"
end
# Load data from path
response = connection.get(path, options)
return Item.parse(connection, response)
-# rescue
-# raise AMEE::BadData.new("Couldn't load ProfileItem. Check that your URL is correct.")
+ rescue
+ raise AMEE::BadData.new("Couldn't load ProfileItem. Check that your URL is correct.")
end
def self.create(category, data_item_uid, options = {})
create_without_category(category.connection, category.full_path, data_item_uid, options)
end
@@ -266,11 +266,10 @@
response = connection.post(path, options)
if response['Location']
location = response['Location']
else
category = Category.parse(connection, response)
- item = category.items.find{ |x| x[:name] == options[:name] || x[:dataItemUid] == data_item_uid }
- location = category.full_path + "/" + item[:path]
+ location = category.full_path + "/" + category.items[0][:path]
end
if get_item == true
options = {}
options[:format] = format if format
return AMEE::Profile::Item.get(connection, location, options)