Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby interface to your Ponoko Personal Factory

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Readme.rdoc
Octocat-spinner-32 ponoko.gemspec
Readme.rdoc

Ponoko

The Ponoko gem enables Ruby developers to access the Ponoko Personal Factory API

Developer resources can be found www.ponoko.com/app-gateway/developer-resources

Install

Install the gem…

gem install ponoko

or add it to your GemFile…

gem 'ponoko'

Usage

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.

Low level 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

High Level API

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.

API Version

To find out which version of the Ponoko APi this gem supports, check the Ponoko::API_VERSION constant.

To Do

* Use the Money gem, maybe.

Make a Product

Design Files

Materials

Order Your Product

Products

Shipping

Addresses

Track the Order Status

Sandbox.

For support and feedback on this gem and/or the Ponoko API visit support.ponoko.com/categories/10441-developer-program

Something went wrong with that request. Please try again.