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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fead41c9ed83794a80cd9d7a59e56f74f3a380ceaeb82400737fb95881f7093d
4
- data.tar.gz: 4e0ae9278b584dee9e56005fc28a309f7d249311ea507f1191bc4cea45ce8bba
3
+ metadata.gz: 16249a785877b88d4deca9f3906fd728eff2047ad79dd66764f6074f90ae7240
4
+ data.tar.gz: 9e3b049006a653badbec3b593ab9103c19b71e41f53233ced8a132a7aa782f5e
5
5
  SHA512:
6
- metadata.gz: '09b2946c2840b79f9f9f62b35b8da24952df7d81c8e597e69373fbe4f86b1ebd6e18bb6a775a902a019370eeed8f80bf2547b8a4a52789edc5574972e1851647'
7
- data.tar.gz: 25bf30bb532d695f769adad74c8048d1b934b5d1638403b20489c3c414ebd5856c76bf87af3ff76ecc2e0a9a1b59c3fd2c7d5d77f8c6d67d86bfe691154cc02e
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
- #### Request Tracking Data (only for PROD)
55
- The tracking data you got might not be the right one if you are querying using the Return id from the staging server.
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InPostUKAPI
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inpost_uk_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Chong