pingram 1.0.7 → 1.0.9

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 (108) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/pingram/api/components_api.rb +2 -0
  4. data/lib/pingram/api/email_api.rb +88 -0
  5. data/lib/pingram/api/numbers_api.rb +4 -4
  6. data/lib/pingram/api/push_settings_api.rb +4 -0
  7. data/lib/pingram/api/sms_api.rb +88 -0
  8. data/lib/pingram/api/templates_api.rb +2 -0
  9. data/lib/pingram/api/types_api.rb +2 -0
  10. data/lib/pingram/api/user_api.rb +4 -0
  11. data/lib/pingram/api/webhooks_api.rb +2 -0
  12. data/lib/pingram/api_client.rb +1 -1
  13. data/lib/pingram/api_error.rb +40 -4
  14. data/lib/pingram/client_wrapper.rb +20 -0
  15. data/lib/pingram/models/api_error_body.rb +223 -0
  16. data/lib/pingram/models/api_error_response.rb +192 -0
  17. data/lib/pingram/models/change_phone_request.rb +164 -0
  18. data/lib/pingram/models/get_logs_response_messages_inner.rb +13 -1
  19. data/lib/pingram/models/get_logs_response_messages_inner_media_inner.rb +173 -0
  20. data/lib/pingram/models/get_templates_list_response_inner.rb +2 -1
  21. data/lib/pingram/models/get_templates_list_response_inner_any_of2.rb +16 -4
  22. data/lib/pingram/models/get_templates_list_response_inner_any_of3.rb +16 -42
  23. data/lib/pingram/models/get_templates_list_response_inner_any_of4.rb +4 -22
  24. data/lib/pingram/models/get_templates_list_response_inner_any_of5.rb +42 -111
  25. data/lib/pingram/models/get_templates_list_response_inner_any_of6.rb +440 -0
  26. data/lib/pingram/models/{get_templates_list_response_inner_any_of5_metadata.rb → get_templates_list_response_inner_any_of6_metadata.rb} +4 -4
  27. data/lib/pingram/models/{get_templates_list_response_inner_any_of5_metadata_entities_inner.rb → get_templates_list_response_inner_any_of6_metadata_entities_inner.rb} +4 -4
  28. data/lib/pingram/models/{get_templates_list_response_inner_any_of5_metadata_entities_inner_external_ref.rb → get_templates_list_response_inner_any_of6_metadata_entities_inner_external_ref.rb} +3 -3
  29. data/lib/pingram/models/logs_get_response_logs_inner.rb +52 -21
  30. data/lib/pingram/models/send_email_api_response.rb +104 -0
  31. data/lib/pingram/models/send_email_api_response_any_of.rb +193 -0
  32. data/lib/pingram/models/send_email_api_response_any_of1.rb +191 -0
  33. data/lib/pingram/models/send_email_api_response_any_of1_error.rb +223 -0
  34. data/lib/pingram/models/send_email_request.rb +335 -0
  35. data/lib/pingram/models/{sender_post_body_options_email_attachments_inner_any_of1.rb → send_email_request_attachments_inner.rb} +19 -28
  36. data/lib/pingram/models/send_sms_request.rb +249 -0
  37. data/lib/pingram/models/send_sms_response.rb +104 -0
  38. data/lib/pingram/models/send_sms_response_any_of.rb +193 -0
  39. data/lib/pingram/models/send_sms_response_any_of1.rb +191 -0
  40. data/lib/pingram/models/send_sms_response_any_of1_error.rb +223 -0
  41. data/lib/pingram/models/sender_post_body_options_email_attachments_inner.rb +2 -2
  42. data/lib/pingram/models/sender_post_body_options_email_attachments_inner_any_of.rb +25 -16
  43. data/lib/pingram/models/sender_post_body_slack.rb +1 -1
  44. data/lib/pingram/models/sender_post_body_sms.rb +16 -4
  45. data/lib/pingram/version.rb +1 -1
  46. data/lib/pingram.rb +21 -4
  47. data/vendor/bundle/ruby/3.2.0/cache/psych-5.4.0.gem +0 -0
  48. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{psych-5.3.1 → psych-5.4.0}/gem_make.out +10 -10
  49. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{psych-5.3.1 → psych-5.4.0}/psych.so +0 -0
  50. data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/README.md +2 -2
  51. data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_parser.c +14 -3
  52. data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/versions.rb +1 -1
  53. data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych.so +0 -0
  54. data/vendor/bundle/ruby/3.2.0/specifications/{psych-5.3.1.gemspec → psych-5.4.0.gemspec} +2 -2
  55. metadata +83 -66
  56. data/vendor/bundle/ruby/3.2.0/cache/psych-5.3.1.gem +0 -0
  57. /data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{psych-5.3.1 → psych-5.4.0}/gem.build_complete +0 -0
  58. /data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{psych-5.3.1 → psych-5.4.0}/mkmf.log +0 -0
  59. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/CONTRIBUTING.md +0 -0
  60. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/LICENSE +0 -0
  61. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/Makefile +0 -0
  62. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/depend +0 -0
  63. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/extconf.rb +0 -0
  64. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych.c +0 -0
  65. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych.h +0 -0
  66. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_emitter.c +0 -0
  67. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_emitter.h +0 -0
  68. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_parser.h +0 -0
  69. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_to_ruby.c +0 -0
  70. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_to_ruby.h +0 -0
  71. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_yaml_tree.c +0 -0
  72. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_yaml_tree.h +0 -0
  73. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/class_loader.rb +0 -0
  74. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/coder.rb +0 -0
  75. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/core_ext.rb +0 -0
  76. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/exception.rb +0 -0
  77. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/handler.rb +0 -0
  78. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/handlers/document_stream.rb +0 -0
  79. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/handlers/recorder.rb +0 -0
  80. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/json/ruby_events.rb +0 -0
  81. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/json/stream.rb +0 -0
  82. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/json/tree_builder.rb +0 -0
  83. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/json/yaml_events.rb +0 -0
  84. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/alias.rb +0 -0
  85. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/document.rb +0 -0
  86. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/mapping.rb +0 -0
  87. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/node.rb +0 -0
  88. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/scalar.rb +0 -0
  89. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/sequence.rb +0 -0
  90. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/stream.rb +0 -0
  91. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes.rb +0 -0
  92. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/omap.rb +0 -0
  93. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/parser.rb +0 -0
  94. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/scalar_scanner.rb +0 -0
  95. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/set.rb +0 -0
  96. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/stream.rb +0 -0
  97. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/streaming.rb +0 -0
  98. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/syntax_error.rb +0 -0
  99. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/tree_builder.rb +0 -0
  100. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/depth_first.rb +0 -0
  101. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/emitter.rb +0 -0
  102. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/json_tree.rb +0 -0
  103. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/to_ruby.rb +0 -0
  104. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/visitor.rb +0 -0
  105. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/yaml_tree.rb +0 -0
  106. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors.rb +0 -0
  107. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/y.rb +0 -0
  108. /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2abf3a6897d1cdfe767b66c5889a9dd10607eb87001dc3637e55e429be76c5f
