pingram 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 (187) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +54 -0
  4. data/Rakefile +10 -0
  5. data/lib/pingram/api/account_api.rb +506 -0
  6. data/lib/pingram/api/addresses_api.rb +209 -0
  7. data/lib/pingram/api/components_api.rb +396 -0
  8. data/lib/pingram/api/default_api.rb +88 -0
  9. data/lib/pingram/api/domains_api.rb +204 -0
  10. data/lib/pingram/api/editor_api.rb +88 -0
  11. data/lib/pingram/api/environments_api.rb +215 -0
  12. data/lib/pingram/api/health_api.rb +77 -0
  13. data/lib/pingram/api/insights_api.rb +88 -0
  14. data/lib/pingram/api/keys_api.rb +204 -0
  15. data/lib/pingram/api/logs_api.rb +375 -0
  16. data/lib/pingram/api/members_api.rb +433 -0
  17. data/lib/pingram/api/sender_api.rb +221 -0
  18. data/lib/pingram/api/templates_api.rb +479 -0
  19. data/lib/pingram/api/types_api.rb +335 -0
  20. data/lib/pingram/api/user_api.rb +587 -0
  21. data/lib/pingram/api/users_api.rb +228 -0
  22. data/lib/pingram/api_client.rb +397 -0
  23. data/lib/pingram/api_error.rb +58 -0
  24. data/lib/pingram/api_model_base.rb +88 -0
  25. data/lib/pingram/client_wrapper.rb +212 -0
  26. data/lib/pingram/configuration.rb +330 -0
  27. data/lib/pingram/models/account_addresses_response.rb +166 -0
  28. data/lib/pingram/models/account_addresses_response_addresses_inner.rb +301 -0
  29. data/lib/pingram/models/account_get_response.rb +354 -0
  30. data/lib/pingram/models/account_get_response_pending_downgrade_usage_limit.rb +201 -0
  31. data/lib/pingram/models/address_response.rb +164 -0
  32. data/lib/pingram/models/auto_join_get_response.rb +192 -0
  33. data/lib/pingram/models/auto_join_post_response.rb +192 -0
  34. data/lib/pingram/models/auto_join_request_body.rb +166 -0
  35. data/lib/pingram/models/bee_token_v2.rb +190 -0
  36. data/lib/pingram/models/billing_post_request_body.rb +216 -0
  37. data/lib/pingram/models/billing_post_response_body.rb +367 -0
  38. data/lib/pingram/models/billing_post_response_body_pending_downgrade_usage_limit.rb +202 -0
  39. data/lib/pingram/models/channels_enum.rb +45 -0
  40. data/lib/pingram/models/create_account_request_body.rb +164 -0
  41. data/lib/pingram/models/create_account_response.rb +190 -0
  42. data/lib/pingram/models/create_address_request.rb +182 -0
  43. data/lib/pingram/models/create_key_request.rb +227 -0
  44. data/lib/pingram/models/create_key_response.rb +308 -0
  45. data/lib/pingram/models/delete_key_response.rb +165 -0
  46. data/lib/pingram/models/delete_user_response.rb +164 -0
  47. data/lib/pingram/models/email_auth_token_post_request.rb +147 -0
  48. data/lib/pingram/models/email_component_patch_request.rb +174 -0
  49. data/lib/pingram/models/email_component_post_request.rb +217 -0
  50. data/lib/pingram/models/email_component_response.rb +424 -0
  51. data/lib/pingram/models/email_component_response_referenced_by_inner.rb +238 -0
  52. data/lib/pingram/models/environment.rb +270 -0
  53. data/lib/pingram/models/environment_create_request.rb +164 -0
  54. data/lib/pingram/models/environment_patch_request.rb +176 -0
  55. data/lib/pingram/models/get_account_metadata_response.rb +164 -0
  56. data/lib/pingram/models/get_account_metadata_response_user_account_metadata.rb +216 -0
  57. data/lib/pingram/models/get_email_components_response_inner.rb +424 -0
  58. data/lib/pingram/models/get_environments_response_inner.rb +270 -0
  59. data/lib/pingram/models/get_inapp_notifications_response.rb +166 -0
  60. data/lib/pingram/models/get_inapp_notifications_response_notifications_inner.rb +389 -0
  61. data/lib/pingram/models/get_inapp_notifications_response_notifications_inner_delivery_options.rb +206 -0
  62. data/lib/pingram/models/get_inapp_notifications_response_notifications_inner_delivery_options_instant.rb +191 -0
  63. data/lib/pingram/models/get_inapp_notifications_response_notifications_inner_delivery_options_off.rb +164 -0
  64. data/lib/pingram/models/get_inapp_notifications_response_notifications_inner_replies_inner.rb +190 -0
  65. data/lib/pingram/models/get_inapp_notifications_response_notifications_inner_template.rb +103 -0
  66. data/lib/pingram/models/get_inapp_notifications_response_notifications_inner_template_any_of.rb +301 -0
  67. data/lib/pingram/models/get_keys_response.rb +168 -0
  68. data/lib/pingram/models/get_keys_response_keys_inner.rb +371 -0
  69. data/lib/pingram/models/get_logs_response.rb +175 -0
  70. data/lib/pingram/models/get_logs_response_messages_inner.rb +419 -0
  71. data/lib/pingram/models/get_logs_response_messages_inner_attachments_inner.rb +225 -0
  72. data/lib/pingram/models/get_members_response_inner.rb +236 -0
  73. data/lib/pingram/models/get_metrics_response_inner.rb +238 -0
  74. data/lib/pingram/models/get_metrics_response_inner_messages_inner.rb +159 -0
  75. data/lib/pingram/models/get_notifications_response_inner.rb +317 -0
  76. data/lib/pingram/models/get_notifications_response_inner_deduplication.rb +164 -0
  77. data/lib/pingram/models/get_notifications_response_inner_options.rb +201 -0
  78. data/lib/pingram/models/get_notifications_response_inner_options_email.rb +242 -0
  79. data/lib/pingram/models/get_notifications_response_inner_options_email_daily.rb +173 -0
  80. data/lib/pingram/models/get_notifications_response_inner_options_email_monthly.rb +216 -0
  81. data/lib/pingram/models/get_notifications_response_inner_options_email_weekly.rb +182 -0
  82. data/lib/pingram/models/get_notifications_response_inner_templates_inner.rb +214 -0
  83. data/lib/pingram/models/get_notifications_response_inner_throttling.rb +294 -0
  84. data/lib/pingram/models/get_senders_response_inner.rb +342 -0
  85. data/lib/pingram/models/get_templates_response.rb +103 -0
  86. data/lib/pingram/models/get_users_response.rb +201 -0
  87. data/lib/pingram/models/get_users_response_users_inner.rb +268 -0
  88. data/lib/pingram/models/get_users_response_users_inner_email_suppression_status.rb +214 -0
  89. data/lib/pingram/models/get_users_response_users_inner_push_tokens_inner.rb +252 -0
  90. data/lib/pingram/models/get_users_response_users_inner_push_tokens_inner_device.rb +209 -0
  91. data/lib/pingram/models/get_users_response_users_inner_slack_token.rb +317 -0
  92. data/lib/pingram/models/get_users_response_users_inner_slack_token_authed_user.rb +192 -0
  93. data/lib/pingram/models/get_users_response_users_inner_slack_token_enterprise.rb +156 -0
  94. data/lib/pingram/models/get_users_response_users_inner_slack_token_incoming_webhook.rb +174 -0
  95. data/lib/pingram/models/get_users_response_users_inner_slack_token_response_metadata.rb +200 -0
  96. data/lib/pingram/models/get_users_response_users_inner_web_push_tokens_inner.rb +164 -0
  97. data/lib/pingram/models/get_users_response_users_inner_web_push_tokens_inner_sub.rb +191 -0
  98. data/lib/pingram/models/get_users_response_users_inner_web_push_tokens_inner_sub_keys.rb +190 -0
  99. data/lib/pingram/models/in_app_notification_patch_request.rb +231 -0
  100. data/lib/pingram/models/in_app_notification_unread_clear_request.rb +156 -0
  101. data/lib/pingram/models/inapp_unread_count_response.rb +164 -0
  102. data/lib/pingram/models/inbound_request_body.rb +103 -0
  103. data/lib/pingram/models/inbound_response_body.rb +216 -0
  104. data/lib/pingram/models/inbound_response_body_results_inner.rb +216 -0
  105. data/lib/pingram/models/ingishts_post_request.rb +288 -0
  106. data/lib/pingram/models/ingishts_post_request_label_options.rb +147 -0
  107. data/lib/pingram/models/ingishts_post_request_metric_data_queries_inner.rb +208 -0
  108. data/lib/pingram/models/ingishts_post_request_metric_data_queries_inner_metric_stat.rb +211 -0
  109. data/lib/pingram/models/ingishts_post_request_metric_data_queries_inner_metric_stat_metric.rb +171 -0
  110. data/lib/pingram/models/ingishts_post_request_metric_data_queries_inner_metric_stat_metric_dimensions_inner.rb +159 -0
  111. data/lib/pingram/models/intercom_webhook.rb +293 -0
  112. data/lib/pingram/models/intercom_webhook_data.rb +164 -0
  113. data/lib/pingram/models/intercom_webhook_data_item.rb +103 -0
  114. data/lib/pingram/models/intercom_webhook_data_item_any_of.rb +453 -0
  115. data/lib/pingram/models/intercom_webhook_data_item_any_of_contacts.rb +216 -0
  116. data/lib/pingram/models/intercom_webhook_data_item_any_of_contacts_contacts_inner.rb +199 -0
  117. data/lib/pingram/models/intercom_webhook_data_item_any_of_source.rb +260 -0
  118. data/lib/pingram/models/intercom_webhook_data_item_any_of_source_author.rb +208 -0
  119. data/lib/pingram/models/invite_post_response.rb +156 -0
  120. data/lib/pingram/models/log_query_post_body.rb +251 -0
  121. data/lib/pingram/models/logs_bulk_request.rb +167 -0
  122. data/lib/pingram/models/logs_get_response.rb +167 -0
  123. data/lib/pingram/models/logs_get_response_logs_inner.rb +1808 -0
  124. data/lib/pingram/models/logs_query_response.rb +165 -0
  125. data/lib/pingram/models/logs_query_result_response.rb +194 -0
  126. data/lib/pingram/models/logs_retention_response.rb +165 -0
  127. data/lib/pingram/models/logs_tail_response.rb +167 -0
  128. data/lib/pingram/models/member_invite_request.rb +173 -0
  129. data/lib/pingram/models/member_update_request.rb +164 -0
  130. data/lib/pingram/models/message_response.rb +164 -0
  131. data/lib/pingram/models/notification.rb +317 -0
  132. data/lib/pingram/models/notification_create_request.rb +227 -0
  133. data/lib/pingram/models/notification_patch_request.rb +203 -0
  134. data/lib/pingram/models/post_email_test_request.rb +303 -0
  135. data/lib/pingram/models/post_email_test_response.rb +175 -0
  136. data/lib/pingram/models/post_senders_request_body.rb +164 -0
  137. data/lib/pingram/models/post_user_request.rb +215 -0
  138. data/lib/pingram/models/sender_post_body.rb +324 -0
  139. data/lib/pingram/models/sender_post_body_email.rb +217 -0
  140. data/lib/pingram/models/sender_post_body_inapp.rb +182 -0
  141. data/lib/pingram/models/sender_post_body_mobile_push.rb +190 -0
  142. data/lib/pingram/models/sender_post_body_options.rb +165 -0
  143. data/lib/pingram/models/sender_post_body_options_apn.rb +201 -0
  144. data/lib/pingram/models/sender_post_body_options_email.rb +209 -0
  145. data/lib/pingram/models/sender_post_body_options_email_attachments_inner.rb +103 -0
  146. data/lib/pingram/models/sender_post_body_options_email_attachments_inner_any_of.rb +190 -0
  147. data/lib/pingram/models/sender_post_body_options_email_attachments_inner_any_of1.rb +199 -0
  148. data/lib/pingram/models/sender_post_body_options_fcm.rb +147 -0
  149. data/lib/pingram/models/sender_post_body_options_fcm_android.rb +208 -0
  150. data/lib/pingram/models/sender_post_body_slack.rb +299 -0
  151. data/lib/pingram/models/sender_post_body_slack_metadata.rb +173 -0
  152. data/lib/pingram/models/sender_post_body_slack_metadata_entities_inner.rb +257 -0
  153. data/lib/pingram/models/sender_post_body_slack_metadata_entities_inner_external_ref.rb +174 -0
  154. data/lib/pingram/models/sender_post_body_sms.rb +156 -0
  155. data/lib/pingram/models/sender_post_body_sms_auto_reply.rb +164 -0
  156. data/lib/pingram/models/sender_post_body_to.rb +251 -0
  157. data/lib/pingram/models/sender_post_body_user.rb +268 -0
  158. data/lib/pingram/models/sender_post_body_web_push.rb +208 -0
  159. data/lib/pingram/models/sender_post_response.rb +192 -0
  160. data/lib/pingram/models/set_default_template_request.rb +204 -0
  161. data/lib/pingram/models/slack_interactivity_response.rb +165 -0
  162. data/lib/pingram/models/slack_oauth_request.rb +190 -0
  163. data/lib/pingram/models/success_response.rb +164 -0
  164. data/lib/pingram/models/supabase_configure_request.rb +242 -0
  165. data/lib/pingram/models/supabase_configure_response.rb +173 -0
  166. data/lib/pingram/models/supabase_o_auth_request.rb +216 -0
  167. data/lib/pingram/models/supabase_o_auth_response.rb +173 -0
  168. data/lib/pingram/models/supabase_projects_response.rb +166 -0
  169. data/lib/pingram/models/supabase_projects_response_projects_inner.rb +268 -0
  170. data/lib/pingram/models/supabase_status_response.rb +208 -0
  171. data/lib/pingram/models/template.rb +301 -0
  172. data/lib/pingram/models/template_patch_request.rb +104 -0
  173. data/lib/pingram/models/template_patch_request_any_of.rb +199 -0
  174. data/lib/pingram/models/template_patch_request_any_of1.rb +187 -0
  175. data/lib/pingram/models/template_patch_request_any_of1_batch.rb +217 -0
  176. data/lib/pingram/models/template_patch_request_any_of1_instant.rb +184 -0
  177. data/lib/pingram/models/template_post_request.rb +346 -0
  178. data/lib/pingram/models/template_post_request_batch.rb +217 -0
  179. data/lib/pingram/models/template_post_request_instant.rb +183 -0
  180. data/lib/pingram/models/update_address_request.rb +182 -0
  181. data/lib/pingram/models/user.rb +268 -0
  182. data/lib/pingram/models/user_suppression_delete_response.rb +164 -0
  183. data/lib/pingram/models/webhook_response.rb +182 -0
  184. data/lib/pingram/version.rb +15 -0
  185. data/lib/pingram.rb +215 -0
  186. data/pingram.gemspec +38 -0
  187. metadata +270 -0
