mailhub-sdk 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.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/.fern/metadata.json +11 -0
  3. data/.fernignore +3 -0
  4. data/.rubocop.yml +103 -0
  5. data/CONTRIBUTING.md +120 -0
  6. data/README.md +159 -0
  7. data/Rakefile +20 -0
  8. data/custom.gemspec.rb +18 -0
  9. data/lib/Mailhub/campaign/client.rb +730 -0
  10. data/lib/Mailhub/campaign/types/add_campaign_media_by_code_request.rb +13 -0
  11. data/lib/Mailhub/campaign/types/cancel_campaign_request.rb +11 -0
  12. data/lib/Mailhub/campaign/types/catch_up_campaign_request.rb +11 -0
  13. data/lib/Mailhub/campaign/types/create_campaign_by_code_request.rb +27 -0
  14. data/lib/Mailhub/campaign/types/delete_campaign_request.rb +11 -0
  15. data/lib/Mailhub/campaign/types/get_campaign_activity_request.rb +11 -0
  16. data/lib/Mailhub/campaign/types/get_campaign_analytics_request.rb +11 -0
  17. data/lib/Mailhub/campaign/types/get_campaign_link_stats_request.rb +11 -0
  18. data/lib/Mailhub/campaign/types/get_campaign_media_request.rb +11 -0
  19. data/lib/Mailhub/campaign/types/get_campaign_rendered_preview_by_code_request.rb +21 -0
  20. data/lib/Mailhub/campaign/types/get_campaign_request.rb +11 -0
  21. data/lib/Mailhub/campaign/types/get_campaigns_request.rb +19 -0
  22. data/lib/Mailhub/campaign/types/pause_campaign_request.rb +11 -0
  23. data/lib/Mailhub/campaign/types/preview_campaign_request.rb +11 -0
  24. data/lib/Mailhub/campaign/types/remove_campaign_media_request.rb +13 -0
  25. data/lib/Mailhub/campaign/types/schedule_campaign_request.rb +11 -0
  26. data/lib/Mailhub/campaign/types/send_campaign_request.rb +11 -0
  27. data/lib/Mailhub/campaign/types/test_campaign_by_code_request.rb +23 -0
  28. data/lib/Mailhub/campaign/types/update_campaign_by_code_request.rb +29 -0
  29. data/lib/Mailhub/client.rb +55 -0
  30. data/lib/Mailhub/contact/client.rb +385 -0
  31. data/lib/Mailhub/contact/types/block_contact_request.rb +11 -0
  32. data/lib/Mailhub/contact/types/block_contacts_by_guid_request.rb +11 -0
  33. data/lib/Mailhub/contact/types/create_contact_request.rb +15 -0
  34. data/lib/Mailhub/contact/types/delete_contact_request.rb +11 -0
  35. data/lib/Mailhub/contact/types/delete_contacts_by_guid_request.rb +11 -0
  36. data/lib/Mailhub/contact/types/get_contact_request.rb +11 -0
  37. data/lib/Mailhub/contact/types/get_contacts_request.rb +21 -0
  38. data/lib/Mailhub/contact/types/get_import_job_request.rb +11 -0
  39. data/lib/Mailhub/contact/types/import_contacts_request.rb +9 -0
  40. data/lib/Mailhub/contact/types/update_contact_request.rb +17 -0
  41. data/lib/Mailhub/custom_field/client.rb +188 -0
  42. data/lib/Mailhub/custom_field/types/create_custom_field_request.rb +15 -0
  43. data/lib/Mailhub/custom_field/types/delete_custom_field_request.rb +11 -0
  44. data/lib/Mailhub/custom_field/types/get_custom_field_request.rb +11 -0
  45. data/lib/Mailhub/custom_field/types/update_custom_field_request.rb +15 -0
  46. data/lib/Mailhub/errors/api_error.rb +8 -0
  47. data/lib/Mailhub/errors/client_error.rb +17 -0
  48. data/lib/Mailhub/errors/redirect_error.rb +8 -0
  49. data/lib/Mailhub/errors/response_error.rb +42 -0
  50. data/lib/Mailhub/errors/server_error.rb +11 -0
  51. data/lib/Mailhub/errors/timeout_error.rb +8 -0
  52. data/lib/Mailhub/internal/errors/constraint_error.rb +10 -0
  53. data/lib/Mailhub/internal/errors/type_error.rb +10 -0
  54. data/lib/Mailhub/internal/http/base_request.rb +51 -0
  55. data/lib/Mailhub/internal/http/raw_client.rb +248 -0
  56. data/lib/Mailhub/internal/iterators/cursor_item_iterator.rb +28 -0
  57. data/lib/Mailhub/internal/iterators/cursor_page_iterator.rb +63 -0
  58. data/lib/Mailhub/internal/iterators/item_iterator.rb +65 -0
  59. data/lib/Mailhub/internal/iterators/offset_item_iterator.rb +30 -0
  60. data/lib/Mailhub/internal/iterators/offset_page_iterator.rb +103 -0
  61. data/lib/Mailhub/internal/json/request.rb +41 -0
  62. data/lib/Mailhub/internal/json/serializable.rb +25 -0
  63. data/lib/Mailhub/internal/multipart/multipart_encoder.rb +141 -0
  64. data/lib/Mailhub/internal/multipart/multipart_form_data.rb +78 -0
  65. data/lib/Mailhub/internal/multipart/multipart_form_data_part.rb +51 -0
  66. data/lib/Mailhub/internal/multipart/multipart_request.rb +40 -0
  67. data/lib/Mailhub/internal/types/array.rb +47 -0
  68. data/lib/Mailhub/internal/types/boolean.rb +34 -0
  69. data/lib/Mailhub/internal/types/enum.rb +56 -0
  70. data/lib/Mailhub/internal/types/hash.rb +36 -0
  71. data/lib/Mailhub/internal/types/model/field.rb +38 -0
  72. data/lib/Mailhub/internal/types/model.rb +208 -0
  73. data/lib/Mailhub/internal/types/type.rb +35 -0
  74. data/lib/Mailhub/internal/types/union.rb +161 -0
  75. data/lib/Mailhub/internal/types/unknown.rb +15 -0
  76. data/lib/Mailhub/internal/types/utils.rb +116 -0
  77. data/lib/Mailhub/media/client.rb +241 -0
  78. data/lib/Mailhub/media/types/delete_media_request.rb +11 -0
  79. data/lib/Mailhub/media/types/download_media_request.rb +11 -0
  80. data/lib/Mailhub/media/types/get_media_request.rb +11 -0
  81. data/lib/Mailhub/media/types/get_medias_request.rb +19 -0
  82. data/lib/Mailhub/media/types/update_media_request.rb +13 -0
  83. data/lib/Mailhub/media/types/upload_media_request.rb +9 -0
  84. data/lib/Mailhub/message/client.rb +201 -0
  85. data/lib/Mailhub/message/types/cancel_message_request.rb +11 -0
  86. data/lib/Mailhub/message/types/get_message_events_request.rb +11 -0
  87. data/lib/Mailhub/message/types/get_message_request.rb +11 -0
  88. data/lib/Mailhub/message/types/get_messages_request.rb +21 -0
  89. data/lib/Mailhub/message/types/send_message_request.rb +23 -0
  90. data/lib/Mailhub/segment/client.rb +377 -0
  91. data/lib/Mailhub/segment/types/create_segment_request.rb +13 -0
  92. data/lib/Mailhub/segment/types/delete_segment_request.rb +11 -0
  93. data/lib/Mailhub/segment/types/delete_segments_by_code_request.rb +13 -0
  94. data/lib/Mailhub/segment/types/get_segment_contacts_request.rb +15 -0
  95. data/lib/Mailhub/segment/types/get_segment_preview_request.rb +11 -0
  96. data/lib/Mailhub/segment/types/get_segment_request.rb +11 -0
  97. data/lib/Mailhub/segment/types/get_segments_request.rb +19 -0
  98. data/lib/Mailhub/segment/types/get_segments_union_preview_by_code_request.rb +11 -0
  99. data/lib/Mailhub/segment/types/sync_segment_request.rb +11 -0
  100. data/lib/Mailhub/segment/types/update_segment_request.rb +15 -0
  101. data/lib/Mailhub/template/client.rb +301 -0
  102. data/lib/Mailhub/template/types/create_template_request.rb +13 -0
  103. data/lib/Mailhub/template/types/delete_template_request.rb +11 -0
  104. data/lib/Mailhub/template/types/get_template_rendered_preview_request.rb +11 -0
  105. data/lib/Mailhub/template/types/get_template_request.rb +11 -0
  106. data/lib/Mailhub/template/types/get_templates_request.rb +19 -0
  107. data/lib/Mailhub/template/types/preview_template_request.rb +11 -0
  108. data/lib/Mailhub/template/types/update_template_request.rb +15 -0
  109. data/lib/Mailhub/types/api_error.rb +16 -0
  110. data/lib/Mailhub/types/api_error_detail.rb +12 -0
  111. data/lib/Mailhub/types/campaign_activity_point_model.rb +18 -0
  112. data/lib/Mailhub/types/campaign_analytics_model.rb +30 -0
  113. data/lib/Mailhub/types/campaign_link_stat_model.rb +14 -0
  114. data/lib/Mailhub/types/campaign_media_model.rb +24 -0
  115. data/lib/Mailhub/types/campaign_model.rb +52 -0
  116. data/lib/Mailhub/types/campaign_model_paged_result.rb +16 -0
  117. data/lib/Mailhub/types/campaign_segment_model.rb +14 -0
  118. data/lib/Mailhub/types/campaign_status.rb +17 -0
  119. data/lib/Mailhub/types/campaign_type.rb +12 -0
  120. data/lib/Mailhub/types/contact_import_job_model.rb +22 -0
  121. data/lib/Mailhub/types/contact_import_model.rb +10 -0
  122. data/lib/Mailhub/types/contact_import_status.rb +14 -0
  123. data/lib/Mailhub/types/contact_model.rb +26 -0
  124. data/lib/Mailhub/types/contact_model_cursor_paged_result.rb +18 -0
  125. data/lib/Mailhub/types/contact_model_paged_result.rb +16 -0
  126. data/lib/Mailhub/types/contact_segment_model.rb +14 -0
  127. data/lib/Mailhub/types/contact_status.rb +13 -0
  128. data/lib/Mailhub/types/custom_field_model.rb +20 -0
  129. data/lib/Mailhub/types/custom_field_type.rb +14 -0
  130. data/lib/Mailhub/types/import_contact_error_model.rb +12 -0
  131. data/lib/Mailhub/types/media_model.rb +28 -0
  132. data/lib/Mailhub/types/media_model_paged_result.rb +16 -0
  133. data/lib/Mailhub/types/message_event_model.rb +16 -0
  134. data/lib/Mailhub/types/message_event_type.rb +18 -0
  135. data/lib/Mailhub/types/message_model.rb +36 -0
  136. data/lib/Mailhub/types/message_model_cursor_paged_result.rb +18 -0
  137. data/lib/Mailhub/types/preview_segment_model.rb +10 -0
  138. data/lib/Mailhub/types/running_campaign_stats_model.rb +32 -0
  139. data/lib/Mailhub/types/segment_filter_group_model.rb +12 -0
  140. data/lib/Mailhub/types/segment_filter_model.rb +10 -0
  141. data/lib/Mailhub/types/segment_filter_rule_model.rb +14 -0
  142. data/lib/Mailhub/types/segment_model.rb +32 -0
  143. data/lib/Mailhub/types/segment_model_paged_result.rb +16 -0
  144. data/lib/Mailhub/types/segment_sync_status.rb +14 -0
  145. data/lib/Mailhub/types/template_expression_model.rb +14 -0
  146. data/lib/Mailhub/types/template_model.rb +20 -0
  147. data/lib/Mailhub/types/template_model_paged_result.rb +16 -0
  148. data/lib/Mailhub/version.rb +5 -0
  149. data/lib/Mailhub.rb +145 -0
  150. data/reference.md +3691 -0
  151. metadata +193 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b21e330f891b44fa8e5b42dd525b52bae2f90b76babcb8df404f49a2a1fad4d1
