zyphr 0.1.19 → 0.1.21

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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +47 -6
  3. data/docs/AuthEmailTemplate.md +42 -0
  4. data/docs/AuthEmailTemplateDefault.md +26 -0
  5. data/docs/AuthEmailTemplateDefaultResponse.md +20 -0
  6. data/docs/AuthEmailTemplateDeleteResponse.md +20 -0
  7. data/docs/{SuccessResultData.md → AuthEmailTemplateDeleteResponseData.md} +2 -2
  8. data/docs/AuthEmailTemplateListResponse.md +20 -0
  9. data/docs/AuthEmailTemplatePreviewDraft.md +28 -0
  10. data/docs/AuthEmailTemplatePreviewRequest.md +20 -0
  11. data/docs/AuthEmailTemplatePreviewResponse.md +20 -0
  12. data/docs/AuthEmailTemplatePreviewResult.md +26 -0
  13. data/docs/AuthEmailTemplateResponse.md +20 -0
  14. data/docs/AuthEmailTemplateTestRequest.md +20 -0
  15. data/docs/AuthEmailTemplateTestResponse.md +20 -0
  16. data/docs/AuthEmailTemplateTestResult.md +20 -0
  17. data/docs/AuthEmailTemplateVersion.md +38 -0
  18. data/docs/AuthEmailTemplateVersionsResponse.md +20 -0
  19. data/docs/AuthEmailTemplatesApi.md +782 -0
  20. data/docs/AuthEmailType.md +15 -0
  21. data/docs/BulkUpsertAuthEmailTemplatesRequest.md +22 -0
  22. data/docs/BulkUpsertAuthEmailTemplatesResponse.md +20 -0
  23. data/docs/ResubscribeResponse.md +1 -1
  24. data/docs/SendSlackMessageRequest.md +40 -0
  25. data/docs/SendSlackMessageResponse.md +20 -0
  26. data/docs/SendSlackMessageResult.md +28 -0
  27. data/docs/SlackApi.md +233 -0
  28. data/docs/SlackMessage.md +50 -0
  29. data/docs/SlackMessageListResponse.md +20 -0
  30. data/docs/SlackMessageListResponseMeta.md +24 -0
  31. data/docs/SlackMessageResponse.md +20 -0
  32. data/docs/SlackMessageStatus.md +15 -0
  33. data/docs/SlackMessageSummary.md +38 -0
  34. data/docs/SuccessResult.md +1 -1
  35. data/docs/UpsertAuthEmailTemplateRequest.md +34 -0
  36. data/lib/zyphr/api/auth_email_templates_api.rb +688 -0
  37. data/lib/zyphr/api/slack_api.rb +233 -0
  38. data/lib/zyphr/models/auth_email_template.rb +372 -0
  39. data/lib/zyphr/models/auth_email_template_default.rb +281 -0
  40. data/lib/zyphr/models/auth_email_template_default_response.rb +229 -0
  41. data/lib/zyphr/models/auth_email_template_delete_response.rb +229 -0
  42. data/lib/zyphr/models/{success_result_data.rb → auth_email_template_delete_response_data.rb} +3 -3
  43. data/lib/zyphr/models/auth_email_template_list_response.rb +231 -0
  44. data/lib/zyphr/models/auth_email_template_preview_draft.rb +272 -0
  45. data/lib/zyphr/models/auth_email_template_preview_request.rb +232 -0
  46. data/lib/zyphr/models/auth_email_template_preview_response.rb +229 -0
  47. data/lib/zyphr/models/auth_email_template_preview_result.rb +258 -0
  48. data/lib/zyphr/models/auth_email_template_response.rb +229 -0
  49. data/lib/zyphr/models/auth_email_template_test_request.rb +249 -0
  50. data/lib/zyphr/models/auth_email_template_test_response.rb +229 -0
  51. data/lib/zyphr/models/auth_email_template_test_result.rb +229 -0
  52. data/lib/zyphr/models/auth_email_template_version.rb +352 -0
  53. data/lib/zyphr/models/auth_email_template_versions_response.rb +231 -0
  54. data/lib/zyphr/models/auth_email_type.rb +41 -0
  55. data/lib/zyphr/models/bulk_upsert_auth_email_templates_request.rb +239 -0
  56. data/lib/zyphr/models/bulk_upsert_auth_email_templates_response.rb +231 -0
  57. data/lib/zyphr/models/resubscribe_response.rb +1 -1
  58. data/lib/zyphr/models/send_slack_message_request.rb +340 -0
  59. data/lib/zyphr/models/send_slack_message_response.rb +229 -0
  60. data/lib/zyphr/models/send_slack_message_result.rb +289 -0
  61. data/lib/zyphr/models/slack_message.rb +406 -0
  62. data/lib/zyphr/models/slack_message_list_response.rb +231 -0
  63. data/lib/zyphr/models/slack_message_list_response_meta.rb +254 -0
  64. data/lib/zyphr/models/slack_message_response.rb +229 -0
  65. data/lib/zyphr/models/slack_message_status.rb +43 -0
  66. data/lib/zyphr/models/slack_message_summary.rb +340 -0
  67. data/lib/zyphr/models/success_result.rb +1 -1
  68. data/lib/zyphr/models/upsert_auth_email_template_request.rb +335 -0
  69. data/lib/zyphr.rb +31 -1
  70. data/spec/api/auth_email_templates_api_spec.rb +157 -0
  71. data/spec/api/slack_api_spec.rb +75 -0
  72. data/spec/models/auth_email_template_default_response_spec.rb +42 -0
  73. data/spec/models/auth_email_template_default_spec.rb +60 -0
  74. data/spec/models/{success_result_data_spec.rb → auth_email_template_delete_response_data_spec.rb} +6 -6
  75. data/spec/models/auth_email_template_delete_response_spec.rb +42 -0
  76. data/spec/models/auth_email_template_list_response_spec.rb +42 -0
  77. data/spec/models/auth_email_template_preview_draft_spec.rb +66 -0
  78. data/spec/models/auth_email_template_preview_request_spec.rb +42 -0
  79. data/spec/models/auth_email_template_preview_response_spec.rb +42 -0
  80. data/spec/models/auth_email_template_preview_result_spec.rb +60 -0
  81. data/spec/models/auth_email_template_response_spec.rb +42 -0
  82. data/spec/models/auth_email_template_spec.rb +112 -0
  83. data/spec/models/auth_email_template_test_request_spec.rb +42 -0
  84. data/spec/models/auth_email_template_test_response_spec.rb +42 -0
  85. data/spec/models/auth_email_template_test_result_spec.rb +42 -0
  86. data/spec/models/auth_email_template_version_spec.rb +100 -0
  87. data/spec/models/auth_email_template_versions_response_spec.rb +42 -0
  88. data/spec/models/auth_email_type_spec.rb +30 -0
  89. data/spec/models/bulk_upsert_auth_email_templates_request_spec.rb +48 -0
  90. data/spec/models/bulk_upsert_auth_email_templates_response_spec.rb +42 -0
  91. data/spec/models/send_slack_message_request_spec.rb +102 -0
  92. data/spec/models/send_slack_message_response_spec.rb +42 -0
  93. data/spec/models/send_slack_message_result_spec.rb +66 -0
  94. data/spec/models/slack_message_list_response_meta_spec.rb +54 -0
  95. data/spec/models/slack_message_list_response_spec.rb +42 -0
  96. data/spec/models/slack_message_response_spec.rb +42 -0
  97. data/spec/models/slack_message_spec.rb +132 -0
  98. data/spec/models/slack_message_status_spec.rb +30 -0
  99. data/spec/models/slack_message_summary_spec.rb +96 -0
  100. data/spec/models/upsert_auth_email_template_request_spec.rb +88 -0
  101. data/zyphr.gemspec +1 -1
  102. metadata +126 -6
