Skip to content

Commit ad2cfaa

Browse files
committed
Documentation, Brazil locale fix and config tweaks.
1 parent ee431a7 commit ad2cfaa

File tree

4 files changed

+80
-9
lines changed

4 files changed

+80
-9
lines changed

Diff for: README.md

+75-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,83 @@
11
# Amazon ECS for Laravel
22

3-
This is currently a work in progress, if you come across this as it is right now - **please use your own risk**.
3+
Whilst working on a project, I need the ability to search for products on Amazon as well as lookup individual products based on their ASIN which led me to make a dedicated package for that as *sometimes*, the process to authorise with Amazon is a little awkward. To say the least.
44

5-
Documentation will be updated tomorrow (as of this commit).
5+
## Installation
66

7-
### Planned
7+
```
8+
composer require dawson/amazon-ecs
9+
```
810

9-
- [ ] Finish Documentation
11+
After you have successfully installed, add the follow Service Provider and Facade to your `config/app.php`.
12+
13+
```
14+
Dawson\AmazonECS\AmazonECSServiceProvider::class,
15+
```
16+
17+
```
18+
'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class
19+
```
20+
21+
Now we'll go ahead and publish the `amazon.php` configuration file.
22+
23+
```
24+
php artisan vendor:publish --provider="Dawson\AmazonECS\AmazonECSServiceProvider"
25+
```
26+
27+
Open up the `amazon.php` configuration file and enter your credentials or leverage the use of environment variables which're used by default.
28+
29+
When it comes to choosing a `locale`, you have a choice of the following:
30+
31+
|Locale |Country |
32+
|----------|------------------|
33+
|`co.uk` |United Kingdom |
34+
|`com` |United States |
35+
|`ca` |Canada |
36+
|`com.br` |Brazil |
37+
|`de` |Germany |
38+
|`es` |Spain |
39+
|`fr` |France |
40+
|`in` |India |
41+
|`co.jp` |Japan |
42+
|`com.mx` |Mexico |
43+
44+
**You should now be correctly configured!**
45+
46+
## Usage
47+
48+
Currently, there are two methods available which are `search` and `lookup`.
49+
50+
### Search
51+
52+
```
53+
$response = Amazon::search('Home Alone');
54+
```
55+
56+
**It's that simple!** The request should return an XML response.
57+
58+
59+
*Please note*, this currently searches the entire Amazon catalog. I plan on adding the ability to search within a given category *soon* so keep an eye out for that.
60+
61+
### Lookup
62+
63+
You can also lookup any given item, assuming it's availble on your configure locale and is a valid **ASIN**, of which is possible by doing the following:
64+
65+
```
66+
$product = Amazon::product('B004VLKY8M');
67+
68+
```
69+
70+
This will simply return the product, it's attributes and item links.
71+
72+
## Questions & Issues
73+
74+
Should you have any questions or come across a problem, please feel free to submit an issue.
75+
76+
---
77+
78+
## Planned
79+
80+
- [X] Finish Documentation
1081
- [X] Locales
1182
- [ ] Better Exception Handling
1283
- [ ] Cart abilities, such as modifying, adding, clearing etc.

Diff for: config/amazon.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
/**
66
* Your access key.
77
*/
8-
'access_key' => ''
8+
'access_key' => env('AMAZON_ACCESS_KEY', ''),
99

1010
/**
1111
* Your secret key.
1212
*/
13-
'secret_key' => ''
13+
'secret_key' => env('AMAZON_SECRET_KEY', ''),
1414

1515
/**
1616
* Your affiliate associate tag.
1717
*/
18-
'associate_tag' => '',
18+
'associate_tag' => env('AMAZON_ASSOCIATE_TAG', ''),
1919

2020
/**
2121
* Preferred locale

Diff for: src/AmazonECS.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AmazonECS
2424
* @var array
2525
*/
2626
protected $locales = [
27-
'co.uk', 'com', 'ca', 'br', 'de', 'es', 'fr', 'in', 'it', 'co.jp', 'com.mx'
27+
'co.uk', 'com', 'ca', 'com.br', 'de', 'es', 'fr', 'in', 'it', 'co.jp', 'com.mx'
2828
];
2929

3030
/**

Diff for: src/Helpers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function params($optionalParams = [], $operation = 'ItemSearch')
5454
'AWSAccessKeyId' => $this->access_key,
5555
'AssociateTag' => $this->associate_tag,
5656
'Operation' => $operation,
57-
'Version' => '2011-08-01',
57+
'Version' => '2013-08-01',
5858
'Service' => 'AWSECommerceService',
5959
'Timestamp' => gmdate("Y-m-d\TH:i:s\Z")
6060
];

0 commit comments

Comments
 (0)