hookdeck 0.1.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: 9e777450c58714998a700b290b82c16ef2f43f558bebb6c2fae41dfcd18f5a96
4
+ data.tar.gz: fd355f47639a424fb853974ef71f8de3bba6d3280188bab553c029c0754ec2ce
5
+ SHA512:
6
+ metadata.gz: 9131cb7e24b752acc1cda4829b3c81a33d93bca850e7276d2fc465231d4a0196692d70338f2fcc436d3d46b5ef151fdcdc257c8298598f4f1f720118aed35d99
7
+ data.tar.gz: 5816b5ffb96e5d0ddc0879da48e2f7f74e87ed077157c77920a0add728236fd7a4a7a38f6d1f6471c3bf4992484f862958c33f9f1d9f125adca344c09dfa9658
data/.rubocop.yml ADDED
@@ -0,0 +1,42 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 3.0
4
+ Exclude:
5
+ - 'bin/**/*'
6
+ - 'vendor/**/*'
7
+ - 'db/**/*'
8
+ - 'config/**/*'
9
+ - 'script/**/*'
10
+ - 'node_modules/**/*'
11
+ - 'tmp/**/*'
12
+ - 'Gemfile'
13
+ - 'Rakefile'
14
+ SuggestExtensions: false
15
+
16
+ Metrics/CyclomaticComplexity:
17
+ Max: 15
18
+
19
+ Metrics/MethodLength:
20
+ Max: 35
21
+
22
+
23
+ Metrics/AbcSize:
24
+ Max: 35
25
+
26
+ Metrics/ClassLength:
27
+ Max: 300
28
+
29
+ Metrics/PerceivedComplexity:
30
+ Max: 15
31
+
32
+ Layout/LineLength:
33
+ Max: 120
34
+
35
+ Style/Documentation:
36
+ Enabled: false
37
+
38
+ Style/FrozenStringLiteralComment:
39
+ Enabled: false
40
+
41
+ Style/ClassAndModuleChildren:
42
+ EnforcedStyle: nested
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2024-11-09
9
+
10
+ ### Added
11
+
12
+ - Initial release of the Hookdeck Ruby SDK
13
+ - Basic API client implementation
14
+ - Support for managing webhook sources
15
+ - Support for managing destinations
16
+ - Support for managing connections
17
+ - Support for managing events
18
+ - Support for managing transformations
19
+ - Support for managing retry rules
20
+ - Support for managing bulk operations
21
+ - Support for managing notifications
22
+ - Support for managing issues
23
+ - Comprehensive error handling
24
+ - Thread-safe HTTP client
25
+ - Configurable retries and timeouts
26
+ - API version support
27
+ - Documentation and examples
28
+
29
+ ### Dependencies
30
+
31
+ - Faraday for HTTP client
32
+ - Faraday Middleware for request/response handling
33
+ - JSON for payload handling
@@ -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) 2024 Emmanuel ADEBAYO
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/Makefile ADDED
@@ -0,0 +1,22 @@
1
+ .PHONY: setup lint lint-fix test
2
+
3
+ setup:
4
+ @echo "Installing dependencies..."
5
+ @bundle install
6
+
7
+ lint:
8
+ @echo "Running RuboCop..."
9
+ @bundle exec rubocop
10
+
11
+ lint-fix:
12
+ @echo "Running RuboCop auto-correct..."
13
+ @bundle exec rubocop -a
14
+
15
+ test:
16
+ @echo "Running tests..."
17
+ @bundle exec rspec
18
+
19
+ ci: setup lint test
20
+ @echo "CI pipeline completed successfully!"
21
+
22
+ .DEFAULT_GOAL := setup
data/README.md ADDED
@@ -0,0 +1,249 @@
1
+ # Hookdeck Ruby SDK
2
+
3
+ The official Ruby library for the [Hookdeck API](https://hookdeck.com).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'hookdeck'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ bundle install
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```bash
22
+ gem install hookdeck
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Configuration
28
+
29
+ ```ruby
30
+ require 'hookdeck'
31
+
32
+ # Configure the client globally
33
+ Hookdeck.configure do |config|
34
+ config.api_key = 'your_api_key'
35
+ config.api_version = '2024-09-01' # Optional, defaults to latest version
36
+ end
37
+
38
+ # Or initialize a client instance
39
+ client = Hookdeck.new('your_api_key', api_version: '2024-09-01')
40
+ ```
41
+
42
+ ### Sources
43
+
44
+ ```ruby
45
+ # List sources
46
+ sources = client.sources.list(limit: 10)
47
+
48
+ # Create a source
49
+ source = client.sources.create(
50
+ name: 'My Webhook Source',
51
+ url: 'https://api.example.com/webhooks'
52
+ )
53
+
54
+ # Retrieve a source
55
+ source = client.sources.retrieve('src_123')
56
+
57
+ # Update a source
58
+ source = client.sources.update('src_123',
59
+ name: 'Updated Source Name'
60
+ )
61
+
62
+ # Disable a source
63
+ client.sources.disable('src_123')
64
+
65
+ # Enable a source
66
+ client.sources.enable('src_123')
67
+
68
+ # Delete a source
69
+ client.sources.delete('src_123')
70
+ ```
71
+
72
+ ### Destinations
73
+
74
+ ```ruby
75
+ # List destinations
76
+ destinations = client.destinations.list(limit: 10)
77
+
78
+ # Create a destination
79
+ destination = client.destinations.create(
80
+ name: 'My API Endpoint',
81
+ url: 'https://api.example.com/webhooks',
82
+ http_method: 'POST',
83
+ headers: {
84
+ 'Authorization': 'Bearer token'
85
+ }
86
+ )
87
+
88
+ # Retrieve a destination
89
+ destination = client.destinations.retrieve('dst_123')
90
+
91
+ # Update a destination
92
+ destination = client.destinations.update('dst_123',
93
+ headers: { 'X-Custom-Header': 'value' }
94
+ )
95
+
96
+ # Delete a destination
97
+ client.destinations.delete('dst_123')
98
+ ```
99
+
100
+ ### Connections
101
+
102
+ ```ruby
103
+ # List connections
104
+ connections = client.connections.list(limit: 10)
105
+
106
+ # Create a connection
107
+ connection = client.connections.create(
108
+ source_id: 'src_123',
109
+ destination_id: 'dst_456',
110
+ retry_rule_id: 'rr_789'
111
+ )
112
+
113
+ # Retrieve a connection
114
+ connection = client.connections.retrieve('conn_123')
115
+
116
+ # Update a connection
117
+ connection = client.connections.update('conn_123',
118
+ ruleset: {
119
+ rules: [
120
+ {
121
+ type: 'filter',
122
+ config: {
123
+ condition: 'event.type == "order.created"'
124
+ }
125
+ }
126
+ ]
127
+ }
128
+ )
129
+
130
+ # Delete a connection
131
+ client.connections.delete('conn_123')
132
+ ```
133
+
134
+ ### Events
135
+
136
+ ```ruby
137
+ # List events
138
+ events = client.events.list(
139
+ source_id: 'src_123',
140
+ status: 'failed',
141
+ created_at: {
142
+ gte: '2024-01-01T00:00:00Z'
143
+ }
144
+ )
145
+
146
+ # Retrieve an event
147
+ event = client.events.retrieve('evt_123')
148
+
149
+ # Retry an event
150
+ client.events.retry('evt_123')
151
+
152
+ # Mute an event
153
+ client.events.mute('evt_123')
154
+ ```
155
+
156
+ ### Transformations
157
+
158
+ ```ruby
159
+ # List transformations
160
+ transformations = client.transformations.list(limit: 10)
161
+
162
+ # Create a transformation
163
+ transformation = client.transformations.create(
164
+ name: 'Add Timestamp',
165
+ code: 'event.data.timestamp = Date.now(); return event;'
166
+ )
167
+
168
+ # Retrieve a transformation
169
+ transformation = client.transformations.retrieve('tr_123')
170
+
171
+ # Update a transformation
172
+ transformation = client.transformations.update('tr_123',
173
+ code: 'return { ...event, modified: true };'
174
+ )
175
+
176
+ # Run a transformation
177
+ result = client.transformations.run(
178
+ code: 'return { ...event, processed: true };',
179
+ event: { data: { type: 'test' } }
180
+ )
181
+
182
+ # Delete a transformation
183
+ client.transformations.delete('tr_123')
184
+ ```
185
+
186
+ ### Issue Triggers
187
+
188
+ ```ruby
189
+ # List issue triggers
190
+ triggers = client.issue_triggers.list(limit: 10)
191
+
192
+ # Create an issue trigger
193
+ trigger = client.issue_triggers.create(
194
+ name: 'High Error Rate',
195
+ type: 'error_rate',
196
+ config: {
197
+ threshold: 0.1,
198
+ window: '15m'
199
+ }
200
+ )
201
+
202
+ # Retrieve an issue trigger
203
+ trigger = client.issue_triggers.retrieve('trig_123')
204
+
205
+ # Update an issue trigger
206
+ trigger = client.issue_triggers.update('trig_123',
207
+ config: { threshold: 0.05 }
208
+ )
209
+
210
+ # Delete an issue trigger
211
+ client.issue_triggers.delete('trig_123')
212
+ ```
213
+
214
+ ## Error Handling
215
+
216
+ ```ruby
217
+
218
+ begin
219
+ client.sources.retrieve('invalid_id')
220
+ rescue Hookdeck::NotFoundError => e
221
+ puts "Resource not found: #{e.message}"
222
+ rescue Hookdeck::ValidationError => e
223
+ puts "Invalid parameters: #{e.message}"
224
+ rescue Hookdeck::ApiError => e
225
+ puts "API error: #{e.message}"
226
+ puts "Status: #{e.status}"
227
+ puts "Request ID: #{e.request_id}"
228
+ end
229
+ ```
230
+
231
+ ## Development
232
+
233
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can
234
+ also run `bin/console` for an interactive prompt that will allow you to experiment.
235
+
236
+ ## Contributing
237
+
238
+ Bug reports and pull requests are welcome on GitHub at https://github.com/toluwaanimi/hookdeck.rb. This project is
239
+ intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
240
+ the [code of conduct](https://github.com/toluwaanimi/hookdeck.rb/blob/main/CODE_OF_CONDUCT.md).
241
+
242
+ ## License
243
+
244
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
245
+
246
+ ## Code of Conduct
247
+
248
+ Everyone interacting in the Hookdeck Ruby SDK project's codebases, issue trackers, chat rooms and mailing lists is
249
+ expected to follow the [code of conduct](https://github.com/toluwaanimi/hookdeck.rb/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'minitest/test_task'
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require 'standard/rake'
9
+
10
+ task default: %i[test standard]
@@ -0,0 +1,168 @@
1
+ module Hookdeck
2
+ class Client
3
+ extend Forwardable
4
+
5
+ attr_reader :config, :http_client
6
+
7
+ def initialize(api_key = nil, options = {})
8
+ @config = build_config(api_key, options)
9
+ @http_client = HttpClient.new(@config)
10
+ initialize_resources
11
+ end
12
+
13
+ # Sends a request to the Hookdeck API.
14
+ #
15
+ # @param method [String] The HTTP method.
16
+ # @param path [String] The path.
17
+ # @param params [Hash] The parameters.
18
+ # @param opts [Hash] The options.
19
+ # @return [Hash] The response.
20
+ def request(method, path, params = {}, opts = {})
21
+ response = http_client.connection.public_send(method) do |req|
22
+ req.url(path)
23
+ req.params = params if params.any?
24
+ req.body = opts[:body].to_json if opts[:body]
25
+ req.headers.merge!(opts[:headers] || {})
26
+ end
27
+
28
+ response.body
29
+ end
30
+
31
+ # Accessor for the Attempt resource.
32
+ #
33
+ # @return [Hookdeck::Resources::Attempt] The Attempt resource.
34
+ def attempts
35
+ @attempts ||= Hookdeck::Resources::Attempt.new(self)
36
+ end
37
+
38
+ # Accessor for the Bookmark resource.
39
+ #
40
+ # @return [Hookdeck::Resources::Bookmark] The Bookmark resource.
41
+ def bookmarks
42
+ @bookmarks ||= Hookdeck::Resources::Bookmark.new(self)
43
+ end
44
+
45
+ # Accessor for the Connection resource.
46
+ #
47
+ # @return [Hookdeck::Resources::Connection] The Connection resource.
48
+ def connections
49
+ @connections ||= Hookdeck::Resources::Connection.new(self)
50
+ end
51
+
52
+ # Accessor for the Event resource.
53
+ #
54
+ # @return [Hookdeck::Resources::Event] The Event resource.
55
+ def events
56
+ @events ||= Hookdeck::Resources::Event.new(self)
57
+ end
58
+
59
+ # Accessor for the Notification resource.
60
+ #
61
+ # @return [Hookdeck::Resources::Notification] The Notification resource.
62
+ def notifications
63
+ @notifications ||= Hookdeck::Resources::Notification.new(self)
64
+ end
65
+
66
+ # Accessor for the Source resource.
67
+ #
68
+ # @return [Hookdeck::Resources::Source] The Source resource.
69
+ def sources
70
+ @sources ||= Hookdeck::Resources::Source.new(self)
71
+ end
72
+
73
+ # Accessor for the Destination resource.
74
+ #
75
+ # @return [Hookdeck::Resources::Destination] The Destination resource.
76
+ def destinations
77
+ @destinations ||= Hookdeck::Resources::Destination.new(self)
78
+ end
79
+
80
+ # Accessor for the Issue resource.
81
+ #
82
+ # @return [Hookdeck::Resources::Issue] The Issue resource.
83
+ def issues
84
+ @issues ||= Hookdeck::Resources::Issue.new(self)
85
+ end
86
+
87
+ # Accessor for the IssueTrigger resource.
88
+ #
89
+ # @return [Hookdeck::Resources::IssueTrigger] The IssueTrigger resource.
90
+ def issue_triggers
91
+ @issue_triggers ||= Hookdeck::Resources::IssueTrigger.new(self)
92
+ end
93
+
94
+ # Accessor for the CustomDomain resource.
95
+ #
96
+ # @return [Hookdeck::Resources::CustomDomain] The CustomDomain resource.
97
+ def custom_domains
98
+ @custom_domains ||= Hookdeck::Resources::CustomDomain.new(self)
99
+ end
100
+
101
+ # Accessor for the Request resource.
102
+ #
103
+ # @return [Hookdeck::Resources::Request] The Request resource.
104
+ def requests
105
+ @requests ||= Hookdeck::Resources::Request.new(self)
106
+ end
107
+
108
+ # Accessor for the Transformation resource.
109
+ #
110
+ # @return [Hookdeck::Resources::Transformation] The Transformation resource.
111
+ def transformations
112
+ @transformations ||= Hookdeck::Resources::Transformation.new(self)
113
+ end
114
+
115
+ # Accessor for the BulkIgnoredEventsRetry resource.
116
+ #
117
+ # @return [Hookdeck::Resources::BulkIgnoredEventsRetry] The BulkIgnoredEventsRetry resource.
118
+ def bulk_ignored_events_retry
119
+ @bulk_ignored_events_retry ||= Hookdeck::Resources::BulkIgnoredEventsRetry.new(self)
120
+ end
121
+
122
+ # Accessor for the BulkEventRetry resource.
123
+ #
124
+ # @return [Hookdeck::Resources::BulkEventRetry] The BulkEventRetry resource.
125
+ def bulk_events_retry
126
+ @bulk_events_retry ||= Hookdeck::Resources::BulkEventRetry.new(self)
127
+ end
128
+
129
+ # Accessor for the BulkRequestsRetry resource.
130
+ #
131
+ # @return [Hookdeck::Resources::BulkRequestsRetry] The BulkRequestsRetry resource.
132
+ def bulk_requests_retry
133
+ @bulk_requests_retry ||= Hookdeck::Resources::BulkRequestsRetry.new(self)
134
+ end
135
+
136
+ private
137
+
138
+ # Builds the configuration for the client.
139
+ #
140
+ # @param api_key [String] The API key.
141
+ # @param options [Hash] The options.
142
+ # @return [Hookdeck::Configuration] The configuration.
143
+ def build_config(api_key, options)
144
+ config = Configuration.new
145
+ config.api_key = api_key || HookDeck.configuration.api_key
146
+ options.each do |key, value|
147
+ config.public_send("#{key}=", value) if config.respond_to?("#{key}=")
148
+ end
149
+ validate_config!(config)
150
+ config
151
+ end
152
+
153
+ # Validates the configuration.
154
+ #
155
+ # @param config [Hookdeck::Configuration] The configuration.
156
+ # @raise [Hookdeck::ValidationError] If the API key is not provided.
157
+ def validate_config!(config)
158
+ raise ValidationError, 'API key must be provided' if config.api_key.nil?
159
+ end
160
+
161
+ # Initializes the resources.
162
+ #
163
+ # Resources are lazy-loaded when accessed
164
+ def initialize_resources
165
+ # Resources are lazy-loaded when accessed
166
+ end
167
+ end
168
+ end