Project

myparcel

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby wrapper for MyParcel API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 2.1
~> 0.10
~> 10.0
~> 3.0
~> 0.8
~> 3.0
~> 1.24

Runtime

~> 0.14.0
>= 0
 Project Readme

Build Status

MyParcel Ruby gem

MyParcel Ruby gem provides a wrapper for MyParcel API

Installation

Add this line to your application's Gemfile:

gem 'myparcel', '~> 0.1'

And then execute:

$ bundle

Or install it yourself as:

$ gem install myparcel

Usage

Client

client = Myparcel.client('your-api-key')

Shipments

Getting shipments by id:

client.shipments.find shipment_ids: [1, 2, 3]

Getting all shipments:

client.shipments.all
# or
client.shipments.find

Creating shipments:

shipment = {
  recipient: {
    cc: 'NL',
    postal_code: '9999XX',
    city: 'Amsterdam',
    street: 'Hoofdstraat',
    number: '1',
    person: 'John Doe'
  },
  carrier: 1,
  options: {
    package_type: 1
  },
  status: 1
}
client.shipments.create shipments: [shipment]

Deleting shipments (at least one ID is required):

client.shipments.delete shipment_ids: [1, 2, 3]

Delivery options

Get possible delivery options for an address:

client.delivery_options.find cc: 'NL', postal_code: '2131bc', number: 679, carrier: 'postnl'

Track and Trace

Getting Track&Trace codes by shipment IDs:

client.tracktraces.find shipment_ids: [1, 2, 3]

Webhook subscriptions

Creating a webhook:

webhook = {
  hook: "shipment_status_change",
  url: "https://seoshop.nl/myparcel/notifications"
}
client.webhooks.create subscriptions: [webhook]

Getting webhook subscriptions (at least one subscription ID is required):

client.webhooks.find subscription_ids: [1, 2, 3]

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/paypronl/myparcel. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.