hitfox_coupon_api
Simple interface to the HitFox.com coupon API. Audience of this gem are publisher who have integrated HitFox and wish to interface with HitFox to obtain and send information to deal coupons being sold.
Installation
Installation is either
gem install hitfox_coupon_api
Or if using bundler, in the Gemfile
gem 'hitfox_coupon_api'
The latest version can be used via github but including git option in the Gemfile:
gem 'hitfox_coupon_api', :git => 'git://github.com/gorenje/hitfox_coupon_api.git'
Configuration
To configure the gem, you’ll need API authentication details from HitFox. Once you have these, then configuration is a matter of doing:
HitfoxCouponApi.configure do |config|
config.api_token = 'your api token'
config.api_secret = 'your api secret'
config.api_version = 'the api version as provided by HitFox.com'
config.api_endpoint = 'the api endpoint as provided by HitFox.com'
end
If using Rails, then this is best done in a config/initializer and perhaps storing the configuration data in a separate yaml file.
Usage
At the moment, this gem can do one thing but that really well: provide feedback to HitFox when a coupon has been used.
This is done by providing the application id (also generated by HitFox) and the coupon id that goes from you:
HitfoxCouponApi.application('app id from hitfox').coupon('coupon code').used
that’s it. But you can also keep the application object around and use it for subsequent calls:
# best done in Rails in an initializer
MyGlobalApplication = HitfoxCouponApi.application('app id from hitfox')
... some time later ...
MyGlobalApplication.coupon("fubar").used
MyGlobalApplication.coupon("snafu also").used
Other than that, there is not much else to see here! More features will appear as we develop them.
Contributing to hitfox_coupon_api
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright
Copyright © 2011 Gerrit Riessen. See LICENSE.txt for further details.