inpost_uk_api 0.2.3 → 0.2.4
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 +29 -0
- 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: 8ca535feef8feacc23eea8c863db020eaddce4b2e18605c8ecd902d094b19bf4
|
4
|
+
data.tar.gz: 8ae0307a7022ad320e2dc15e25bf759cf7a8681db35a07c95f98b238c44764ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4657f6257d958d733004523e7fd82f3fc61a6d563173531d49482a14072dfd1e6c3f52f23dec1c052efca0dd04b99525d86ad889833c9d4721266cd0ff3b97c4
|
7
|
+
data.tar.gz: de3171aec2b3f3a169178f39fc92d42dd478eac22b379a1fa74e6511be7cd1dbcce8d05343e1c11825329c1fb8d5423521f7bd67a0c5ad502d42b36ccb862ba3
|
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
|
@@ -68,6 +77,26 @@ tracking = InPostUKAPI::Tracking.where("CS0000000009778;CS0000000009777;CSDDD")
|
|
68
77
|
CSDDD_trackings = tracking.CSDDD
|
69
78
|
CSDDD_trackings.error # => "No events found for consignment CSDDD"
|
70
79
|
```
|
80
|
+
### Temporary credentials
|
81
|
+
You can use the `InPostUKAPI::Base.with_account` method which accept a block to set a temporary credentials. 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
|
+
re = InPostUKAPI::Return.new(
|
89
|
+
sender_email: "sender@postco.co",
|
90
|
+
sender_phone: "7999999999",
|
91
|
+
size: "A",
|
92
|
+
customer_reference: "customer reference number",
|
93
|
+
show_quick_send_code: "true"
|
94
|
+
)
|
95
|
+
re.save
|
96
|
+
label = InPostUKAPI::ReturnLabel.find(re.id)
|
97
|
+
end
|
98
|
+
```
|
99
|
+
|
71
100
|
|
72
101
|
## Development
|
73
102
|
|