4
- data.tar.gz: fa86061d2712c5edef7988300309984004e0a37618e6433a213ac52985dbdc38
3
+ metadata.gz: 4d92a9fe59994579dcbcbec394a85c59560372c79ab5d15877ec3ea99839b2ad
4
+ data.tar.gz: 336dd2cd85ca02c0e02f10e4458c677e39222a5b605b93213e9620c04d2757d5
5
5
  SHA512:
6
- metadata.gz: c566371e3c23b72669c6bcace4dd146172c19099d88fe7cbf7d202c863cd08134fc8690c8d7f10d5280ca0eb896aa5878f9f89e0349d7b214b6b2cca9243d3da
7
- data.tar.gz: d77b8904a84992b84011e4380291cd61e066029c925a0ffea96a10e3ff2355a7dc55dc574c676544e5ac807832ad9255dc0dce302d37ffdab486368c902bb45c
6
+ metadata.gz: e04f8ef0c4a9ad04331b0cd121e3777c20873b238b7628edf460ccf46ae5fd851b205da356bfda173b030b7fd40336d50194014c65775c5345d10f687f79ba2a
7
+ data.tar.gz: 9ed3841babe3555369e40d9b8e40f1494225b2fbd14b8f100d70fc0026757ffa37b3c54865d18ea0437b41790621c97150ea20a23e63770f4c16ab44b5f65879
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pingram (1.0.7)
4
+ pingram (1.0.9)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -32,7 +32,7 @@ GEM
32
32
  pry-byebug (3.12.0)
