README.md in blurb-0.3.2 vs README.md in blurb-0.4.0
- old
+ new
@@ -81,54 +81,60 @@
Blurb::Profile.list()
```
This will return a JSON payload of profile information for your account. You can then select the profile ID you want to use.
-## Blurb Values Setup
-Before using the Blurb API wrapper you need to set your API values. Simply do that by initializing the Blurb values to your API values.
-If you are using Rails, see below.
-```ruby
-Blurb.profile_id = "<YOUR_PROFILE_ID>"
-Blurb.client_id = "<YOUR_CLIENT_ID>"
-Blurb.client_secret = "<YOUR_CLIENT_SECRET>"
-Blurb.refresh_token = "<YOUR_REFRESH_TOKEN>"
-```
+
+
## Rails Integration
-You can setup the Amazon API keys and tokens in an initializer script.
-Create a file called config/initializers/blurb.rb and setup the following values
+When creating a new resource object, you may pass in a hash containing your api keys and tokens. Utilizing this approach allows you to dynamically toggle accounts and or regions with you application.
```ruby
-Blurb.profile_id = "<YOUR_PROFILE_ID>"
-Blurb.client_id = "<YOUR_CLIENT_ID>"
-Blurb.client_secret = "<YOUR_CLIENT_SECRET>"
-Blurb.refresh_token = "<YOUR_REFRESH_TOKEN>"
+authorization_hash = {
+ client_id: 'my_client_id',
+ profile_id: 'my_profile_id',
+ client_secret: 'client_secret',
+ refresh_token: 'refresh_token',
+ region: 'my_region'
+}
+
+blurb_instance = Blurb::Keyword.new(authorization_hash)
```
-If you don't want to store your API values in your code which gets checked into a public repo, you can utilize ENV variables
+
+
+
+If you only plan on using Blurb for one api account and region you can setup the Amazon API keys and tokens in an initializer script.
+Create a file called config/initializers/blurb.rb and setup the following values
+
```ruby
Blurb.profile_id = ENV["YOUR_PROFILE_ID_VAR"]
Blurb.client_id = ENV["YOUR_CLIENT_ID_VAR"]
Blurb.client_secret = ENV["YOUR_CLIENT_SECRET_VAR"]
Blurb.refresh_token = ENV["YOUR_REFRESH_TOKEN_VAR"]
+Blurb.region = ENV["YOUR_REGION_VAR"]
```
-You could also store API values in a persistence store and initialize from there too.
+Now, you no longer need to pass in an authorization hash when initializing the resource object.
-## API Environments
-
-By default Blurb will run API calls to the Amazon Advertising API production environment.
-If you are under development and want to test out the API to see what it can do, you can set
-the following Blurb property to use the API test environment.
-
```ruby
-Blurb.test_env = true
+blurb_instance = Blurb::Keyword.new()
```
+### Valid Region Codes
+
+Region Code | Region | Notes
+--- | --- | ---
+TEST | Sandbox Environment | All marketplaces
+NA | North America | Covers US and CA marketplaces
+EU | Europe | Covers UK, FR, IT, ES, and DE marketplaces
+FE | Far East | Cover JP and AU marketplaces
+
## Usage
All API calls have been setup as closely as possible to REST Resource calls.
All you need to do is instantiate a resource object and make a method call on it and Blurb will do the rest.
@@ -136,23 +142,10 @@
```ruby
blurb_instance = Blurb::Keyword.new()
```
-Optionally, you may pass in a set of account credentials to override the default API keys and tokens
-
-```ruby
-authorization_hash = {
- client_id: 'my_client_id',
- profile_id: 'my_profile_id',
- client_secret: 'client_secret',
- refresh_token: 'refresh_token'
-}
-
-blurb_instance = Blurb::Keyword.new(authorization_hash)
-```
-
In calls that require 'campaign_type' as a parameter, you must pass in either 'sp' for sponsored products or 'hsa' for sponsored brands (formerly known as headline search ads).
NOTE: Not all API endpoints are currently supported by Blurb. Over time we will get more
endpoints added. In the mean time you are always welcome to submit a pull request.
@@ -377,9 +370,18 @@
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
+
+In order to run the rspec test suite, you will need the following variables in a .env file:
+
+```
+PROFILE_ID
+CLIENT_ID
+CLIENT_SECRET
+REFRESH_TOKEN
+```
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/iserve-products/blurb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.