Developer resources can be found www.ponoko.com/app-gateway/developer-resources
Install the gem…
gem install ponoko
or add it to your GemFile…
Ponoko requires OAuth for authentication so the first thing you need are the OAuth keys. You can get your consumer keys and an access token for you own account by signing up to the developer program at the Ponoko website
Then you need to decide which API interface you want to use. The gem provides two interfaces to the API.
For use when you have an ORM, framework or pre-exsiting classes that you want to load the Ponoko data into.
The API consists of a number of methods that map to the methods exposed by the Ponoko web API eg, get_material_catalogue, get_products, post_order etc. These methods return hashes of the API responses.
First create a PonokoAPI object;
ponoko = Ponoko::OAuthAPI.new env: :sandbox, consumer_key: 'my_consumer_key', consumer_secret: 'my_consumer_secret', access_token: 'my_access_token', access_secret: 'my_access_secret'
Then you can can use this object to interact with Ponoko;
nodes = ponoko.get_nodes material_catalogue = ponoko.get_material_catalogue nodes.first['key'] ... my_order = ponoko.get_order 'my_order_reference' ponoko.get_order_status 'my_order_reference' ...
All low level methods will call to Ponoko's servers
This is more suited to when you are writing a script or application and you want to use Ruby objects to represent the Ponoko data. It uses the Low Level API underneath but wraps the return data in nice Ruby objects.
Ponoko.api = Ponoko::OAuthAPI.new env: :sandbox, consumer_key: 'my_consumer_key', consumer_secret: 'my_consumer_secret', access_token: 'my_access_token', access_secret: 'my_access_secret' nodes = Node.get! material_catalogue = nodes.first.material_catalogue ... my_order = Order.get! 'my_order_reference' my_order.status ...
High level API calls will make calls to the Ponoko servers only if necessary, ie.the information hasn't already been fetched. Though you can force a fetch from the servers by using the bang ('!') versions of the calls.
To find out which version of the Ponoko APi this gem supports, check the Ponoko::API_VERSION constant.
* Use the Money gem, maybe.
For support and feedback on this gem and/or the Ponoko API visit support.ponoko.com/categories/10441-developer-program