4
+ data.tar.gz: 5c6337f7f5d8b0c1cd1f644972fee7f71623a36e278abd9375afb7d88449183b
5
+ SHA512:
6
+ metadata.gz: c02cb70cf5ec17155cfe66045bd60e3411de81052d875b77cc6e23465cea3b81ecc7310e7b402ed5e5fac258c088a5f2d50b18960ae7365d6ef377d4c1ec879e
7
+ data.tar.gz: b73cc630facac6079310b376f544194d1b2bc6388ad4c6d3088698c405bfab5e9c6760bc26f5a579243e5f2b26f95f02e00352645bd33470be6206b4e425e645
@@ -0,0 +1,11 @@
1
+ {
2
+ "cliVersion": "5.80.2",
3
+ "generatorName": "fernapi/fern-ruby-sdk",
4
+ "generatorVersion": "latest",
5
+ "generatorConfig": {
6
+ "omitFernHeaders": true,
7
+ "moduleName": "Mailhub",
8
+ "clientModuleName": "MailhubClient"
9
+ },
10
+ "originGitCommit": "2944d1cf51878a31601d93fb582bd2343c331b45"
11
+ }
data/.fernignore ADDED
@@ -0,0 +1,3 @@
1
+ # custom.gemspec.rb에 배포명(spec.name)/homepage/license를 직접 넣어뒀는데,
2
+ # 재생성(--force) 시 이 디렉토리를 통째로 비우기 때문에 보호해야 한다.
3
+ custom.gemspec.rb
data/.rubocop.yml ADDED
@@ -0,0 +1,103 @@
1
+ plugins:
2
+ - rubocop-minitest
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 3.3
6
+ NewCops: enable
7
+
8
+ Style/StringLiterals:
9
+ EnforcedStyle: double_quotes
10
+
11
+ Style/StringLiteralsInInterpolation:
12
+ EnforcedStyle: double_quotes
13
+
14
+ Style/AccessModifierDeclarations:
15
+ Enabled: false
16
+
17
+ Lint/ConstantDefinitionInBlock:
18
+ Enabled: false
19
+
20
+ Metrics/AbcSize:
21
+ Enabled: false
22
+
23
+ Metrics/BlockLength:
24
+ Enabled: false
25
+
26
+ Metrics/ClassLength:
27
+ Enabled: false
28
+
29
+ Metrics/MethodLength:
30
+ Enabled: false
31
+
32
+ Metrics/ParameterLists:
33
+ Enabled: false
34
+
35
+ Metrics/PerceivedComplexity:
36
+ Enabled: false
37
+
38
+ Metrics/CyclomaticComplexity:
39
+ Enabled: false
40
+
41
+ Metrics/ModuleLength:
42
+ Enabled: false
43
+
44
+ Layout/LineLength:
45
+ Enabled: false
46
+
47
+ Naming/VariableNumber:
48
+ EnforcedStyle: normalcase
49
+ Severity: warning
50
+
51
+ Style/Documentation:
52
+ Enabled: false
53
+
54
+ Style/Lambda:
55
+ EnforcedStyle: literal
56
+
57
+ Minitest/MultipleAssertions:
58
+ Enabled: false
59
+
60
+ Minitest/UselessAssertion:
61
+ Enabled: false
62
+
63
+ # Dynamic snippets are code samples for documentation, not standalone Ruby files.
64
+ Style/FrozenStringLiteralComment:
65
+ Exclude:
66
+ - "dynamic-snippets/**/*"
67
+
68
+ # Indent hash elements 2 spaces from the start of the enclosing line rather than
69
+ # aligning with the preceding paren or bracket. Generated code nests hashes inside
70
+ # arrays and method calls; the "consistent" style is more readable there.
71
+ Layout/FirstHashElementIndentation:
72
+ EnforcedStyle: consistent
73
+ Exclude:
74
+ - "dynamic-snippets/**/*"
75
+
76
+ # Match Layout/FirstHashElementIndentation: indent the first argument 2 spaces
77
+ # from the start of the method call's line, regardless of parenthesis position.
78
+ # Dynamic snippets are code samples, not standalone Ruby files; exclude them to
79
+ # keep this config symmetric with Layout/FirstHashElementIndentation above.
80
+ Layout/FirstArgumentIndentation:
81
+ EnforcedStyle: consistent
82
+ Exclude:
83
+ - "dynamic-snippets/**/*"
84
+
85
+ # The generator emits non-idiomatic class names (e.g. Get_With_Query, JSON_)
86
+ # derived from IR type names whose wire form contains underscores or digits.
87
+ # Rubocop never auto-corrected these (naming cops have no autocorrecter), so
88
+ # disabling the cop keeps CI green without changing customer output. Fixing at
89
+ # source would rename public types across every existing SDK and therefore
90
+ # requires a ruby-v2 major-version bump with a generator migration.
91
+ Naming/ClassAndModuleCamelCase:
92
+ Enabled: false
93
+
94
+ # Integer literals are emitted unformatted (e.g. 1000000, not 1_000_000).
95
+ # Rubocop has an autocorrecter for this cop, but the only caller of integer
96
+ # emission is the dynamic-snippets path, which feeds customer-facing surfaces:
97
+ # (1) snippet markdown in reference docs, (2) dynamic-snippets/*.rb sample
98
+ # files. Neither is rubocop-gated (markdown isn't Ruby, dynamic-snippets/**/*
99
+ # is excluded above), so formatting integers there would change docs/dashboard
100
+ # output without any rubocop benefit. Disabling the cop keeps integers raw
101
+ # everywhere and avoids customer-visible diffs.
102
+ Style/NumericLiterals:
103
+ Enabled: false
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,120 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project.
4
+
5
+ ## Getting Started
6
+
7
+ ### Prerequisites
8
+
9
+ - Ruby 3.0+
10
+ - Bundler
11
+
12
+ ### Installation
13
+
14
+ Install the project dependencies:
15
+
16
+ ```bash
17
+ bundle install
18
+ ```
19
+
20
+ ### Building
21
+
22
+ Build the gem:
23
+
24
+ ```bash
25
+ gem build *.gemspec
26
+ ```
27
+
28
+ ### Testing
29
+
30
+ Run the test suite:
31
+
32
+ ```bash
33
+ bundle exec rspec
34
+ ```
35
+
36
+ ### Linting and Formatting
37
+
38
+ Check code style:
39
+
40
+ ```bash
41
+ bundle exec rubocop
42
+ ```
43
+
44
+ Fix code style issues:
45
+
46
+ ```bash
47
+ bundle exec rubocop -a
48
+ ```
49
+
50
+ ## About Generated Code
51
+
52
+ **Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated.
53
+
54
+ ### Generated Files
55
+
56
+ The following directories contain generated code:
57
+ - `lib/` - API client classes and types
58
+ - Most Ruby files in the project
59
+
60
+ ### How to Customize
61
+
62
+ If you need to customize the SDK, you have two options:
63
+
64
+ #### Option 1: Use `.fernignore`
65
+
66
+ For custom code that should persist across SDK regenerations:
67
+
68
+ 1. Create a `.fernignore` file in the project root
69
+ 2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax)
70
+ 3. Add your custom code to those files
71
+
72
+ Files listed in `.fernignore` will not be overwritten when the SDK is regenerated.
73
+
74
+ For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code).
75
+
76
+ #### Option 2: Contribute to the Generator
77
+
78
+ If you want to change how code is generated for all users of this SDK:
79
+
80
+ 1. The Ruby SDK generator lives in the [Fern repository](https://github.com/fern-api/fern)
81
+ 2. Generator code is located at `generators/ruby-v2/`
82
+ 3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md)
83
+ 4. Submit a pull request with your changes to the generator
84
+
85
+ This approach is best for:
86
+ - Bug fixes in generated code
87
+ - New features that would benefit all users
88
+ - Improvements to code generation patterns
89
+
90
+ ## Making Changes
91
+
92
+ ### Workflow
93
+
94
+ 1. Create a new branch for your changes
95
+ 2. Make your modifications
96
+ 3. Run tests to ensure nothing breaks: `bundle exec rspec`
97
+ 4. Run linting: `bundle exec rubocop`
98
+ 5. Build the gem: `gem build *.gemspec`
99
+ 6. Commit your changes with a clear commit message
100
+ 7. Push your branch and create a pull request
101
+
102
+ ### Commit Messages
103
+
104
+ Write clear, descriptive commit messages that explain what changed and why.
105
+
106
+ ### Code Style
107
+
108
+ This project uses RuboCop for code formatting. Run `bundle exec rubocop` before committing to ensure your code meets the project's style guidelines.
109
+
110
+ ## Questions or Issues?
111
+
112
+ If you have questions or run into issues:
113
+
114
+ 1. Check the [Fern documentation](https://buildwithfern.com)
115
+ 2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues)
116
+ 3. Open a new issue if your question hasn't been addressed
117
+
118
+ ## License
119
+
120
+ By contributing to this project, you agree that your contributions will be licensed under the same license as the project.
data/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # Mailhub Ruby Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Mailhub%2FRuby)
4
+
5
+ The Mailhub Ruby library provides convenient access to the Mailhub APIs from Ruby.
6
+
7
+ ## Table of Contents
8
+
9
+ - [Reference](#reference)
10
+ - [Usage](#usage)
11
+ - [Environments](#environments)
12
+ - [Errors](#errors)
13
+ - [Advanced](#advanced)
14
+ - [Retries](#retries)
15
+ - [Timeouts](#timeouts)
16
+ - [Additional Headers](#additional-headers)
17
+ - [Additional Query Parameters](#additional-query-parameters)
18
+ - [Contributing](#contributing)
19
+
20
+ ## Reference
21
+
22
+ A full reference for this library is available [here](./reference.md).
23
+
24
+ ## Usage
25
+
26
+ Instantiate and use the client with the following:
27
+
28
+ ```ruby
29
+ require "mailhub"
30
+
31
+ client = Mailhub::MailhubClient.new(api_key: "<value>")
32
+
33
+ client.campaign.create_campaign
34
+ ```
35
+
36
+ ## Environments
37
+
38
+ This SDK allows you to configure different custom URLs for API requests. You can specify your own custom URL.
39
+
40
+ ### Custom URL
41
+ ```ruby
42
+ require "Mailhub"
43
+
44
+ client = Mailhub::MailhubClient.new(
45
+ base_url: "https://example.com"
46
+ )
47
+ ```
48
+
49
+ ## Errors
50
+
51
+ Failed API calls will raise errors that can be rescued from granularly.
52
+
53
+ ```ruby
54
+ require "Mailhub"
55
+
56
+ client = Mailhub::MailhubClient.new(
57
+ base_url: "https://example.com"
58
+ )
59
+
60
+ begin
61
+ result = client.campaign.create_campaign
62
+ rescue Mailhub::Errors::TimeoutError
63
+ puts "API didn't respond before our timeout elapsed"
64
+ rescue Mailhub::Errors::ServiceUnavailableError
65
+ puts "API returned status 503, is probably overloaded, try again later"
66
+ rescue Mailhub::Errors::ServerError
67
+ puts "API returned some other 5xx status, this is probably a bug"
68
+ rescue Mailhub::Errors::ResponseError => e
69
+ puts "API returned an unexpected status other than 5xx: #{e.code} #{e.message}"
70
+ rescue Mailhub::Errors::ApiError => e
71
+ puts "Some other error occurred when calling the API: #{e.message}"
72
+ end
73
+ ```
74
+
75
+ ## Advanced
76
+
77
+ ### Retries
78
+
79
+ The SDK is instrumented with automatic retries. A request will be retried as long as the request is deemed
80
+ retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
81
+
82
+ A request is deemed retryable when any of the following HTTP status codes is returned:
83
+
84
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
85
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
86
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (Internal Server Error)
87
+
88
+ The `retryStatusCodes` configuration controls which [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) status codes are retried:
89
+
90
+ - `legacy` (default): Retries `408`, `429`, `500`, `502`, `503`, `504`, `521`, `522`, `524`
91
+ - `recommended`: Retries `408`, `429`, `502`, `503`, `504` only (excludes `500 Internal Server Error` to avoid retrying non-idempotent failures)
92
+
93
+ Use the `max_retries` option to configure this behavior.
94
+
95
+ ```ruby
96
+ require "Mailhub"
97
+
98
+ client = Mailhub::MailhubClient.new(
99
+ base_url: "https://example.com",
100
+ max_retries: 3 # Configure max retries (default is 2)
101
+ )
102
+ ```
103
+
104
+ ### Timeouts
105
+
106
+ The SDK defaults to a 60 second timeout. Use the `timeout` option to configure this behavior.
107
+
108
+ ```ruby
109
+ require "Mailhub"
110
+
111
+ response = client.campaign.create_campaign(
112
+ ...,
113
+ timeout: 30 # 30 second timeout
114
+ )
115
+ ```
116
+
117
+ ### Additional Headers
118
+
119
+ If you would like to send additional headers as part of the request, use the `additional_headers` request option.
120
+
121
+ ```ruby
122
+ require "Mailhub"
123
+
124
+ response = client.campaign.create_campaign(
125
+ ...,
126
+ request_options: {
127
+ additional_headers: {
128
+ "X-Custom-Header" => "custom-value"
129
+ }
130
+ }
131
+ )
132
+ ```
133
+
134
+ ### Additional Query Parameters
135
+
136
+ If you would like to send additional query parameters as part of the request, use the `additional_query_parameters` request option.
137
+
138
+ ```ruby
139
+ require "Mailhub"
140
+
141
+ response = client.campaign.create_campaign(
142
+ ...,
143
+ request_options: {
144
+ additional_query_parameters: {
145
+ "custom_param" => "custom-value"
146
+ }
147
+ }
148
+ )
149
+ ```
150
+
151
+ ## Contributing
152
+
153
+ While we value open-source contributions to this SDK, this library is generated programmatically.
154
+ Additions made directly to this library would have to be moved over to our generation code,
155
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
156
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
157
+ an issue first to discuss with us!
158
+
159
+ On the other hand, contributions to the README are always very welcome!
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[test]
13
+
14
+ task lint: %i[rubocop]
15
+
16
+ # Run only the custom test file
17
+ Minitest::TestTask.create(:customtest) do |t|
18
+ t.libs << "test"
19
+ t.test_globs = ["test/custom.test.rb"]
20
+ end
data/custom.gemspec.rb ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Custom gemspec configuration file
4
+ # This file is automatically loaded by the main gemspec file. The 'spec' variable is available
5
+ # in this context from the main gemspec file. You can modify this file to add custom metadata,
6
+ # dependencies, or other gemspec configurations. If you do make changes to this file, you will
7
+ # need to add it to the .fernignore file to prevent your changes from being overwritten.
8
+
9
+ def add_custom_gemspec_data(spec)
10
+ # "mailhub"(소문자)은 이미 무관한 제3자(Alan Fan, 2016, "Send mail through multiple
11
+ # vendors")가 선점하고 있고, RubyGems는 이름을 대소문자 구분 없이 유일성 검사하므로
12
+ # Fern 기본값인 "Mailhub"도 그 이름과 충돌해서 push가 거부된다(PyPI의 mailhub-sdk
13
+ # 이름 충돌과 같은 상황). 배포명만 바꾸고 실제 require/모듈명(Mailhub::MailhubClient)은
14
+ # moduleName 설정 그대로 유지된다.
15
+ spec.name = "mailhub-sdk"
16
+ spec.homepage = "https://mailhub.co.kr"
17
+ spec.license = "MIT"
18
+ end