Iupick

The iupick Ruby gem wraps the iupick API to facilitate access from applications written in ruby.

Keep in mind that this package requires iupick secret keys, contact [email protected] for more information.

Installation

Add this line to your application's Gemfile:

gem 'iupick'

And then execute:

$ bundle

Or install it yourself as:

$ gem install iupick

Usage

Add your secret and public tokens as required.

Never expose your secret token.

Methods that require your secret_token should never be done from the front-end. Since this methods deal with sensitive information.

require 'iupick'

Iupick.secret_token = 'sk_sandbox_4bdcd3630417c5119029859c08a7b8d9d97dda79'
Iupick.public_token = '315cdf3ca4dd588ab8e6f7fa4b7aa433c641cadd'
Iupick.environment = 'sandbox'

Waybills

The waybill generation occurs on three steps.

Step 1.

Create a shipment on the iupick platform and receive a shipment token.

shipment_token = Iupick::Shipment.create(length=8,width=8,height=8,weight=1.1)

Step 2.

Fill the rest of the information required to generate a waybill, and receive a confirmation token.

You can send a shipment either to an arbitrary direction or to one of our waypoints; just replace the waypoint_id attribute for a recipient address.

shipper_address = Iupick.create_address(
  city='Querétaro',
  line_one='Epigmenio Gonzáles 500',
  postal_code=76130,
  line_two='',
  neighborhood='Momma'
)

shipper_contact = Iupick.create_person(
  person_name='Tony Stark',
  phone_number='555555555',
  email_address='[email protected]',
  title='CEO',
  company_name='Stark Industries',
  phone_extension='123'
)


recipient_contact = Iupick.create_person(
  person_name='Steve Rogers',
  phone_number='555555555',
  email_address='[email protected]',
  title='Agent',
  company_name='SHIELD',
  phone_extension='123'
)

confirmation_token = Iupick::Shipment.add_information(
  shipment_token = shipment_token,
  waypoint_id = 486,
  shipper_address = shipper_address,
  shipper_contact = shipper_contact,
  recipient_contact = recipient_contact,
  third_party_reference = 'I am a shipment'
)

Step 3.

Generate your waybill with your confirmation token.

waybill_information = Iupick::Shipment.generate_waybill(
  confirmation_token = confirmation_token
)

Tracking your shipment

In order to track a shipment send the carrier and the tracking number.

tracking_info = Iupick::Shipment.track(
  carrier = carrier, tracking_number = tracking_number
)

Waypoints

The Waypoints resource allows you to interact with all the delivery points from our network that are available to your account.

To pull the full information for a single waypoint. Use getWaypointInformation It requires the waypoint unique id.

waypoint = Iupick::Waypoints.get_waypoint_information(waypoint_id = 20)

To get a list of all the coordinates of available waypoints, use getWaypointsLite.

waypoints = Iupick::Waypoints.get_waypoints_lite()

You can get all the waypoints close to a Postal Code with getPostalCodeWaypoints.

cp_waypoints = Iupick::Waypoints.get_postal_code_waypoints(postal_code = 95710)