Aaww
A simple Authentise API Wrapper using HTTMultiParty for uploads
Installation
Add this line to your application's Gemfile:
gem 'aaww'
And then execute:
$ bundle
Or install it yourself as:
$ gem install aaww
Usage
Start a new transaction:
transaction = Aaww::Transaction.new key: 'your_api_key'
Generate a token for this transaction:
transaction.create_token
Upload a file and get a link to send the user to:
transaction.upload File.new('some.stl'), 'some@email.com', 3.99
or just upload!
if you instantiated the Transaction with everything needed:
transaction = Aaww::Transaction.new key: 'your_api_key', file: File.new('some.stl'), email: 'some@email.com', value: 3.99
transaction.upload!
Then, you can access the token links created by Authentise with:
transaction.link
transaction.ssl_link
Checking status
You can access the status of the current transaction with:
transaction.status
This is the status of the last API call. If you want to check the current print
status, call check_print_status!
. Then you can see if there's any error or
progress:
transaction.check_print_status!
transaction.status.ok? # true
transaction.progress.minutes_left # 15
Be careful with making consecutive calls to check_print_status!
without
waiting at least 15 seconds, because it can be interpreted as
abuse.
Contributing
- Fork it ( https://github.com/lainventoria/aaww/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