@@ -0,0 +1,231 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ class BulkUpsertAuthEmailTemplatesResponse
18
+ attr_accessor :data
19
+
20
+ attr_accessor :meta
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'data' => :'data',
26
+ :'meta' => :'meta'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'data' => :'Hash<String, AuthEmailTemplate>',
44
+ :'meta' => :'RequestMeta'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::BulkUpsertAuthEmailTemplatesResponse` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::BulkUpsertAuthEmailTemplatesResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'data')
71
+ if (value = attributes[:'data']).is_a?(Hash)
72
+ self.data = value
73
+ end
74
+ end
75
+
76
+ if attributes.key?(:'meta')
77
+ self.meta = attributes[:'meta']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ data == o.data &&
102
+ meta == o.meta
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [data, meta].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ transformed_hash = {}
124
+ openapi_types.each_pair do |key, type|
125
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = nil
127
+ elsif type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[attribute_map[key]].is_a?(Array)
131
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
+ end
133
+ elsif !attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
+ end
136
+ end
137
+ new(transformed_hash)
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def self._deserialize(type, value)
145
+ case type.to_sym
146
+ when :Time
147
+ Time.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ # models (e.g. Pet) or oneOf
178
+ klass = Zyphr.const_get(type)
179
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+
229
+ end
230
+
231
+ end
@@ -40,7 +40,7 @@ module Zyphr
40
40
  # Attribute type mapping.
41
41
  def self.openapi_types
42
42
  {
43
- :'data' => :'SuccessResultData',
43
+ :'data' => :'AuthEmailTemplateDeleteResponseData',
44
44
  :'meta' => :'RequestMeta'
45
45
  }
46
46
  end
@@ -0,0 +1,340 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zyphr
17
+ # Either `text` or `blocks` must be provided. If `connection_id` is omitted, the project's default Slack connection is used. If `channel` is omitted, the connection's default channel is used.
18
+ class SendSlackMessageRequest
19
+ # ID of the Slack connection to send through. Defaults to the project's active connection.
20
+ attr_accessor :connection_id
21
+
22
+ # Slack channel ID (e.g. `C0123456789`). Falls back to the connection's default channel.
23
+ attr_accessor :channel
24
+
25
+ # Message text. Supports Slack markdown when `mrkdwn` is true.
26
+ attr_accessor :text
27
+
28
+ # Slack Block Kit blocks for rich formatting.
29
+ attr_accessor :blocks
30
+
31
+ # Slack message attachments (legacy formatting).
32
+ attr_accessor :attachments
33
+
34
+ # Thread timestamp to reply in a thread.
35
+ attr_accessor :thread_ts
36
+
37
+ # Also post thread replies to the channel.
38
+ attr_accessor :reply_broadcast
39
+
40
+ # Enable link previews.
41
+ attr_accessor :unfurl_links
42
+
43
+ # Enable media previews.
44
+ attr_accessor :unfurl_media
45
+
46
+ # Enable Slack markdown processing.
47
+ attr_accessor :mrkdwn
48
+
49
+ # Custom metadata to attach to the message.
50
+ attr_accessor :metadata
51
+
52
+ # Tags for message categorisation.
53
+ attr_accessor :tags
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'connection_id' => :'connection_id',
59
+ :'channel' => :'channel',
60
+ :'text' => :'text',
61
+ :'blocks' => :'blocks',
62
+ :'attachments' => :'attachments',
63
+ :'thread_ts' => :'thread_ts',
64
+ :'reply_broadcast' => :'reply_broadcast',
65
+ :'unfurl_links' => :'unfurl_links',
66
+ :'unfurl_media' => :'unfurl_media',
67
+ :'mrkdwn' => :'mrkdwn',
68
+ :'metadata' => :'metadata',
69
+ :'tags' => :'tags'
70
+ }
71
+ end
72
+
73
+ # Returns attribute mapping this model knows about
74
+ def self.acceptable_attribute_map
75
+ attribute_map
76
+ end
77
+
78
+ # Returns all the JSON keys this model knows about
79
+ def self.acceptable_attributes
80
+ acceptable_attribute_map.values
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'connection_id' => :'String',
87
+ :'channel' => :'String',
88
+ :'text' => :'String',
89
+ :'blocks' => :'Array<Hash<String, Object>>',
90
+ :'attachments' => :'Array<Hash<String, Object>>',
91
+ :'thread_ts' => :'String',
92
+ :'reply_broadcast' => :'Boolean',
93
+ :'unfurl_links' => :'Boolean',
94
+ :'unfurl_media' => :'Boolean',
95
+ :'mrkdwn' => :'Boolean',
96
+ :'metadata' => :'Hash<String, Object>',
97
+ :'tags' => :'Array<String>'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::SendSlackMessageRequest` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ acceptable_attribute_map = self.class.acceptable_attribute_map
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!acceptable_attribute_map.key?(k.to_sym))
118
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::SendSlackMessageRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:'connection_id')
124
+ self.connection_id = attributes[:'connection_id']
125
+ end
126
+
127
+ if attributes.key?(:'channel')
128
+ self.channel = attributes[:'channel']
129
+ end
130
+
131
+ if attributes.key?(:'text')
132
+ self.text = attributes[:'text']
133
+ end
134
+
135
+ if attributes.key?(:'blocks')
136
+ if (value = attributes[:'blocks']).is_a?(Array)
137
+ self.blocks = value
138
+ end
139
+ end
140
+
141
+ if attributes.key?(:'attachments')
142
+ if (value = attributes[:'attachments']).is_a?(Array)
143
+ self.attachments = value
144
+ end
145
+ end
146
+
147
+ if attributes.key?(:'thread_ts')
148
+ self.thread_ts = attributes[:'thread_ts']
149
+ end
150
+
151
+ if attributes.key?(:'reply_broadcast')
152
+ self.reply_broadcast = attributes[:'reply_broadcast']
153
+ end
154
+
155
+ if attributes.key?(:'unfurl_links')
156
+ self.unfurl_links = attributes[:'unfurl_links']
157
+ end
158
+
159
+ if attributes.key?(:'unfurl_media')
160
+ self.unfurl_media = attributes[:'unfurl_media']
161
+ end
162
+
163
+ if attributes.key?(:'mrkdwn')
164
+ self.mrkdwn = attributes[:'mrkdwn']
165
+ end
166
+
167
+ if attributes.key?(:'metadata')
168
+ if (value = attributes[:'metadata']).is_a?(Hash)
169
+ self.metadata = value
170
+ end
171
+ end
172
+
173
+ if attributes.key?(:'tags')
174
+ if (value = attributes[:'tags']).is_a?(Array)
175
+ self.tags = value
176
+ end
177
+ end
178
+ end
179
+
180
+ # Show invalid properties with the reasons. Usually used together with valid?
181
+ # @return Array for valid properties with the reasons
182
+ def list_invalid_properties
183
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
184
+ invalid_properties = Array.new
185
+ invalid_properties
186
+ end
187
+
188
+ # Check to see if the all the properties in the model are valid
189
+ # @return true if the model is valid
190
+ def valid?
191
+ warn '[DEPRECATED] the `valid?` method is obsolete'
192
+ true
193
+ end
194
+
195
+ # Checks equality by comparing each attribute.
196
+ # @param [Object] Object to be compared
197
+ def ==(o)
198
+ return true if self.equal?(o)
199
+ self.class == o.class &&
200
+ connection_id == o.connection_id &&
201
+ channel == o.channel &&
202
+ text == o.text &&
203
+ blocks == o.blocks &&
204
+ attachments == o.attachments &&
205
+ thread_ts == o.thread_ts &&
206
+ reply_broadcast == o.reply_broadcast &&
207
+ unfurl_links == o.unfurl_links &&
208
+ unfurl_media == o.unfurl_media &&
209
+ mrkdwn == o.mrkdwn &&
210
+ metadata == o.metadata &&
211
+ tags == o.tags
212
+ end
213
+
214
+ # @see the `==` method
215
+ # @param [Object] Object to be compared
216
+ def eql?(o)
217
+ self == o
218
+ end
219
+
220
+ # Calculates hash code according to all attributes.
221
+ # @return [Integer] Hash code
222
+ def hash
223
+ [connection_id, channel, text, blocks, attachments, thread_ts, reply_broadcast, unfurl_links, unfurl_media, mrkdwn, metadata, tags].hash
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def self.build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ attributes = attributes.transform_keys(&:to_sym)
232
+ transformed_hash = {}
233
+ openapi_types.each_pair do |key, type|
234
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
235
+ transformed_hash["#{key}"] = nil
236
+ elsif type =~ /\AArray<(.*)>/i
237
+ # check to ensure the input is an array given that the attribute
238
+ # is documented as an array but the input is not
239
+ if attributes[attribute_map[key]].is_a?(Array)
240
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
241
+ end
242
+ elsif !attributes[attribute_map[key]].nil?
243
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
244
+ end
245
+ end
246
+ new(transformed_hash)
247
+ end
248
+
249
+ # Deserializes the data based on type
250
+ # @param string type Data type
251
+ # @param string value Value to be deserialized
252
+ # @return [Object] Deserialized data
253
+ def self._deserialize(type, value)
254
+ case type.to_sym
255
+ when :Time
256
+ Time.parse(value)
257
+ when :Date
258
+ Date.parse(value)
259
+ when :String
260
+ value.to_s
261
+ when :Integer
262
+ value.to_i
263
+ when :Float
264
+ value.to_f
265
+ when :Boolean
266
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
267
+ true
268
+ else
269
+ false
270
+ end
271
+ when :Object
272
+ # generic object (usually a Hash), return directly
273
+ value
274
+ when /\AArray<(?<inner_type>.+)>\z/
275
+ inner_type = Regexp.last_match[:inner_type]
276
+ value.map { |v| _deserialize(inner_type, v) }
277
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
278
+ k_type = Regexp.last_match[:k_type]
279
+ v_type = Regexp.last_match[:v_type]
280
+ {}.tap do |hash|
281
+ value.each do |k, v|
282
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
283
+ end
284
+ end
285
+ else # model
286
+ # models (e.g. Pet) or oneOf
287
+ klass = Zyphr.const_get(type)
288
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
289
+ end
290
+ end
291
+
292
+ # Returns the string representation of the object
293
+ # @return [String] String presentation of the object
294
+ def to_s
295
+ to_hash.to_s
296
+ end
297
+
298
+ # to_body is an alias to to_hash (backward compatibility)
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_body
301
+ to_hash
302
+ end
303
+
304
+ # Returns the object in the form of hash
305
+ # @return [Hash] Returns the object in the form of hash
306
+ def to_hash
307
+ hash = {}
308
+ self.class.attribute_map.each_pair do |attr, param|
309
+ value = self.send(attr)
310
+ if value.nil?
311
+ is_nullable = self.class.openapi_nullable.include?(attr)
312
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
313
+ end
314
+
315
+ hash[param] = _to_hash(value)
316
+ end
317
+ hash
318
+ end
319
+
320
+ # Outputs non-array value in the form of hash
321
+ # For object, use to_hash. Otherwise, just return the value
322
+ # @param [Object] value Any valid value
323
+ # @return [Hash] Returns the value in the form of hash
324
+ def _to_hash(value)
325
+ if value.is_a?(Array)
326
+ value.compact.map { |v| _to_hash(v) }
327
+ elsif value.is_a?(Hash)
328
+ {}.tap do |hash|
329
+ value.each { |k, v| hash[k] = _to_hash(v) }
330
+ end
331
+ elsif value.respond_to? :to_hash
332
+ value.to_hash
333
+ else
334
+ value
335
+ end
336
+ end
337
+
338
+ end
339
+
340
+ end