omnichannel 1.0.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 (111) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +120 -0
  5. data/Rakefile +10 -0
  6. data/config.json +12 -0
  7. data/docs/Channel.md +7 -0
  8. data/docs/DeliveryReportApi.md +58 -0
  9. data/docs/DeliveryReportResponse.md +10 -0
  10. data/docs/DeliveryResult.md +13 -0
  11. data/docs/Err.md +7 -0
  12. data/docs/ErrorItem.md +11 -0
  13. data/docs/ErrorResponse.md +8 -0
  14. data/docs/Message.md +9 -0
  15. data/docs/MessageResult.md +10 -0
  16. data/docs/OmniMessageCreateSuccessResponse.md +10 -0
  17. data/docs/Omnimessage.md +11 -0
  18. data/docs/OmnimessageApi.md +107 -0
  19. data/docs/ResponseErrorCode.md +7 -0
  20. data/docs/ResponseErrorTitle.md +7 -0
  21. data/docs/SMS.md +13 -0
  22. data/docs/Status.md +7 -0
  23. data/docs/Viber.md +14 -0
  24. data/docs/WhatsApp.md +14 -0
  25. data/docs/WhatsAppAudio.md +8 -0
  26. data/docs/WhatsAppDocument.md +9 -0
  27. data/docs/WhatsAppImage.md +9 -0
  28. data/docs/WhatsAppText.md +9 -0
  29. data/git_push.sh +55 -0
  30. data/lib/omnichannel.rb +60 -0
  31. data/lib/omnichannel/api/delivery_report_api.rb +74 -0
  32. data/lib/omnichannel/api/omnimessage_api.rb +126 -0
  33. data/lib/omnichannel/api_client.rb +387 -0
  34. data/lib/omnichannel/api_error.rb +38 -0
  35. data/lib/omnichannel/configuration.rb +251 -0
  36. data/lib/omnichannel/models/channel.rb +39 -0
  37. data/lib/omnichannel/models/delivery_report_response.rb +229 -0
  38. data/lib/omnichannel/models/delivery_result.rb +239 -0
  39. data/lib/omnichannel/models/err.rb +48 -0
  40. data/lib/omnichannel/models/error_item.rb +240 -0
  41. data/lib/omnichannel/models/error_response.rb +198 -0
  42. data/lib/omnichannel/models/message.rb +207 -0
  43. data/lib/omnichannel/models/message_result.rb +226 -0
  44. data/lib/omnichannel/models/omni_message_create_success_response.rb +229 -0
  45. data/lib/omnichannel/models/omnimessage.rb +233 -0
  46. data/lib/omnichannel/models/response_error_code.rb +43 -0
  47. data/lib/omnichannel/models/response_error_title.rb +42 -0
  48. data/lib/omnichannel/models/sms.rb +249 -0
  49. data/lib/omnichannel/models/status.rb +47 -0
  50. data/lib/omnichannel/models/viber.rb +254 -0
  51. data/lib/omnichannel/models/whats_app.rb +250 -0
  52. data/lib/omnichannel/models/whats_app_audio.rb +197 -0
  53. data/lib/omnichannel/models/whats_app_document.rb +207 -0
  54. data/lib/omnichannel/models/whats_app_image.rb +207 -0
  55. data/lib/omnichannel/models/whats_app_text.rb +209 -0
  56. data/lib/omnichannel/version.rb +15 -0
  57. data/lib/openapi_client.rb +61 -0
  58. data/lib/openapi_client/api/delivery_report_api.rb +74 -0
  59. data/lib/openapi_client/api/omnimessage_api.rb +126 -0
  60. data/lib/openapi_client/api_client.rb +387 -0
  61. data/lib/openapi_client/api_error.rb +38 -0
  62. data/lib/openapi_client/configuration.rb +251 -0
  63. data/lib/openapi_client/models/channel.rb +39 -0
  64. data/lib/openapi_client/models/delivery_report_response.rb +229 -0
  65. data/lib/openapi_client/models/delivery_result.rb +239 -0
  66. data/lib/openapi_client/models/err.rb +48 -0
  67. data/lib/openapi_client/models/error_item.rb +240 -0
  68. data/lib/openapi_client/models/error_response.rb +198 -0
  69. data/lib/openapi_client/models/message.rb +221 -0
  70. data/lib/openapi_client/models/message_result.rb +226 -0
  71. data/lib/openapi_client/models/omni_message_create_success_response.rb +229 -0
  72. data/lib/openapi_client/models/omnimessage.rb +233 -0
  73. data/lib/openapi_client/models/response_error_code.rb +43 -0
  74. data/lib/openapi_client/models/response_error_title.rb +42 -0
  75. data/lib/openapi_client/models/sms.rb +228 -0
  76. data/lib/openapi_client/models/status.rb +47 -0
  77. data/lib/openapi_client/models/viber.rb +233 -0
  78. data/lib/openapi_client/models/whats_app.rb +229 -0
  79. data/lib/openapi_client/models/whats_app_audio.rb +197 -0
  80. data/lib/openapi_client/models/whats_app_document.rb +207 -0
  81. data/lib/openapi_client/models/whats_app_image.rb +207 -0
  82. data/lib/openapi_client/models/whats_app_text.rb +209 -0
  83. data/lib/openapi_client/version.rb +15 -0
  84. data/omnichannel.gemspec +45 -0
  85. data/spec/api/delivery_report_api_spec.rb +46 -0
  86. data/spec/api/omnimessage_api_spec.rb +57 -0
  87. data/spec/api_client_spec.rb +226 -0
  88. data/spec/configuration_spec.rb +42 -0
  89. data/spec/models/channel_spec.rb +35 -0
  90. data/spec/models/delivery_report_response_spec.rb +53 -0
  91. data/spec/models/delivery_result_spec.rb +71 -0
  92. data/spec/models/err_spec.rb +35 -0
  93. data/spec/models/error_item_spec.rb +59 -0
  94. data/spec/models/error_response_spec.rb +41 -0
  95. data/spec/models/message_result_spec.rb +53 -0
  96. data/spec/models/message_spec.rb +53 -0
  97. data/spec/models/omni_message_create_success_response_spec.rb +53 -0
  98. data/spec/models/omnimessage_spec.rb +59 -0
  99. data/spec/models/response_error_code_spec.rb +35 -0
  100. data/spec/models/response_error_title_spec.rb +35 -0
  101. data/spec/models/sms_spec.rb +71 -0
  102. data/spec/models/status_spec.rb +35 -0
  103. data/spec/models/viber_spec.rb +77 -0
  104. data/spec/models/whats_app_audio_spec.rb +41 -0
  105. data/spec/models/whats_app_document_spec.rb +47 -0
  106. data/spec/models/whats_app_image_spec.rb +47 -0
  107. data/spec/models/whats_app_spec.rb +77 -0
  108. data/spec/models/whats_app_text_spec.rb +47 -0
  109. data/spec/spec_helper.rb +111 -0
  110. data/templates/README.mustache +114 -0
  111. metadata +358 -0
