Sterling - A Retailigence API Wrapper
Sterling is a simple wrapper for the Retailigence API written in Ruby. The name was inspired from Sterling Cooper, the fictional ad agency from Mad Men.
Installation
gem install sterling
Configuration
Sterling is designed to be dropped into a Rails app with little effort. Simply create an initializer as follows
Sterling.configure do |config|
config.api_version = '...'
config.api_key = 'your api key''
config.api_host = 'api or apitest'
end
Usage
Once configured, you can create a new client object. This object is used to interact with the Retailigence API.
client = Sterling::API::Client.new
# Return an array of product objects for the location 90210 that match the keyword Diamonds
products = client.products("90201", "Diamonds", "your_requestor_id")
# Get the product names
products.each do |search_result|
puts search_result.product['name']
end
In the event no data is found, the response simply returns an empty array.
Roadmap
- Additional Endpoints
Contributing
Think we need to improve the gem? Missing features? Want more support? Feel this ruby could be better? Contribute away!
- Fork it
- Make your changes and use specs (rpsec is preferred)
- Pull Request
We, at Puhsh, use Sterling extensively in production and we are always open to making it better.