Skip to content
This repository has been archived by the owner on Aug 27, 2019. It is now read-only.

Latest commit

 

History

History
91 lines (63 loc) · 2.13 KB

README.md

File metadata and controls

91 lines (63 loc) · 2.13 KB

DEPRECATED: Migrate to API v3

Pwinty v2 Build Status

This library implements a Ruby client for the Pwinty photo printing API.

While I consider this to be feature complete (it's the only Ruby Pwinty client that can POST photos as well as send photo URLs), I do want to hear if there are issues.

Documentation

Import pwinty and set your API Key and Merchent ID:

ENV['PWINTY_MERCHANT_ID'] = 'xxxxxxx'
ENV['PWINTY_API_KEY'] = 'xxxxxxx'
@client = Pwinty.client

Create an Order:

order = @client.Order.create_order(
  recipientName: "FirstName LastName",
  address1: "123 Anywhere Street",
  addressTownOrCity: "San Francisco",
  stateOrCounty: "CA",
  postalOrZipCode: "94101",
  countryCode: "US",
  payment: "InvoiceMe",
  qualityLevel: "Standard"
)

Add photos to the order:

photo = @client.add_photo(
  orderId: order['id'],
  type: "4x6",
  url: "http://i.imgur.com/xXnrL.jpg",
  copies: 1,
  sizing: "Crop"
)

Check the order is valid:

order_status = @client.get_order_status(order['id'])
if !order_status['isValid']
	puts "Invalid Order"
end

Submit the order:

response = @client.update_order_status(order['id'], "Submitted")

You can retrieve a previous order and check its status like so:

order = @client.get_order_status(8765)
if order['status'] == 'Complete'
	puts "Order has dispatched"
end

You should find the documentation for Pwinty on their API.

Install

gem install pwinty

or add the following line to Gemfile:

gem 'pwinty'

and run bundle install from your shell.

Supported Ruby versions

The Ruby Pwinty gem has only been tested on Ruby 2.

License

MIT License

More Information