@@ -0,0 +1,239 @@
1
+ =begin
2
+ #Omnichannel API
3
+
4
+ #Messente's API which allows sending messages via various channels with fallback options.
5
+
6
+ OpenAPI spec version: 0.0.2
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Omnichannel
16
+ class DeliveryResult
17
+ attr_accessor :status
18
+
19
+ attr_accessor :channel
20
+
21
+ # Unique identifier for the message
22
+ attr_accessor :message_id
23
+
24
+ # Human-readable description of what went wrong, *null* in case of success or if the messages has not been processed yet
25
+ attr_accessor :error
26
+
27
+ attr_accessor :err
28
+
29
+ # When this status was received by Omnichannel API
30
+ attr_accessor :timestamp
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'status' => :'status',
36
+ :'channel' => :'channel',
37
+ :'message_id' => :'message_id',
38
+ :'error' => :'error',
39
+ :'err' => :'err',
40
+ :'timestamp' => :'timestamp'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'status' => :'Status',
48
+ :'channel' => :'Channel',
49
+ :'message_id' => :'String',
50
+ :'error' => :'String',
51
+ :'err' => :'Err',
52
+ :'timestamp' => :'DateTime'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
63
+
64
+ if attributes.has_key?(:'status')
65
+ self.status = attributes[:'status']
66
+ end
67
+
68
+ if attributes.has_key?(:'channel')
69
+ self.channel = attributes[:'channel']
70
+ end
71
+
72
+ if attributes.has_key?(:'message_id')
73
+ self.message_id = attributes[:'message_id']
74
+ end
75
+
76
+ if attributes.has_key?(:'error')
77
+ self.error = attributes[:'error']
78
+ end
79
+
80
+ if attributes.has_key?(:'err')
81
+ self.err = attributes[:'err']
82
+ end
83
+
84
+ if attributes.has_key?(:'timestamp')
85
+ self.timestamp = attributes[:'timestamp']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ status == o.status &&
108
+ channel == o.channel &&
109
+ message_id == o.message_id &&
110
+ error == o.error &&
111
+ err == o.err &&
112
+ timestamp == o.timestamp
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Fixnum] Hash code
123
+ def hash
124
+ [status, channel, message_id, error, err, timestamp].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ new.build_from_hash(attributes)
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ self.class.openapi_types.each_pair do |key, type|
140
+ if type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :DateTime
161
+ DateTime.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :BOOLEAN
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ Omnichannel.const_get(type).build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ next if value.nil?
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -0,0 +1,48 @@
1
+ =begin
2
+ #Omnichannel API
3
+
4
+ #Messente's API which allows sending messages via various channels with fallback options.
5
+
6
+ OpenAPI spec version: 0.0.2
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Omnichannel
16
+ class Err
17
+
18
+ N0 = 0.freeze
19
+ N1 = 1.freeze
20
+ N2 = 2.freeze
21
+ N3 = 3.freeze
22
+ N4 = 4.freeze
23
+ N5 = 5.freeze
24
+ N6 = 6.freeze
25
+ N7 = 7.freeze
26
+ N8 = 8.freeze
27
+ N9 = 9.freeze
28
+ N10 = 10.freeze
29
+ N999 = 999.freeze
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def self.build_from_hash(value)
35
+ new.build_from_hash(value)
36
+ end
37
+
38
+ # Builds the enum from string
39
+ # @param [String] The enum value in the form of the string
40
+ # @return [String] The enum value
41
+ def build_from_hash(value)
42
+ constantValues = Err.constants.select { |c| Err::const_get(c) == value }
43
+ raise "Invalid ENUM value #{value} for class #Err" if constantValues.empty?
44
+ value
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #Omnichannel API
3
+
4
+ #Messente's API which allows sending messages via various channels with fallback options.
5
+
6
+ OpenAPI spec version: 0.0.2
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Omnichannel
16
+ class ErrorItem
17
+ attr_accessor :title
18
+
19
+ # Free form more detailed description of the error.
20
+ attr_accessor :detail
21
+
22
+ attr_accessor :code
23
+
24
+ # Describes which field is causing the issue in the payload, null for non 400 status code responses
25
+ attr_accessor :source
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'title' => :'title',
31
+ :'detail' => :'detail',
32
+ :'code' => :'code',
33
+ :'source' => :'source'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'title' => :'ResponseErrorTitle',
41
+ :'detail' => :'String',
42
+ :'code' => :'ResponseErrorCode',
43
+ :'source' => :'String'
44
+ }
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ return unless attributes.is_a?(Hash)
51
+
52
+ # convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
54
+
55
+ if attributes.has_key?(:'title')
56
+ self.title = attributes[:'title']
57
+ end
58
+
59
+ if attributes.has_key?(:'detail')
60
+ self.detail = attributes[:'detail']
61
+ end
62
+
63
+ if attributes.has_key?(:'code')
64
+ self.code = attributes[:'code']
65
+ end
66
+
67
+ if attributes.has_key?(:'source')
68
+ self.source = attributes[:'source']
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ if @title.nil?
77
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
78
+ end
79
+
80
+ if @detail.nil?
81
+ invalid_properties.push('invalid value for "detail", detail cannot be nil.')
82
+ end
83
+
84
+ if @code.nil?
85
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
86
+ end
87
+
88
+ if @source.nil?
89
+ invalid_properties.push('invalid value for "source", source cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ return false if @title.nil?
99
+ return false if @detail.nil?
100
+ return false if @code.nil?
101
+ return false if @source.nil?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ title == o.title &&
111
+ detail == o.detail &&
112
+ code == o.code &&
113
+ source == o.source
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Fixnum] Hash code
124
+ def hash
125
+ [title, detail, code, source].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ new.build_from_hash(attributes)
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.openapi_types.each_pair do |key, type|
141
+ if type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
150
+ end
151
+
152
+ self
153
+ end
154
+
155
+ # Deserializes the data based on type
156
+ # @param string type Data type
157
+ # @param string value Value to be deserialized
158
+ # @return [Object] Deserialized data
159
+ def _deserialize(type, value)
160
+ case type.to_sym
161
+ when :DateTime
162
+ DateTime.parse(value)
163
+ when :Date
164
+ Date.parse(value)
165
+ when :String
166
+ value.to_s
167
+ when :Integer
168
+ value.to_i
169
+ when :Float
170
+ value.to_f
171
+ when :BOOLEAN
172
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
+ true
174
+ else
175
+ false
176
+ end
177
+ when :Object
178
+ # generic object (usually a Hash), return directly
179
+ value
180
+ when /\AArray<(?<inner_type>.+)>\z/
181
+ inner_type = Regexp.last_match[:inner_type]
182
+ value.map { |v| _deserialize(inner_type, v) }
183
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
184
+ k_type = Regexp.last_match[:k_type]
185
+ v_type = Regexp.last_match[:v_type]
186
+ {}.tap do |hash|
187
+ value.each do |k, v|
188
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
189
+ end
190
+ end
191
+ else # model
192
+ Omnichannel.const_get(type).build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ next if value.nil?
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end