The BigCommerce API does not provide a way to quickly fetch the full product
record in a single request. The PostAgent
provided by Huginn will do the
trick, but it requires 6 agents just to fetch the data, and formatters to
ensure the body
data in the payload is not lost on each subsequent request.
This agent is designed to consolidate that process into a single, no-frills execution. We fetch the data, and return it as is in a single JSON object. It's up to the end user to decide what to do next.
This gem is run as part of the Huginn project. If you haven't already, follow the Getting Started instructions there.
Add this string to your Huginn's .env ADDITIONAL_GEMS
configuration: carmen,huginn_bigcommerce_product_agent
# when only using this agent gem it should look like this:
ADDITIONAL_GEMS=carmen,huginn_bigcommerce_order_agent
And then execute:
$ bundle
NOTE: Using this gem also requires that you use the Carmen gem (which can also be defined as an additional gem).
Carmen provides utility methods for looking up region codes. By default, the BigCommerce API
returns address objects with state names, but not codes (Illinois
, not IL
).
Some systems may require the state code, so we use Carmen to find it, and set the result as address['state_code']
Running rake
will clone and set up Huginn in spec/huginn
to run the specs of the Gem in Huginn as if they would be build-in Agents. The desired Huginn repository and branch can be modified in the Rakefile
:
HuginnAgent.load_tasks(branch: '<your branch>', remote: 'https://github.com/<github user>/huginn.git')
Make sure to delete the spec/huginn
directory and re-run rake
after changing the remote
to update the Huginn source code.
After the setup is done rake spec
will only run the tests, without cloning the Huginn source again.
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
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
The standard release command for this project is:
npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]
This command will:
- Generate/update the Changelog
- Bump the package version
- Tag & pushing the commit
e.g.
npm version 1.2.17
npm version patch // 1.2.17 -> 1.2.18
- Fork it ( https://github.com/5-stones/huginn_bigcommerce_product_agent/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request