inpost_uk_api 0.2.2 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +37 -2
- data/lib/inpost_uk_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16249a785877b88d4deca9f3906fd728eff2047ad79dd66764f6074f90ae7240
|
4
|
+
data.tar.gz: 9e3b049006a653badbec3b593ab9103c19b71e41f53233ced8a132a7aa782f5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d17d31b882b324303ed3a47c44d3f8cd6c2301978ffd7711bd6a60f83e950b551a3772c98c421002dea7eb33e9b32c8cbc383a8bf79c7845d9211319d9c7d96b
|
7
|
+
data.tar.gz: 39edbc92de152ef1c46db4acc575f3d9844409dd8636c43a3fe142c2074d0a25bf78c95a0ef27c4b5518e9327f5d88b6c8bb3f4fe342a9acc0b3fac1b5468ce1
|
data/README.md
CHANGED
@@ -17,6 +17,15 @@ Or install it yourself as:
|
|
17
17
|
$ gem install inpost_uk_api
|
18
18
|
|
19
19
|
## Usage
|
20
|
+
### Configurations
|
21
|
+
```ruby
|
22
|
+
InPostUKAPI.configure do |config|
|
23
|
+
config.site = ENV['SITE']
|
24
|
+
config.retailer = ENV['RETAILER']
|
25
|
+
config.api_token = ENV['API_TOKEN']
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
20
29
|
### Returns
|
21
30
|
#### Create a Returns Request
|
22
31
|
Doc: https://developers.inpost.co.uk/#operation/createReturns
|
@@ -51,8 +60,11 @@ rescue ActiveResource::ResourceNotFound => e
|
|
51
60
|
e.message # => Failed. Response code = 200. Response message = OK.
|
52
61
|
end
|
53
62
|
```
|
54
|
-
|
55
|
-
|
63
|
+
### Request Tracking Data
|
64
|
+
This endpoint only available for PROD labels.
|
65
|
+
|
66
|
+
The tracking data you got might not be the right one if you are querying using the tracking id from the staging server.
|
67
|
+
|
56
68
|
Doc: https://developers.inpost.co.uk/#operation/getTracking
|
57
69
|
```ruby
|
58
70
|
tracking = InPostUKAPI::Tracking.find("CS0000000009778")
|
@@ -65,6 +77,29 @@ tracking = InPostUKAPI::Tracking.where("CS0000000009778;CS0000000009777;CSDDD")
|
|
65
77
|
CSDDD_trackings = tracking.CSDDD
|
66
78
|
CSDDD_trackings.error # => "No events found for consignment CSDDD"
|
67
79
|
```
|
80
|
+
### Temporary credentials
|
81
|
+
You can use the `InPostUKAPI::Base.with_account` method which applies the temporary credentials to the codes in the block. Useful for platform to set different InPost account for each retailer.
|
82
|
+
|
83
|
+
Applicable to [Create a Returns Request](#create-a-returns-request) and [Get Returns QR Code](#get-returns-qr-code).
|
84
|
+
```ruby
|
85
|
+
re, label = nil
|
86
|
+
account = {retailer: "temp@postco.co", api_token: "temp token 123" }
|
87
|
+
InPostUKAPI::Base.with_account(account) do
|
88
|
+
# Now, retailer = "temp@postco.co" and api_token = "temp token 123"
|
89
|
+
|
90
|
+
re = InPostUKAPI::Return.new(
|
91
|
+
sender_email: "sender@postco.co",
|
92
|
+
sender_phone: "7999999999",
|
93
|
+
size: "A",
|
94
|
+
customer_reference: "customer reference number",
|
95
|
+
show_quick_send_code: "true"
|
96
|
+
)
|
97
|
+
re.save
|
98
|
+
label = InPostUKAPI::ReturnLabel.find(re.id)
|
99
|
+
end
|
100
|
+
# Retailer and api_token now back to the one originally set.
|
101
|
+
```
|
102
|
+
|
68
103
|
|
69
104
|
## Development
|
70
105
|
|