33
33
  byebug (~> 13.0)
34
34
  pry (>= 0.13, < 0.17)
35
- psych (5.3.1)
35
+ psych (5.4.0)
36
36
  date
37
37
  stringio
38
38
  racc (1.8.1)
@@ -114,6 +114,8 @@ module Pingram
114
114
 
115
115
  # header parameters
116
116
  header_params = opts[:header_params] || {}
117
+ # HTTP header 'Accept' (if needed)
118
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
117
119
 
118
120
  # form parameters
119
121
  form_params = opts[:form_params] || {}
@@ -0,0 +1,88 @@
1
+ =begin
2
+ #Pingram
3
+
4
+ #Internal API for notification delivery and management
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Pingram
16
+ class EmailApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Send an email notification directly without templates
23
+ # @param send_email_request [SendEmailRequest]
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [SendEmailApiResponse]
26
+ def email_send(send_email_request, opts = {})
27
+ data, _status_code, _headers = email_send_with_http_info(send_email_request, opts)
28
+ data
29
+ end
30
+
31
+ # Send an email notification directly without templates
32
+ # @param send_email_request [SendEmailRequest]
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(SendEmailApiResponse, Integer, Hash)>] SendEmailApiResponse data, response status code and response headers
35
+ def email_send_with_http_info(send_email_request, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: EmailApi.email_send ...'
38
+ end
39
+ # verify the required parameter 'send_email_request' is set
40
+ if @api_client.config.client_side_validation && send_email_request.nil?
41
+ fail ArgumentError, "Missing the required parameter 'send_email_request' when calling EmailApi.email_send"
42
+ end
43
+ # resource path
44
+ local_var_path = '/email'
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
53
+ # HTTP header 'Content-Type'
54
+ content_type = @api_client.select_header_content_type(['application/json'])
55
+ if !content_type.nil?
56
+ header_params['Content-Type'] = content_type
57
+ end
58
+
59
+ # form parameters
60
+ form_params = opts[:form_params] || {}
61
+
62
+ # http body (model)
63
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(send_email_request)
64
+
65
+ # return_type
66
+ return_type = opts[:debug_return_type] || 'SendEmailApiResponse'
67
+
68
+ # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
69
+ auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']
70
+
71
+ new_options = opts.merge(
72
+ :operation => :"EmailApi.email_send",
73
+ :header_params => header_params,
74
+ :query_params => query_params,
75
+ :form_params => form_params,
76
+ :body => post_body,
77
+ :auth_names => auth_names,
78
+ :return_type => return_type
79
+ )
80
+
81
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
82
+ if @api_client.config.debugging
83
+ @api_client.config.logger.debug "API called: EmailApi#email_send\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
84
+ end
85
+ return data, status_code, headers
86
+ end
87
+ end
88
+ end
@@ -74,7 +74,7 @@ module Pingram
74
74
  return data, status_code, headers
75
75
  end
76
76
 
77
- # Purchase a Telnyx phone number for the authenticated account
77
+ # Purchase a phone number for the authenticated account
78
78
  # @param order_phone_number_request [OrderPhoneNumberRequest]
79
79
  # @param [Hash] opts the optional parameters
80
80
  # @return [OrderPhoneNumberResponse]
@@ -83,7 +83,7 @@ module Pingram
83
83
  data
84
84
  end
85
85
 
86
- # Purchase a Telnyx phone number for the authenticated account
86
+ # Purchase a phone number for the authenticated account
87
87
  # @param order_phone_number_request [OrderPhoneNumberRequest]
88
88
  # @param [Hash] opts the optional parameters
89
89
  # @return [Array<(OrderPhoneNumberResponse, Integer, Hash)>] OrderPhoneNumberResponse data, response status code and response headers
@@ -140,7 +140,7 @@ module Pingram
140
140
  return data, status_code, headers
141
141
  end
142
142
 
143
- # Search for available Telnyx phone numbers
143
+ # Search for available phone numbers
144
144
  # @param country_code [String] ISO 3166-1 alpha-2 country code (e.g., US, CA)
145
145
  # @param [Hash] opts the optional parameters
146
146
  # @option opts [String] :features Comma-separated
@@ -152,7 +152,7 @@ module Pingram
152
152
  data
153
153
  end
154
154
 
155
- # Search for available Telnyx phone numbers
155
+ # Search for available phone numbers
156
156
  # @param country_code [String] ISO 3166-1 alpha-2 country code (e.g., US, CA)
157
157
  # @param [Hash] opts the optional parameters
158
158
  # @option opts [String] :features Comma-separated
@@ -42,6 +42,8 @@ module Pingram
42
42
 
43
43
  # header parameters
44
44
  header_params = opts[:header_params] || {}
45
+ # HTTP header 'Accept' (if needed)
46
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
45
47
 
46
48
  # form parameters
47
49
  form_params = opts[:form_params] || {}
@@ -95,6 +97,8 @@ module Pingram
95
97
 
96
98
  # header parameters
97
99
  header_params = opts[:header_params] || {}
100
+ # HTTP header 'Accept' (if needed)
101
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
98
102
 
99
103
  # form parameters
100
104
  form_params = opts[:form_params] || {}
@@ -0,0 +1,88 @@
1
+ =begin
2
+ #Pingram
3
+
4
+ #Internal API for notification delivery and management
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Pingram
16
+ class SmsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Send an SMS notification directly without templates
23
+ # @param send_sms_request [SendSmsRequest]
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [SendSmsResponse]
26
+ def sms_send(send_sms_request, opts = {})
27
+ data, _status_code, _headers = sms_send_with_http_info(send_sms_request, opts)
28
+ data
29
+ end
30
+
31
+ # Send an SMS notification directly without templates
32
+ # @param send_sms_request [SendSmsRequest]
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(SendSmsResponse, Integer, Hash)>] SendSmsResponse data, response status code and response headers
35
+ def sms_send_with_http_info(send_sms_request, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: SmsApi.sms_send ...'
38
+ end
39
+ # verify the required parameter 'send_sms_request' is set
40
+ if @api_client.config.client_side_validation && send_sms_request.nil?
41
+ fail ArgumentError, "Missing the required parameter 'send_sms_request' when calling SmsApi.sms_send"
42
+ end
43
+ # resource path
44
+ local_var_path = '/sms'
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
53
+ # HTTP header 'Content-Type'
54
+ content_type = @api_client.select_header_content_type(['application/json'])
55
+ if !content_type.nil?
56
+ header_params['Content-Type'] = content_type
57
+ end
58
+
59
+ # form parameters
60
+ form_params = opts[:form_params] || {}
61
+
62
+ # http body (model)
63
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(send_sms_request)
64
+
65
+ # return_type
66
+ return_type = opts[:debug_return_type] || 'SendSmsResponse'
67
+
68
+ # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
69
+ auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']
70
+
71
+ new_options = opts.merge(
72
+ :operation => :"SmsApi.sms_send",
73
+ :header_params => header_params,
74
+ :query_params => query_params,
75
+ :form_params => form_params,
76
+ :body => post_body,
77
+ :auth_names => auth_names,
78
+ :return_type => return_type
79
+ )
80
+
81
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
82
+ if @api_client.config.debugging
83
+ @api_client.config.logger.debug "API called: SmsApi#sms_send\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
84
+ end
85
+ return data, status_code, headers
86
+ end
87
+ end
88
+ end
@@ -138,6 +138,8 @@ module Pingram
138
138
 
139
139
  # header parameters
140
140
  header_params = opts[:header_params] || {}
141
+ # HTTP header 'Accept' (if needed)
142
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
141
143
 
142
144
  # form parameters
143
145
  form_params = opts[:form_params] || {}
@@ -114,6 +114,8 @@ module Pingram
114
114
 
115
115
  # header parameters
116
116
  header_params = opts[:header_params] || {}
117
+ # HTTP header 'Accept' (if needed)
118
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
117
119
 
118
120
  # form parameters
119
121
  form_params = opts[:form_params] || {}
@@ -54,6 +54,8 @@ module Pingram
54
54
 
55
55
  # header parameters
56
56
  header_params = opts[:header_params] || {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
57
59
  # HTTP header 'Content-Type'
58
60
  content_type = @api_client.select_header_content_type(['application/json'])
59
61
  if !content_type.nil?
@@ -173,6 +175,8 @@ module Pingram
173
175
 
174
176
  # header parameters
175
177
  header_params = opts[:header_params] || {}
178
+ # HTTP header 'Accept' (if needed)
179
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
176
180
 
177
181
  # form parameters
178
182
  form_params = opts[:form_params] || {}
@@ -42,6 +42,8 @@ module Pingram
42
42
 
43
43
  # header parameters
44
44
  header_params = opts[:header_params] || {}
45
+ # HTTP header 'Accept' (if needed)
46
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
45
47
 
46
48
  # form parameters
47
49
  form_params = opts[:form_params] || {}
@@ -32,7 +32,7 @@ module Pingram
32
32
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
33
33
  def initialize(config = Configuration.default)
34
34
  @config = config
35
- @user_agent = "pingram-ruby/1.0.7"
35
+ @user_agent = "pingram-ruby/1.0.9"
36
36
  @default_headers = {
37
37
  'Content-Type' => 'application/json',
38
38
  'User-Agent' => @user_agent
@@ -11,9 +11,39 @@ Generator version: 7.19.0
11
11
  =end
12
12
 
13
13
  module Pingram
14
+ require 'json'
14
15
  class ApiError < StandardError
15
16
  attr_reader :code, :response_headers, :response_body
16
17
 
18
+ def self.extract_api_error_detail(payload)
19
+ return nil if payload.nil?
20
+
21
+ raw = payload.is_a?(String) ? payload : payload.to_s
22
+ return nil if raw.strip.empty?
23
+
24
+ begin
25
+ h = JSON.parse(raw)
26
+ rescue JSON::ParserError
27
+ return nil
28
+ end
29
+ return nil unless h.is_a?(Hash)
30
+
31
+ err = h['error'] || h[:error]
32
+ if err.is_a?(Hash)
33
+ m = err['message'] || err[:message]
34
+ return m.to_s if m && !m.to_s.strip.empty?
35
+ end
36
+ m = h['message'] || h[:message]
37
+ return m.to_s if m && !m.to_s.strip.empty?
38
+ msgs = h['messages'] || h[:messages]
39
+ if msgs.is_a?(Array) && !msgs.empty?
40
+ first = msgs[0]
41
+ return first.to_s if first && !first.to_s.strip.empty?
42
+ end
43
+
44
+ nil
45
+ end
46
+
17
47
  # Usage examples:
18
48
  # ApiError.new
19
49
  # ApiError.new("message")
@@ -42,10 +72,16 @@ module Pingram
42
72
  end
43
73
 
44
74
  def message
45
- if @message.nil?
46
- msg = "Error message: the server returns an error"
47
- else
48
- msg = @message
75
+ detail = self.class.extract_api_error_detail(@response_body)
76
+ msg = nil
77
+ msg = detail if detail && !detail.strip.empty?
78
+
79
+ if msg.nil?
80
+ if @message.nil?
81
+ msg = 'Error message: the server returns an error'
82
+ else
83
+ msg = @message.to_s
84
+ end
49
85
  end
50
86
 
51
87
  msg += "\nHTTP status code: #{code}" if code
@@ -19,6 +19,8 @@ require_relative 'api/domains_api'
19
19
 
20
20
  require_relative 'api/editor_api'
21
21
 
22
+ require_relative 'api/email_api'
23
+
22
24
  require_relative 'api/environments_api'
23
25
 
24
26
  require_relative 'api/health_api'
@@ -41,6 +43,8 @@ require_relative 'api/push_settings_api'
41
43
 
42
44
  require_relative 'api/sender_api'
43
45
 
46
+ require_relative 'api/sms_api'
47
+
44
48
  require_relative 'api/templates_api'
45
49
 
46
50
  require_relative 'api/types_api'
@@ -83,6 +87,8 @@ module Pingram
83
87
 
84
88
  @editor = Pingram::EditorApi.new(@api_client)
85
89
 
90
+ @email = Pingram::EmailApi.new(@api_client)
91
+
86
92
  @environments = Pingram::EnvironmentsApi.new(@api_client)
87
93
 
88
94
  @health = Pingram::HealthApi.new(@api_client)
@@ -105,6 +111,8 @@ module Pingram
105
111
 
106
112
  @sender = Pingram::SenderApi.new(@api_client)
107
113
 
114
+ @sms = Pingram::SmsApi.new(@api_client)
115
+
108
116
  @templates = Pingram::TemplatesApi.new(@api_client)
109
117
 
110
118
  @types = Pingram::TypesApi.new(@api_client)
@@ -154,6 +162,12 @@ module Pingram
154
162
  end
155
163
 
156
164
 
165
+ # @return [Pingram::EmailApi]
166
+ def email
167
+ @email
168
+ end
169
+
170
+
157
171
  # @return [Pingram::EnvironmentsApi]
158
172
  def environments
159
173
  @environments
@@ -220,6 +234,12 @@ module Pingram
220
234
  end
221
235
 
222
236
 
237
+ # @return [Pingram::SmsApi]
238
+ def sms
239
+ @sms
240
+ end
241
+
242
+
223
243
  # @return [Pingram::TemplatesApi]
224
244
  def templates
225
245
  @templates
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #Pingram
3
+
4
+ #Internal API for notification delivery and management
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Pingram
17
+ # Structured error details for API error responses.
18
+ class ApiErrorBody < ApiModelBase
19
+ # Machine-readable error code.
20
+ attr_accessor :code
21
+
22
+ # Human-readable error message.
23
+ attr_accessor :message
24
+
25
+ # Actionable hint for fixing the error.
26
+ attr_accessor :fix
27
+
28
+ # Provider that caused the error (e.g. telnyx, ses).
29
+ attr_accessor :provider
30
+
31
+ # Provider-specific error code.
32
+ attr_accessor :provider_code
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'code' => :'code',
38
+ :'message' => :'message',
39
+ :'fix' => :'fix',
40
+ :'provider' => :'provider',
41
+ :'provider_code' => :'providerCode'
42
+ }
43
+ end
44
+
45
+ # Returns attribute mapping this model knows about
46
+ def self.acceptable_attribute_map
47
+ attribute_map
48
+ end
49
+
50
+ # Returns all the JSON keys this model knows about
51
+ def self.acceptable_attributes
52
+ acceptable_attribute_map.values
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ :'code' => :'String',
59
+ :'message' => :'String',
60
+ :'fix' => :'String',
61
+ :'provider' => :'String',
62
+ :'provider_code' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::ApiErrorBody` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ acceptable_attribute_map = self.class.acceptable_attribute_map
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!acceptable_attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::ApiErrorBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'code')
89
+ self.code = attributes[:'code']
90
+ else
91
+ self.code = nil
92
+ end
93
+
94
+ if attributes.key?(:'message')
95
+ self.message = attributes[:'message']
96
+ else
97
+ self.message = nil
98
+ end
99
+
100
+ if attributes.key?(:'fix')
101
+ self.fix = attributes[:'fix']
102
+ end
103
+
104
+ if attributes.key?(:'provider')
105
+ self.provider = attributes[:'provider']
106
+ end
107
+
108
+ if attributes.key?(:'provider_code')
109
+ self.provider_code = attributes[:'provider_code']
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
117
+ invalid_properties = Array.new
118
+ if @code.nil?
119
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
120
+ end
121
+
122
+ if @message.nil?
123
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
124
+ end
125
+
126
+ invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ warn '[DEPRECATED] the `valid?` method is obsolete'
133
+ return false if @code.nil?
134
+ return false if @message.nil?
135
+ true
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] code Value to be assigned
140
+ def code=(code)
141
+ if code.nil?
142
+ fail ArgumentError, 'code cannot be nil'
143
+ end
144
+
145
+ @code = code
146
+ end
147
+
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] message Value to be assigned
150
+ def message=(message)
151
+ if message.nil?
152
+ fail ArgumentError, 'message cannot be nil'
153
+ end
154
+
155
+ @message = message
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ code == o.code &&
164
+ message == o.message &&
165
+ fix == o.fix &&
166
+ provider == o.provider &&
167
+ provider_code == o.provider_code
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Integer] Hash code
178
+ def hash
179
+ [code, message, fix, provider, provider_code].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def self.build_from_hash(attributes)
186
+ return nil unless attributes.is_a?(Hash)
187
+ attributes = attributes.transform_keys(&:to_sym)
188
+ transformed_hash = {}
189
+ openapi_types.each_pair do |key, type|
190
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
191
+ transformed_hash["#{key}"] = nil
192
+ elsif type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[attribute_map[key]].is_a?(Array)
196
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
197
+ end
198
+ elsif !attributes[attribute_map[key]].nil?
199
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
200
+ end
201
+ end
202
+ new(transformed_hash)
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ end
222
+
223
+ end