inpost_uk_api 0.2.0 → 0.2.1

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: 10a4173972e8bd2ba21493c62ddc469b523e8d5ce5e06f5dcc533037556eacfa
4
- data.tar.gz: 30fab7c9f3b86cf249153c55c8d7559c1dfaad953d41ea32579ee00425698054
3
+ metadata.gz: 6dda1cffb81e05a5949565a77a66129e85ee1265abd65ecb0c153f1d8f43f724
4
+ data.tar.gz: bd4b3ea8f0c8f10efeda5c2857a1f7a7da9ded6c81ddcb5716a3de5f3af3e66f
5
5
  SHA512:
6
- metadata.gz: '059e75f99fcb60131555089b9d5210e01ab002e3db6b1a4cdcea818ddb1856a76a728d930bf6b0bafb64e5cd2036dba3acfa41826d65cd9b7d6e8d30f7ba6608'
7
- data.tar.gz: c488fb94973cdb6a92f93c4a0285f9b304878b14e8dca6efde76dd051337340a9146128304b1646045969d92e63b469451ef6d09c2cbcdea16a3b5c79a639cea
6
+ metadata.gz: 7d5e923cbcc947a6bf8420498757998bfaf6cb3f640ba8bc78fcc731a484cfa4e9910265c725ed70e39452a6215ac5ade56c88a75e8947f297a5a7ce8ff33cf4
7
+ data.tar.gz: 77559295091da1a0c4fedcad2fbd4aa2a6d68203aaaad0d0f4cb1335b27cf657aa7ed04600244819180f04e416f4c7895976c45c93aa69a606793609e65265f4
data/.env.sample ADDED
@@ -0,0 +1,3 @@
1
+ RETAILER=
2
+ API_TOKEN=
3
+ SITE=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- inpost_uk_api (0.1.1)
4
+ inpost_uk_api (0.2.0)
5
5
  activeresource (>= 6.0.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # InPostUKAPI
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/inpost_uk_api`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
2
+ This is an unofficial Ruby API wrapper for `https://developers.inpost.co.uk/`
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
@@ -21,8 +17,42 @@ Or install it yourself as:
21
17
  $ gem install inpost_uk_api
22
18
 
23
19
  ## Usage
24
-
25
- TODO: Write usage instructions here
20
+ ### Returns
21
+ #### Create a Returns Request
22
+ Doc: https://developers.inpost.co.uk/#operation/createReturns
23
+ ```ruby
24
+ re = InPostUKAPI::Return.new(
25
+ sender_email: "sender@postco.co",
26
+ sender_phone: "7999999999",
27
+ size: "A",
28
+ customer_reference: "customer reference number",
29
+ show_quick_send_code: "true"
30
+ )
31
+ re.save
32
+
33
+ re.id # => "CS0000000009778"
34
+ re.status # => "customer_delivering
35
+ ```
36
+ #### Get Returns QR Code
37
+ Doc: https://developers.inpost.co.uk/#operation/getReturnsLabel
38
+ ```ruby
39
+ label = InPostUKAPI::ReturnLabel.find("CS0000000009778")
40
+ label # => a pdf blob string
41
+ ```
42
+ #### Request Tracking Data (only for PROD)
43
+ The tracking data you got might not be the right one if you are querying using the Return id from the staging server.
44
+ Doc: https://developers.inpost.co.uk/#operation/getTracking
45
+ ```ruby
46
+ tracking = InPostUKAPI::Tracking.find("CS0000000009778")
47
+ CS0000000009778_trackings = tracking.CS0000000009778
48
+ CS0000000009778_trackings.first.ts # => "29/03/2021 15:43:56pm"
49
+ CS0000000009778_trackings.first.description # => "Ready For Dispatch"
50
+
51
+ # Can query for multiple parcels by separating the ids by ";".
52
+ tracking = InPostUKAPI::Tracking.where("CS0000000009778;CS0000000009777;CSDDD")
53
+ CSDDD_trackings = tracking.CSDDD
54
+ CSDDD_trackings.error # => "No events found for consignment CSDDD"
55
+ ```
26
56
 
27
57
  ## Development
28
58
 
@@ -30,9 +60,21 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
30
60
 
31
61
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
62
 
63
+ ### Pending Endpoints
64
+ - [ ] [APM Locations API](https://developers.inpost.co.uk/#tag/APM-Locations-API)
65
+ - [ ] [getAPMLocations](https://developers.inpost.co.uk/#operation/getAPMLocations)
66
+ - [ ] [Address to Locker Label Creation](https://developers.inpost.co.uk/#tag/Address-to-Locker-Label-Creation)
67
+ - [ ] [Create Address to Locker Label](https://developers.inpost.co.uk/#operation/addressToLocker)
68
+ - [ ] [Pay for Address to Locker Parcel](https://developers.inpost.co.uk/#operation/addressToLockerPayment)
69
+ - [ ] [Get Address to Locker Parcel Label](https://developers.inpost.co.uk/#operation/getAddressToLockerLabel)
70
+ - [ ] [Locker to Address Label Creation](https://developers.inpost.co.uk/#tag/Locker-to-Address-Label-Creation)
71
+ - [ ] [Create Locker to Address Label](https://developers.inpost.co.uk/#operation/lockerToAdddress)
72
+ - [ ] [Pay for Locker to Address Parcel](https://developers.inpost.co.uk/#operation/lockerToAddressPayment)
73
+ - [ ] [Get Locker to Address Parcel Label](https://developers.inpost.co.uk/#operation/getLockerToAddressLabel)
74
+
33
75
  ## Contributing
34
76
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/inpost_uk_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/inpost_uk_api/blob/main/CODE_OF_CONDUCT.md).
77
+ Bug reports and pull requests are welcome on GitHub at https://github.com/postco/inpost_uk_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/postco/inpost_uk_api/blob/main/CODE_OF_CONDUCT.md).
36
78
 
37
79
  ## License
38
80
 
@@ -40,4 +82,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
82
 
41
83
  ## Code of Conduct
42
84
 
43
- Everyone interacting in the InPostUKAPI project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/inpost_uk_api/blob/main/CODE_OF_CONDUCT.md).
85
+ Everyone interacting in the InPostUKAPI project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/postco/inpost_uk_api/blob/main/CODE_OF_CONDUCT.md).
data/bin/setup CHANGED
@@ -3,6 +3,8 @@ set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
+ cp .env.sample .env
7
+
6
8
  bundle install
7
9
 
8
10
  # Do any other automated setup that you need to do here
@@ -7,9 +7,10 @@ module InPostUKAPI
7
7
  DEFAULT_ATTRS = {
8
8
  sender_email: 'customer_email@inpost.co.uk',
9
9
  sender_phone: '7999999999',
10
- size: 'A',
11
10
  customer_reference: 'customer reference number',
12
- show_quick_send_code: 'true'
11
+ show_quick_send_code: 'false'
13
12
  }
13
+
14
+ validates_presence_of :sender_email, :sender_phone
14
15
  end
15
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InPostUKAPI
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inpost_uk_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Chong
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-12 00:00:00.000000000 Z
11
+ date: 2022-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -143,6 +143,7 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
+ - ".env.sample"
146
147
  - ".rspec"
147
148
  - ".standard.yml"
148
149
  - CHANGELOG.md