nz_post_api 0.2.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d0448e4e338c37344fa3fa6ab4d945d881da9dd3792cfe313f5606f557d8b2cb
4
+ data.tar.gz: b7185609015910d3c29d1035d49ab84de2232b9954843cf68984ab8cedb0e17d
5
+ SHA512:
6
+ metadata.gz: 6ea8af8a2e7996843a7717d717a967906347b34f78b05ff7aa06f53f433f51ede93c4a26daab9c6a0d566e801c5c005608739951d626b567609998971e0df394
7
+ data.tar.gz: acfdac12a138c5961411c03673b28223f7516fd8603756bab64387d5673b189a8d9eb79cd36829b8e154dc4ee70e8c5e347cf6aecf55af64895676c65f21f85b
data/AGENTS.md ADDED
@@ -0,0 +1,24 @@
1
+ # AGENTS
2
+
3
+ This project is a Ruby gem wrapper for the NZ Post API.
4
+
5
+ ## Principles
6
+
7
+ 1. **TDD**: Write tests first using RSpec.
8
+ 2. **Mocking**: Use WebMock for all external HTTP requests.
9
+ 3. **Structure**: Follow the pattern of having resources and a client.
10
+ 4. **Code Style**: Follow standard Ruby conventions.
11
+
12
+ ## Development Workflow
13
+
14
+ 1. Create a spec file for the new feature.
15
+ 2. Implement the test case.
16
+ 3. Implement the code to pass the test.
17
+ 4. Refactor.
18
+
19
+ ## API Documentation
20
+
21
+ - **Authentication**: Requires `client_id` and `client_secret` to get a Bearer token.
22
+ - **Resources**:
23
+ - `ParcelAddress`: Address search/validation.
24
+ - `ParcelLabel`: Label creation, status check, download.
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2026-02-02
4
+
5
+ - Initial release
data/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Andy Chong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,206 @@
1
+ # NzPostApi
2
+
3
+ A Ruby gem wrapper for the NZ Post API.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ ```bash
10
+ bundle add nz_post_api
11
+ ```
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ ```bash
16
+ gem install nz_post_api
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### Authentication
22
+
23
+ First, you need to obtain an access token using your client credentials.
24
+
25
+ ```ruby
26
+ token_response = NzPostApi::Auth.fetch_token("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET")
27
+ access_token = token_response["access_token"]
28
+ expires_in = token_response["expires_in"]
29
+ ```
30
+
31
+ > [!IMPORTANT]
32
+ > The access token expires after a certain period (indicated by `expires_in`). It is highly recommended to cache the `access_token` and reuse it until it expires to avoid unnecessary API calls and potential rate limiting.
33
+
34
+ Then, initialize the client with the access token.
35
+
36
+ ```ruby
37
+ client = NzPostApi::Client.new(client_id: "YOUR_CLIENT_ID", access_token: access_token)
38
+ ```
39
+
40
+ ### Parcel Address
41
+
42
+ #### Search
43
+
44
+ Search for an address using a query string.
45
+
46
+ ```ruby
47
+ address_client = client.parcel_address
48
+ response = address_client.search(q: "Damson", count: 10)
49
+
50
+ response.each do |address|
51
+ puts address.full_address
52
+ puts address.dpid
53
+ end
54
+ ```
55
+
56
+ ### Parcel Label
57
+
58
+ #### Create Label
59
+
60
+ Create a new parcel label.
61
+
62
+ ```ruby
63
+ label_client = client.parcel_label
64
+
65
+ payload = {
66
+ "carrier" => "COURIERPOST",
67
+ "orientation" => "LANDSCAPE",
68
+ "format" => "PDF",
69
+ "logo_id_" => "B8D51C2B-5606-4B30-B2CD-2EAA9F4DD29F",
70
+ "notification_endpoint" => "http://my.endpoint.com/status",
71
+ "sender_reference_1" => "Order123",
72
+ "sender_reference_2" => "CC 52",
73
+ "label_dimensions" => "174x100",
74
+ "sender_details" => {
75
+ "name" => "Joe Sender",
76
+ "phone" => "6490000001",
77
+ "email" => "joe.sender@nzpost.co.nz",
78
+ "company_name" => "Sender ltd",
79
+ "site_code" => 44111
80
+ },
81
+ "pickup_address" => {
82
+ "company_name" => "Sender ltd",
83
+ "building_name" => "Sender Building",
84
+ "unit_type" => "Unit",
85
+ "unit_value" => "5",
86
+ "floor" => "3",
87
+ "street_number" => "151",
88
+ "street" => "Victoria Street West",
89
+ "suburb" => "Auckland Central",
90
+ "city" => "Auckland",
91
+ "country_code": "NZ",
92
+ "postcode" => "1010"
93
+ },
94
+ "receiver_details" => {
95
+ "name" => "Joe Receiver",
96
+ "phone" => "6490000002",
97
+ "email" => "joe.receiver@nzpost.co.nz"
98
+ },
99
+ "delivery_address" => {
100
+ "is_collection" => false,
101
+ "company_name" => "Receiver ltd",
102
+ "building_name" => "Receiver Building",
103
+ "unit_type" => "Suite",
104
+ "unit_value" => "4",
105
+ "floor" => "L2",
106
+ "street_number" => "42C",
107
+ "street" => "Tawa Drive",
108
+ "suburb" => "Albany",
109
+ "city" => "Auckland",
110
+ "country_code" => "NZ",
111
+ "postcode" => "0632",
112
+ "instructions" => "Ring the doorbell"
113
+ },
114
+ "parcel_details" => [
115
+ {
116
+ "service_code" => "CPOLP",
117
+ "return_indicator" => "RETURN",
118
+ "description" => "MEDIUM",
119
+ "dimensions" => {
120
+ "length_cm" => 5.5,
121
+ "width_cm" => 10.4,
122
+ "height_cm" => 15,
123
+ "weight_kg" => 5
124
+ }
125
+ }
126
+ ]
127
+ }
128
+
129
+ label = label_client.create(payload)
130
+ puts label.consignment_id
131
+ ```
132
+
133
+ #### Check Status
134
+
135
+ Check the status of a label generation.
136
+
137
+ ```ruby
138
+ status = label_client.status("CONSIGNMENT_ID")
139
+ puts status.consignment_status
140
+ ```
141
+
142
+ #### Download Label
143
+
144
+ Download a generated label in PDF format using `Tempfile`.
145
+
146
+ ```ruby
147
+ require "tempfile"
148
+
149
+ pdf_content = label_client.download("CONSIGNMENT_ID", format: "PDF")
150
+
151
+ # Write to a temporary file
152
+ file = Tempfile.new(["label", ".pdf"])
153
+ file.binmode
154
+ file.write(pdf_content)
155
+ file.rewind
156
+
157
+ puts "Label saved to #{file.path}"
158
+
159
+ # Do something with the file...
160
+
161
+ file.close
162
+ file.unlink # deletes the temp file
163
+ ```
164
+
165
+ ### Shipping Options
166
+
167
+ #### List Options
168
+
169
+ List available shipping options based on package details.
170
+
171
+ ```ruby
172
+ shipping_client = client.shipping_options
173
+
174
+ params = {
175
+ weight: 10,
176
+ length: 10,
177
+ width: 10,
178
+ height: 10,
179
+ pickup_address_id: "990003",
180
+ delivery_dpid: "2727895"
181
+ }
182
+
183
+ response = shipping_client.list(params)
184
+ response.services.each do |service|
185
+ puts service.service_code
186
+ puts service.description
187
+ end
188
+
189
+ ## Development
190
+
191
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
192
+
193
+ 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).
194
+
195
+ ## Contributing
196
+
197
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/nz_post_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]/nz_post_api/blob/main/CODE_OF_CONDUCT.md).
198
+
199
+ ## License
200
+
201
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
202
+
203
+ ## Code of Conduct
204
+
205
+ Everyone interacting in the NzPostApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/nz_post_api/blob/main/CODE_OF_CONDUCT.md).
206
+ ```
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[spec standard]
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "json"
5
+
6
+ module NzPostApi
7
+ class Auth
8
+ TOKEN_URL = "https://oauth.nzpost.co.nz/as/token.oauth2"
9
+
10
+ def self.fetch_token(client_id, client_secret)
11
+ response = Faraday.post(TOKEN_URL, {
12
+ client_id: client_id,
13
+ client_secret: client_secret,
14
+ grant_type: "client_credentials"
15
+ })
16
+
17
+ if response.success?
18
+ JSON.parse(response.body)
19
+ else
20
+ raise NzPostApi::Error, "Failed to fetch token: #{response.status} - #{response.body}"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+
5
+ module NzPostApi
6
+ class Client
7
+ attr_reader :client_id, :access_token
8
+
9
+ def initialize(client_id:, access_token:)
10
+ @client_id = client_id
11
+ @access_token = access_token
12
+ end
13
+
14
+ def connection
15
+ @connection ||= Faraday.new do |f|
16
+ f.request :json
17
+ f.response :json
18
+ f.headers["client_id"] = client_id
19
+ f.headers["Authorization"] = "Bearer #{access_token}"
20
+ f.headers["Content-Type"] = "application/json"
21
+ end
22
+ end
23
+
24
+ def parcel_address
25
+ Resources::ParcelAddress.new(self)
26
+ end
27
+
28
+ def parcel_label
29
+ Resources::ParcelLabel.new(self)
30
+ end
31
+
32
+ def shipping_options
33
+ Resources::ShippingOption.new(self)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NzPostApi
4
+ module Objects
5
+ class Address < Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support"
4
+ require "active_support/core_ext/string"
5
+ require "ostruct"
6
+
7
+ module NzPostApi
8
+ module Objects
9
+ class Base < OpenStruct
10
+ attr_reader :original_response
11
+
12
+ def initialize(attributes)
13
+ @original_response = deep_freeze_object(attributes)
14
+ super(to_ostruct(attributes))
15
+ end
16
+
17
+ def to_ostruct(obj)
18
+ if obj.is_a?(Hash)
19
+ OpenStruct.new(obj.transform_keys { |key| key.to_s.underscore }.transform_values { |val| to_ostruct(val) })
20
+ elsif obj.is_a?(Array)
21
+ obj.map { |o| to_ostruct(o) }
22
+ else # Assumed to be a primitive value
23
+ obj
24
+ end
25
+ end
26
+
27
+ # Convert back to hash representation
28
+ def to_hash
29
+ ostruct_to_hash(self)
30
+ end
31
+
32
+ # Get the raw original response data
33
+ def raw
34
+ @original_response
35
+ end
36
+
37
+ private
38
+
39
+ def deep_freeze_object(obj)
40
+ case obj
41
+ when Hash
42
+ obj.transform_values { |value| deep_freeze_object(value) }.freeze
43
+ when Array
44
+ obj.map { |item| deep_freeze_object(item) }.freeze
45
+ else
46
+ obj.respond_to?(:freeze) ? obj.freeze : obj
47
+ end
48
+ end
49
+
50
+ def ostruct_to_hash(object)
51
+ case object
52
+ when OpenStruct
53
+ hash = object.to_h.except(:table)
54
+ hash.transform_keys(&:to_s).transform_values { |value| ostruct_to_hash(value) }
55
+ when Array
56
+ object.map { |item| ostruct_to_hash(item) }
57
+ when Hash
58
+ object.transform_keys(&:to_s).transform_values { |value| ostruct_to_hash(value) }
59
+ else
60
+ object
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NzPostApi
4
+ module Objects
5
+ class Label < Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NzPostApi
4
+ module Objects
5
+ class ShippingOption < Base
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NzPostApi
4
+ module Resources
5
+ class ParcelAddress
6
+ BASE_URL = "https://api.uat.nzpost.co.nz/parceladdress/2.0/domestic/addresses"
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def search(q:, count: 10)
13
+ response = @client.connection.get(BASE_URL, { q: q, count: count })
14
+
15
+ if response.success?
16
+ response.body["addresses"].map { |addr| Objects::Address.new(addr) }
17
+ else
18
+ raise NzPostApi::Error, "Failed to search addresses: #{response.status} - #{response.body}"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NzPostApi
4
+ module Resources
5
+ class ParcelLabel
6
+ BASE_URL = "https://api.uat.nzpost.co.nz/parcellabel/v3/labels"
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def create(payload)
13
+ response = @client.connection.post(BASE_URL, payload)
14
+ handle_response(response)
15
+ end
16
+
17
+ def status(consignment_id)
18
+ response = @client.connection.get("#{BASE_URL}/#{consignment_id}/status")
19
+ handle_response(response)
20
+ end
21
+
22
+ def download(consignment_id, format: "PDF")
23
+ response = @client.connection.get("#{BASE_URL}/#{consignment_id}", { format: format })
24
+ if response.success?
25
+ response.body
26
+ else
27
+ raise NzPostApi::Error, "Failed to download label: #{response.status} - #{response.body}"
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def handle_response(response)
34
+ if response.success?
35
+ Objects::Label.new(response.body)
36
+ else
37
+ raise NzPostApi::Error, "Failed to create/get label: #{response.status} - #{response.body}"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NzPostApi
4
+ module Resources
5
+ class ShippingOption
6
+ BASE_URL = "https://api.uat.nzpost.co.nz/shippingoptions/2.0/domestic"
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def list(params = {})
13
+ response = @client.connection.get(BASE_URL, params)
14
+
15
+ if response.success?
16
+ Objects::ShippingOption.new(response.body)
17
+ else
18
+ raise NzPostApi::Error, "Failed to list options: #{response.status} - #{response.body}"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NzPostApi
4
+ VERSION = "0.2.0"
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "nz_post_api/version"
4
+ require_relative "nz_post_api/objects/base"
5
+ require_relative "nz_post_api/objects/address"
6
+ require_relative "nz_post_api/objects/label"
7
+ require_relative "nz_post_api/objects/shipping_option"
8
+ require_relative "nz_post_api/auth"
9
+ require_relative "nz_post_api/client"
10
+ require_relative "nz_post_api/resources/parcel_address"
11
+ require_relative "nz_post_api/resources/parcel_label"
12
+ require_relative "nz_post_api/resources/shipping_option"
13
+
14
+ module NzPostApi
15
+ class Error < StandardError; end
16
+ # Your code goes here...
17
+ end
@@ -0,0 +1,4 @@
1
+ module NzPostApi
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nz_post_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Andy Chong
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-02-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '6.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '6.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: webmock
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Provides a Ruby interface for NZ Post APIs including Parcel Address,
56
+ Parcel Label, and Shipping Options.
57
+ email:
58
+ - andygg1996personal@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - AGENTS.md
64
+ - CHANGELOG.md
65
+ - CLAUDE.md
66
+ - CODE_OF_CONDUCT.md
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - lib/nz_post_api.rb
71
+ - lib/nz_post_api/auth.rb
72
+ - lib/nz_post_api/client.rb
73
+ - lib/nz_post_api/objects/address.rb
74
+ - lib/nz_post_api/objects/base.rb
75
+ - lib/nz_post_api/objects/label.rb
76
+ - lib/nz_post_api/objects/shipping_option.rb
77
+ - lib/nz_post_api/resources/parcel_address.rb
78
+ - lib/nz_post_api/resources/parcel_label.rb
79
+ - lib/nz_post_api/resources/shipping_option.rb
80
+ - lib/nz_post_api/version.rb
81
+ - sig/nz_post_api.rbs
82
+ homepage: https://github.com/andychong/nz_post_api
83
+ licenses:
84
+ - MIT
85
+ metadata:
86
+ allowed_push_host: https://rubygems.org
87
+ homepage_uri: https://github.com/andychong/nz_post_api
88
+ source_code_uri: https://github.com/andychong/nz_post_api
89
+ changelog_uri: https://github.com/andychong/nz_post_api/blob/main/CHANGELOG.md
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 3.2.0
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.5.22
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: A Ruby wrapper for the NZ Post API.
109
+ test_files: []