README.md in smartsend-ruby-0.0.1 vs README.md in smartsend-ruby-0.0.2
- old
+ new
@@ -1,8 +1,8 @@
# README
-This is a ruby wrapper for the Smartsend.io api.
+A ruby wrapper for the Smartsend.io api.
Before beginning you need a Smartsend account.
## Installation
@@ -27,20 +27,25 @@
### Creating an order
This creates a label.
```ruby
+
+# initalize a new order
order = Smartsend::Order.new(
order_number: "AC12345789",
carrier: "postdanmark", # postdanmark/gls/bring
method: "private",
return: false,
total_price: 199.75,
shipping_price: 49,
- currency: "DKK"
+ currency: "DKK",
+ sms_notification: "12345678",
+ email_notification: "contact@smartsend.io"
)
+# set the receiver of the order
order.receiver = Smartsend::Receiver.new(
id: "123456", # your internal customer id
company: "Smart Send",
name1: "Henrik Hansen",
name2: "C/O Vivian Hansen",
@@ -48,29 +53,28 @@
address2: "3.th.",
zip: "2100",
city: "Copenhagen",
country: "DK",
phone: "12345678",
- mail: "contact@smartsend.io",
- sms_notification: "12345678",
- email_notification: "contact@smartsend.io"
+ mail: "contact@smartsend.io"
)
+# set the receiver of the order
order.sender = Smartsend::Sender.new(
company: "Smart Send",
name1: "Henrik Hansen",
name2: "C/O Vivian Hansen",
address1: "Willemoesgade 42",
address2: "3.th.",
zip: "2100",
city: "Copenhagen",
country: "DK",
- sms: "12345678",
+ phone: "12345678",
mail: "contact@smartsend.io"
)
-# you can ship to a droppoint by defining an agent
+# you can ship to a droppoint by seting an agent
order.agent = Smartsend::Agent.new(
id: "7224", # droppoint id
type: "PDK", # droppoint provider
company: "Smart Send",
name1: "Henrik Hansen",
@@ -82,10 +86,11 @@
country: "DK",
phone: "12345678",
mail: "contact@smartsend.io"
)
+# add one or more parcels/fulfillments to the order
parcel = Smartsend::Parcel.new(
shipped_at: DateTime.now,
reference: "123456789", # your internal parcel id
weight: 1.25,
height: 21,
@@ -97,15 +102,16 @@
"Don't open this before your birthsday Brian",
"We look forward to seeing you soon Brian"
]
)
+# add items to the parcel
parcel_item = Smartsend::ParcelItem.new(
sku: "ABC123",
title: "ABC123",
quantity: 2,
- unitweight: 1.25,
- unitprice: 144.5,
+ unit_weight: 1.25,
+ unit_price: 144.5,
currency: "DKK"
)
parcel.items = [parcel_item]
order.parcels = [parcel]