inpost_uk_api 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.sample +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +51 -9
- data/bin/setup +2 -0
- data/lib/inpost_uk_api/resources/return.rb +3 -2
- data/lib/inpost_uk_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dda1cffb81e05a5949565a77a66129e85ee1265abd65ecb0c153f1d8f43f724
|
4
|
+
data.tar.gz: bd4b3ea8f0c8f10efeda5c2857a1f7a7da9ded6c81ddcb5716a3de5f3af3e66f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d5e923cbcc947a6bf8420498757998bfaf6cb3f640ba8bc78fcc731a484cfa4e9910265c725ed70e39452a6215ac5ade56c88a75e8947f297a5a7ce8ff33cf4
|
7
|
+
data.tar.gz: 77559295091da1a0c4fedcad2fbd4aa2a6d68203aaaad0d0f4cb1335b27cf657aa7ed04600244819180f04e416f4c7895976c45c93aa69a606793609e65265f4
|
data/.env.sample
ADDED
data/Gemfile.lock
CHANGED
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
|
-
|
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/
|
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/
|
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
@@ -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: '
|
11
|
+
show_quick_send_code: 'false'
|
13
12
|
}
|
13
|
+
|
14
|
+
validates_presence_of :sender_email, :sender_phone
|
14
15
|
end
|
15
16
|
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.
|
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-
|
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
|