Skip to content
This repository has been archived by the owner on Mar 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #54 from BenMorel/master
Browse files Browse the repository at this point in the history
Add setCondition() to Search and Lookup
  • Loading branch information
Exeu committed Nov 26, 2014
2 parents 00a4869 + 8ad6279 commit 12101e6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/ApaiIO/Operations/Lookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,20 @@ public function setSearchIndex($searchIndex)

return $this;
}

/**
* Sets the condition of the items to return: New | Used | Collectible | Refurbished | All
*
* Defaults to New.
*
* @param string $condition
*
* @return \ApaiIO\Operations\Lookup
*/
public function setCondition($condition)
{
$this->parameter['Condition'] = $condition;

return $this;
}
}
16 changes: 16 additions & 0 deletions lib/ApaiIO/Operations/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@ public function setMaximumPrice($price)
return $this;
}

/**
* Sets the condition of the items to return: New | Used | Collectible | Refurbished | All
*
* Defaults to New.
*
* @param string $condition
*
* @return \ApaiIO\Operations\Search
*/
public function setCondition($condition)
{
$this->parameter['Condition'] = $condition;

return $this;
}

/**
* Validates the given price.
*
Expand Down
7 changes: 7 additions & 0 deletions tests/ApaiIO/Test/Operations/Types/LookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,11 @@ public function testGetSearchIndex()
$lookup->setSearchIndex('Appliances');
$this->assertEquals('Appliances', $lookup->getSearchIndex());
}

public function testConditionGetterAndSetter()
{
$lookup = new Lookup();
$lookup->setCondition('All');
$this->assertEquals('All', $lookup->getCondition());
}
}
7 changes: 7 additions & 0 deletions tests/ApaiIO/Test/Operations/Types/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,11 @@ public function testSearchValidPage()

$this->assertEquals(1, $search->getItemPage());
}

public function testConditionGetterAndSetter()
{
$search = new Search();
$search->setCondition('All');
$this->assertEquals('All', $search->getCondition());
}
}

0 comments on commit 12101e6

Please sign in to comment.