Imagga::Categorization
This gem is a simple wrapper around Imagga's categorization API.
Installation
Add this line to your application's Gemfile:
gem 'imagga-categorization'
And then execute:
$ bundle
Or install it yourself as:
$ gem install imagga-categorization
Usage
Create a client
client = Imagga::Categorization::Client.new app_key: YOUR_API_KEY
Consume an endpoint
The gem currently supports 3 endpoints:
/draft/classify/{classifier_id}
/draft/classify/result/{ticket_id}
/draft/tasks/{task_id}
A call to any of these endpoints needs an api_key
:
Before you begin you should Request Your Free Trial from Imagga website in order to get an api_key. The api key is the only required authentication method currently and should be provided with every request as a parameter in the URL.
Imagga's full api documentation can be found here. It lists the possible parameters for each endpoint.
Classify
parameters = {
"async": "1",
"urls": "https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-prn2/969321_526818917353598_661738580_n.jpg, http://example.com/image2.jpg"
}
response = client.classify(YOUR_CLASSIFIER_ID, parameters)
Classify result
response = client.classify_result(ticket_id)
Task result
response = client.task_result(task_id)
TODO
- Write some fracking unit tests
Contributing
- Fork it
- 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 new Pull Request