diff --git a/src/Etsy/EtsyApi.php b/src/Etsy/EtsyApi.php index 06b8fa7..303e1af 100644 --- a/src/Etsy/EtsyApi.php +++ b/src/Etsy/EtsyApi.php @@ -96,13 +96,18 @@ protected function validateResponse($request_args, $response) private function prepareData($data) { $result = array(); foreach ($data as $key => $value) { - $type = gettype($value); - if ($type !== 'boolean') { - $result[$key] = $value; - continue; - } - - $result[$key] = $value ? 1 : 0; + $type = gettype($value); + switch ($type) { + case 'boolean': + $result[$key] = $value ? 1 : 0; + break; + case 'array': + $result[$key] = implode(',', $value); + break; + default: + $result[$key] = $value; + break; + } } return $result; diff --git a/src/Etsy/RequestValidator.php b/src/Etsy/RequestValidator.php index f32277c..28ef489 100644 --- a/src/Etsy/RequestValidator.php +++ b/src/Etsy/RequestValidator.php @@ -88,7 +88,7 @@ public static function validateData($args, $methodInfo) { $valueTypes[] = self::transformValueType(gettype($value)); } - $type = 'map(' . implode($valueTypes, ', ') . ')'; + $type = 'map(' . implode(', ', $valueTypes) . ')'; break; } @@ -110,7 +110,9 @@ public static function validateData($args, $methodInfo) } if ($validType !== $type) { - if (substr($validType, 0, 4) === 'enum') { + if ('epoch' === $validType && false !== strtotime($arg)) { + $result['_valid'][$name] = $arg; + } elseif (substr($validType, 0, 4) === 'enum') { if ($arg === 'enum' || !preg_match("@" . preg_quote($arg) . "@", $validType)) { $result['_invalid'][] = 'Invalid enum data param "' . $name . '" value (' . $arg . '): valid values "' . $validType . '"'; } else { diff --git a/src/Etsy/methods.json b/src/Etsy/methods.json index 988fff8..181f5b2 100644 --- a/src/Etsy/methods.json +++ b/src/Etsy/methods.json @@ -471,7 +471,7 @@ "tags": "array(string)", "who_made": "enum(i_did, collective, someone_else)", "is_supply": "boolean", - "when_made": "enum(made_to_order, 2020_2020, 2010_2019, 2001_2009, before_2001, 2000_2000, 1990s, 1980s, 1970s, 1960s, 1950s, 1940s, 1930s, 1920s, 1910s, 1900s, 1800s, 1700s, before_1700)", + "when_made": "enum(made_to_order, 2020_2021, 2010_2019, 2002_2009, before_2002, 2000_2001, 1990s, 1980s, 1970s, 1960s, 1950s, 1940s, 1930s, 1920s, 1910s, 1900s, 1800s, 1700s, before_1700)", "recipient": "enum(men, women, unisex_adults, teen_boys, teen_girls, teens, boys, girls, children, baby_boys, baby_girls, babies, birds, cats, dogs, pets, not_specified)", "occasion": "enum(anniversary, baptism, bar_or_bat_mitzvah, birthday, canada_day, chinese_new_year, cinco_de_mayo, confirmation, christmas, day_of_the_dead, easter, eid, engagement, fathers_day, get_well, graduation, halloween, hanukkah, housewarming, kwanzaa, prom, july_4th, mothers_day, new_baby, new_years, quinceanera, retirement, st_patricks_day, sweet_16, sympathy, thanksgiving, valentines, wedding)", "style": "array(string)", @@ -2607,8 +2607,8 @@ "shop_id": "shop_id_or_name", "min_created": "epoch", "max_created": "epoch", - "min_last_modified": "int", - "max_last_modified": "int", + "min_last_modified": "epoch", + "max_last_modified": "epoch", "limit": "int", "offset": "int", "page": "int",