xpost
A ruby gem for accessing the xpost API created by xpanse.
Configuration
# config/initializers/xpost.rb
Xpost.configure do |config|
config.api_key = 'your_api_key'
config.secret_key = 'your_secret_key'
end
Authentication
api_key = "1234"
secret_key = "ABCD"
Xpost::Authentication.authenticate(api_key, secret_key)
# "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0IiwiaWF0IjoxNTI2MzgzMzE0LCJqdGkiOjE1MjYzODMzMTR9.iXbnbn7XRmrq2msAMEGyv8cTl2PWkpfP7EbztKNo00A"
Order
Order.find
Returns all order data.
auth_token = "..."
tracking_number = "0076-1174-PSAT"
Xpost::Order.find(auth_token, tracking_number)
Order.track
Returns the order events of a specific order.
auth_token = "..."
tracking_number = "0076-1174-PSAT"
Xpost::Order.find(auth_token, tracking_number)
Order Flow
Order.create(auth_token, options: )
Order.confirm(auth_token, /payment_reference_id)
Order.for_pickup(auth_token, pickup_address)
Testing
Disclaimer: Most of the API calls still try to connect to an external HTTP connection.