-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the ability to have code based configuration rather than file based #103
Open
stevechilds
wants to merge
3
commits into
CPIGroup:master
Choose a base branch
from
stevechilds:stable
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ test.php | |
log.txt | ||
/test-cases/log.txt | ||
composer.lock | ||
/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
The phpAmazonMWS library was designed and written by Thomas Hernandez (peardian at gmail) for the CPI Group. | ||
The v1.4.0 refactoring when adding the AmazonMWSConfig class was done by Steve Childs (stevechilds76 at gmail) for Color Confidence (UK). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do want to give contributors credit, but I haven't yet figured out the best way to go about it, so for now I would prefer it if the credits file was not modified. You are welcome to put an author tag in the new config class, though. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,5 +36,3 @@ | |
|
||
//Turn off normal logging | ||
$muteLog = false; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
die('This is just an example and will not work without proper store credentials.'); | ||
|
||
$amazonConfig = array( | ||
'stores' => | ||
array('myStoreName' => | ||
array( | ||
'merchantId' => 'AAAAAAAAAAAA', | ||
'marketplaceId' => 'AAAAAAAAAAAAAA', | ||
'keyId' => 'AAAAAAAAAAAAAAAAAAAA', | ||
'secretKey' => 'BABABABABABABABABABABABABABABABABABABABA', | ||
'serviceUrl' => '', | ||
'MWSAuthToken' => '', | ||
) | ||
), | ||
'AMAZON_SERVICE_URL' => 'https://mws-eu.amazonservices.com', // eu store | ||
'logpath' => __DIR__ . './logs/amazon_mws.log', | ||
'logfunction' => '', | ||
'muteLog' => false | ||
); | ||
|
||
/** | ||
* This function will retrieve a list of all items with quantity that was adjusted within the past 24 hours. | ||
* The entire list of items is returned, with each item contained in an array. | ||
* Note that this does not relay whether or not the feed had any errors. | ||
* To get this information, the feed's results must be retrieved. | ||
*/ | ||
function getAmazonFeedStatusA(){ | ||
global $amazonConfig; // only for example purposes, please don't use globals! | ||
|
||
|
||
try { | ||
$amz=new AmazonFeedList($amazonConfig); | ||
$amz->setStore('myStoreName'); // Not strictly needed as there is only 1 store in the array and its automatically activated | ||
$amz->setTimeLimits('- 24 hours'); //limit time frame for feeds to any updated since the given time | ||
$amz->setFeedStatuses(array("_SUBMITTED_", "_IN_PROGRESS_", "_DONE_")); //exclude cancelled feeds | ||
$amz->fetchFeedSubmissions(); //this is what actually sends the request | ||
return $amz->getFeedList(); | ||
} catch (Exception $ex) { | ||
echo 'There was a problem with the Amazon library. Error: '.$ex->getMessage(); | ||
} | ||
} | ||
|
||
/** | ||
* As above but with an alternative method of creating the config object. | ||
*/ | ||
function getAmazonFeedStatusB(){ | ||
global $amazonConfig; // only for example purposes, please don't use globals! | ||
|
||
$configObject = new \AmazonMWSConfig($amazonConfig); | ||
|
||
try { | ||
// using the getConfigFor method creates another instance of AmazonMWSConfig containing just that store's data | ||
// If the method in getAmazonFeedStatusA() has more than 1 store setup in the array, they all are available to | ||
// the Amazon MWS library and you can switch between them using setStore(). However, should you want to | ||
// have clear seperation between the stores forwhatever reason, you can use getConfigFor to ensure that only | ||
// one store is available to the library. They're all still available in the configObject for later use, | ||
// calling getConfigFor does not affect the store list within the $configObject | ||
|
||
$amz=new AmazonFeedList($configObject->getConfigFor('myStoreName')); | ||
$amz->setTimeLimits('- 24 hours'); //limit time frame for feeds to any updated since the given time | ||
$amz->setFeedStatuses(array("_SUBMITTED_", "_IN_PROGRESS_", "_DONE_")); //exclude cancelled feeds | ||
$amz->fetchFeedSubmissions(); //this is what actually sends the request | ||
return $amz->getFeedList(); | ||
} catch (Exception $ex) { | ||
echo 'There was a problem with the Amazon library. Error: '.$ex->getMessage(); | ||
} | ||
}?> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't mind, I would prefer it if changes to the changelog were handled by me at the time of release.