GHTK API Caller
GHTK Documentation: https://docs.giaohangtietkiem.vn
Installation
Add this line to your application's Gemfile:
gem 'ghtk'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ghtk
Setup for Rails
Add config/initializers/ghtk.rb
file
Ghtk.setup do |config|
config.domain = '' # Add domain for sandbox or production
config.access_token = '' # Add your token of sandbox or production
config.version = 1.5
end
Usage
How to create Order
serializer = ShippingServices::GhtkSerializer.new(Shipment.last)
Ghtk::Order.create(serializer)
- Response data: detail
How to get Order detail for check status,.....
Ghtk::Order.get_detail(tracking_code)
- Response data: detail
How to cancel Order
Ghtk::Order.cancel(tracking_code)
- Response data: detail
How to check shipping fee
serializer = ShippingServices::GhtkFeeSerializer.new(Shipment.last)
Ghtk::ShippingFee.check(serializer)
- Response data: detail