Giter Site home page Giter Site logo

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

Ponoko's Projects

ponoko icon ponoko

Ruby interface to your Ponoko Personal Factory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.