@@ -0,0 +1,103 @@
1
+ =begin
2
+ #NotificationAPI
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
+ module IntercomWebhookDataItem
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'Hash<String, Object>',
23
+ :'IntercomWebhookDataItemAnyOf'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = Pingram.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,453 @@
1
+ =begin
2
+ #NotificationAPI
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
+ class IntercomWebhookDataItemAnyOf < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ attr_accessor :id
21
+
22
+ attr_accessor :created_at
23
+
24
+ attr_accessor :updated_at
25
+
26
+ attr_accessor :title
27
+
28
+ attr_accessor :admin_assignee_id
29
+
30
+ attr_accessor :team_assignee_id
31
+
32
+ attr_accessor :source
33
+
34
+ attr_accessor :contacts
35
+
36
+ attr_accessor :state
37
+
38
+ attr_accessor :open
39
+
40
+ attr_accessor :read
41
+
42
+ attr_accessor :priority
43
+
44
+ class EnumAttributeValidator
45
+ attr_reader :datatype
46
+ attr_reader :allowable_values
47
+
48
+ def initialize(datatype, allowable_values)
49
+ @allowable_values = allowable_values.map do |value|
50
+ case datatype.to_s
51
+ when /Integer/i
52
+ value.to_i
53
+ when /Float/i
54
+ value.to_f
55
+ else
56
+ value
57
+ end
58
+ end
59
+ end
60
+
61
+ def valid?(value)
62
+ !value || allowable_values.include?(value)
63
+ end
64
+ end
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'type' => :'type',
70
+ :'id' => :'id',
71
+ :'created_at' => :'created_at',
72
+ :'updated_at' => :'updated_at',
73
+ :'title' => :'title',
74
+ :'admin_assignee_id' => :'admin_assignee_id',
75
+ :'team_assignee_id' => :'team_assignee_id',
76
+ :'source' => :'source',
77
+ :'contacts' => :'contacts',
78
+ :'state' => :'state',
79
+ :'open' => :'open',
80
+ :'read' => :'read',
81
+ :'priority' => :'priority'
82
+ }
83
+ end
84
+
85
+ # Returns attribute mapping this model knows about
86
+ def self.acceptable_attribute_map
87
+ attribute_map
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ acceptable_attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'type' => :'String',
99
+ :'id' => :'String',
100
+ :'created_at' => :'Float',
101
+ :'updated_at' => :'Float',
102
+ :'title' => :'String',
103
+ :'admin_assignee_id' => :'Float',
104
+ :'team_assignee_id' => :'String',
105
+ :'source' => :'IntercomWebhookDataItemAnyOfSource',
106
+ :'contacts' => :'IntercomWebhookDataItemAnyOfContacts',
107
+ :'state' => :'String',
108
+ :'open' => :'Boolean',
109
+ :'read' => :'Boolean',
110
+ :'priority' => :'String'
111
+ }
112
+ end
113
+
114
+ # List of attributes with nullable: true
115
+ def self.openapi_nullable
116
+ Set.new([
117
+ ])
118
+ end
119
+
120
+ # Initializes the object
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ def initialize(attributes = {})
123
+ if (!attributes.is_a?(Hash))
124
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::IntercomWebhookDataItemAnyOf` initialize method"
125
+ end
126
+
127
+ # check to see if the attribute exists and convert string to symbol for hash key
128
+ acceptable_attribute_map = self.class.acceptable_attribute_map
129
+ attributes = attributes.each_with_object({}) { |(k, v), h|
130
+ if (!acceptable_attribute_map.key?(k.to_sym))
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::IntercomWebhookDataItemAnyOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
132
+ end
133
+ h[k.to_sym] = v
134
+ }
135
+
136
+ if attributes.key?(:'type')
137
+ self.type = attributes[:'type']
138
+ else
139
+ self.type = nil
140
+ end
141
+
142
+ if attributes.key?(:'id')
143
+ self.id = attributes[:'id']
144
+ else
145
+ self.id = nil
146
+ end
147
+
148
+ if attributes.key?(:'created_at')
149
+ self.created_at = attributes[:'created_at']
150
+ else
151
+ self.created_at = nil
152
+ end
153
+
154
+ if attributes.key?(:'updated_at')
155
+ self.updated_at = attributes[:'updated_at']
156
+ else
157
+ self.updated_at = nil
158
+ end
159
+
160
+ if attributes.key?(:'title')
161
+ self.title = attributes[:'title']
162
+ end
163
+
164
+ if attributes.key?(:'admin_assignee_id')
165
+ self.admin_assignee_id = attributes[:'admin_assignee_id']
166
+ end
167
+
168
+ if attributes.key?(:'team_assignee_id')
169
+ self.team_assignee_id = attributes[:'team_assignee_id']
170
+ end
171
+
172
+ if attributes.key?(:'source')
173
+ self.source = attributes[:'source']
174
+ else
175
+ self.source = nil
176
+ end
177
+
178
+ if attributes.key?(:'contacts')
179
+ self.contacts = attributes[:'contacts']
180
+ else
181
+ self.contacts = nil
182
+ end
183
+
184
+ if attributes.key?(:'state')
185
+ self.state = attributes[:'state']
186
+ else
187
+ self.state = nil
188
+ end
189
+
190
+ if attributes.key?(:'open')
191
+ self.open = attributes[:'open']
192
+ else
193
+ self.open = nil
194
+ end
195
+
196
+ if attributes.key?(:'read')
197
+ self.read = attributes[:'read']
198
+ else
199
+ self.read = nil
200
+ end
201
+
202
+ if attributes.key?(:'priority')
203
+ self.priority = attributes[:'priority']
204
+ else
205
+ self.priority = nil
206
+ end
207
+ end
208
+
209
+ # Show invalid properties with the reasons. Usually used together with valid?
210
+ # @return Array for valid properties with the reasons
211
+ def list_invalid_properties
212
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
213
+ invalid_properties = Array.new
214
+ if @type.nil?
215
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
216
+ end
217
+
218
+ if @id.nil?
219
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
220
+ end
221
+
222
+ if @created_at.nil?
223
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
224
+ end
225
+
226
+ if @updated_at.nil?
227
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
228
+ end
229
+
230
+ if @source.nil?
231
+ invalid_properties.push('invalid value for "source", source cannot be nil.')
232
+ end
233
+
234
+ if @contacts.nil?
235
+ invalid_properties.push('invalid value for "contacts", contacts cannot be nil.')
236
+ end
237
+
238
+ if @state.nil?
239
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
240
+ end
241
+
242
+ if @open.nil?
243
+ invalid_properties.push('invalid value for "open", open cannot be nil.')
244
+ end
245
+
246
+ if @read.nil?
247
+ invalid_properties.push('invalid value for "read", read cannot be nil.')
248
+ end
249
+
250
+ if @priority.nil?
251
+ invalid_properties.push('invalid value for "priority", priority cannot be nil.')
252
+ end
253
+
254
+ invalid_properties
255
+ end
256
+
257
+ # Check to see if the all the properties in the model are valid
258
+ # @return true if the model is valid
259
+ def valid?
260
+ warn '[DEPRECATED] the `valid?` method is obsolete'
261
+ return false if @type.nil?
262
+ type_validator = EnumAttributeValidator.new('String', ["conversation"])
263
+ return false unless type_validator.valid?(@type)
264
+ return false if @id.nil?
265
+ return false if @created_at.nil?
266
+ return false if @updated_at.nil?
267
+ return false if @source.nil?
268
+ return false if @contacts.nil?
269
+ return false if @state.nil?
270
+ state_validator = EnumAttributeValidator.new('String', ["open", "closed", "snoozed"])
271
+ return false unless state_validator.valid?(@state)
272
+ return false if @open.nil?
273
+ return false if @read.nil?
274
+ return false if @priority.nil?
275
+ priority_validator = EnumAttributeValidator.new('String', ["priority", "not_priority"])
276
+ return false unless priority_validator.valid?(@priority)
277
+ true
278
+ end
279
+
280
+ # Custom attribute writer method checking allowed values (enum).
281
+ # @param [Object] type Object to be assigned
282
+ def type=(type)
283
+ validator = EnumAttributeValidator.new('String', ["conversation"])
284
+ unless validator.valid?(type)
285
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
286
+ end
287
+ @type = type
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] id Value to be assigned
292
+ def id=(id)
293
+ if id.nil?
294
+ fail ArgumentError, 'id cannot be nil'
295
+ end
296
+
297
+ @id = id
298
+ end
299
+
300
+ # Custom attribute writer method with validation
301
+ # @param [Object] created_at Value to be assigned
302
+ def created_at=(created_at)
303
+ if created_at.nil?
304
+ fail ArgumentError, 'created_at cannot be nil'
305
+ end
306
+
307
+ @created_at = created_at
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] updated_at Value to be assigned
312
+ def updated_at=(updated_at)
313
+ if updated_at.nil?
314
+ fail ArgumentError, 'updated_at cannot be nil'
315
+ end
316
+
317
+ @updated_at = updated_at
318
+ end
319
+
320
+ # Custom attribute writer method with validation
321
+ # @param [Object] source Value to be assigned
322
+ def source=(source)
323
+ if source.nil?
324
+ fail ArgumentError, 'source cannot be nil'
325
+ end
326
+
327
+ @source = source
328
+ end
329
+
330
+ # Custom attribute writer method with validation
331
+ # @param [Object] contacts Value to be assigned
332
+ def contacts=(contacts)
333
+ if contacts.nil?
334
+ fail ArgumentError, 'contacts cannot be nil'
335
+ end
336
+
337
+ @contacts = contacts
338
+ end
339
+
340
+ # Custom attribute writer method checking allowed values (enum).
341
+ # @param [Object] state Object to be assigned
342
+ def state=(state)
343
+ validator = EnumAttributeValidator.new('String', ["open", "closed", "snoozed"])
344
+ unless validator.valid?(state)
345
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
346
+ end
347
+ @state = state
348
+ end
349
+
350
+ # Custom attribute writer method with validation
351
+ # @param [Object] open Value to be assigned
352
+ def open=(open)
353
+ if open.nil?
354
+ fail ArgumentError, 'open cannot be nil'
355
+ end
356
+
357
+ @open = open
358
+ end
359
+
360
+ # Custom attribute writer method with validation
361
+ # @param [Object] read Value to be assigned
362
+ def read=(read)
363
+ if read.nil?
364
+ fail ArgumentError, 'read cannot be nil'
365
+ end
366
+
367
+ @read = read
368
+ end
369
+
370
+ # Custom attribute writer method checking allowed values (enum).
371
+ # @param [Object] priority Object to be assigned
372
+ def priority=(priority)
373
+ validator = EnumAttributeValidator.new('String', ["priority", "not_priority"])
374
+ unless validator.valid?(priority)
375
+ fail ArgumentError, "invalid value for \"priority\", must be one of #{validator.allowable_values}."
376
+ end
377
+ @priority = priority
378
+ end
379
+
380
+ # Checks equality by comparing each attribute.
381
+ # @param [Object] Object to be compared
382
+ def ==(o)
383
+ return true if self.equal?(o)
384
+ self.class == o.class &&
385
+ type == o.type &&
386
+ id == o.id &&
387
+ created_at == o.created_at &&
388
+ updated_at == o.updated_at &&
389
+ title == o.title &&
390
+ admin_assignee_id == o.admin_assignee_id &&
391
+ team_assignee_id == o.team_assignee_id &&
392
+ source == o.source &&
393
+ contacts == o.contacts &&
394
+ state == o.state &&
395
+ open == o.open &&
396
+ read == o.read &&
397
+ priority == o.priority
398
+ end
399
+
400
+ # @see the `==` method
401
+ # @param [Object] Object to be compared
402
+ def eql?(o)
403
+ self == o
404
+ end
405
+
406
+ # Calculates hash code according to all attributes.
407
+ # @return [Integer] Hash code
408
+ def hash
409
+ [type, id, created_at, updated_at, title, admin_assignee_id, team_assignee_id, source, contacts, state, open, read, priority].hash
410
+ end
411
+
412
+ # Builds the object from hash
413
+ # @param [Hash] attributes Model attributes in the form of hash
414
+ # @return [Object] Returns the model itself
415
+ def self.build_from_hash(attributes)
416
+ return nil unless attributes.is_a?(Hash)
417
+ attributes = attributes.transform_keys(&:to_sym)
418
+ transformed_hash = {}
419
+ openapi_types.each_pair do |key, type|
420
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
421
+ transformed_hash["#{key}"] = nil
422
+ elsif type =~ /\AArray<(.*)>/i
423
+ # check to ensure the input is an array given that the attribute
424
+ # is documented as an array but the input is not
425
+ if attributes[attribute_map[key]].is_a?(Array)
426
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
427
+ end
428
+ elsif !attributes[attribute_map[key]].nil?
429
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
430
+ end
431
+ end
432
+ new(transformed_hash)
433
+ end
434
+
435
+ # Returns the object in the form of hash
436
+ # @return [Hash] Returns the object in the form of hash
437
+ def to_hash
438
+ hash = {}
439
+ self.class.attribute_map.each_pair do |attr, param|
440
+ value = self.send(attr)
441
+ if value.nil?
442
+ is_nullable = self.class.openapi_nullable.include?(attr)
443
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
444
+ end
445
+
446
+ hash[param] = _to_hash(value)
447
+ end
448
+ hash
449
+ end
450
+
451
+ end
452
+
453
+ end