dyspatch_client 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 (76) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE +202 -0
  4. data/README.md +130 -0
  5. data/Rakefile +8 -0
  6. data/docs/APIError.md +10 -0
  7. data/docs/CompiledRead.md +12 -0
  8. data/docs/CreatedAt.md +7 -0
  9. data/docs/Cursor.md +9 -0
  10. data/docs/LanguageId.md +7 -0
  11. data/docs/LocalizationId.md +7 -0
  12. data/docs/LocalizationMetaRead.md +11 -0
  13. data/docs/LocalizationName.md +7 -0
  14. data/docs/LocalizationRead.md +15 -0
  15. data/docs/LocalizationUrl.md +7 -0
  16. data/docs/LocalizationsApi.md +66 -0
  17. data/docs/TemplateDescription.md +7 -0
  18. data/docs/TemplateId.md +7 -0
  19. data/docs/TemplateMetaRead.md +14 -0
  20. data/docs/TemplateName.md +7 -0
  21. data/docs/TemplateRead.md +15 -0
  22. data/docs/TemplateUrl.md +7 -0
  23. data/docs/TemplatesApi.md +125 -0
  24. data/docs/TemplatesRead.md +9 -0
  25. data/docs/UpdatedAt.md +7 -0
  26. data/dyspatch_client.gemspec +45 -0
  27. data/git_push.sh +55 -0
  28. data/lib/dyspatch_client.rb +59 -0
  29. data/lib/dyspatch_client/api/localizations_api.rb +83 -0
  30. data/lib/dyspatch_client/api/templates_api.rb +140 -0
  31. data/lib/dyspatch_client/api_client.rb +389 -0
  32. data/lib/dyspatch_client/api_error.rb +38 -0
  33. data/lib/dyspatch_client/configuration.rb +209 -0
  34. data/lib/dyspatch_client/models/api_error.rb +242 -0
  35. data/lib/dyspatch_client/models/compiled_read.rb +277 -0
  36. data/lib/dyspatch_client/models/created_at.rb +179 -0
  37. data/lib/dyspatch_client/models/cursor.rb +199 -0
  38. data/lib/dyspatch_client/models/language_id.rb +179 -0
  39. data/lib/dyspatch_client/models/localization_id.rb +179 -0
  40. data/lib/dyspatch_client/models/localization_meta_read.rb +219 -0
  41. data/lib/dyspatch_client/models/localization_name.rb +179 -0
  42. data/lib/dyspatch_client/models/localization_read.rb +258 -0
  43. data/lib/dyspatch_client/models/localization_url.rb +179 -0
  44. data/lib/dyspatch_client/models/template_description.rb +179 -0
  45. data/lib/dyspatch_client/models/template_id.rb +179 -0
  46. data/lib/dyspatch_client/models/template_meta_read.rb +251 -0
  47. data/lib/dyspatch_client/models/template_name.rb +179 -0
  48. data/lib/dyspatch_client/models/template_read.rb +260 -0
  49. data/lib/dyspatch_client/models/template_url.rb +179 -0
  50. data/lib/dyspatch_client/models/templates_read.rb +200 -0
  51. data/lib/dyspatch_client/models/updated_at.rb +179 -0
  52. data/lib/dyspatch_client/version.rb +15 -0
  53. data/spec/api/localizations_api_spec.rb +48 -0
  54. data/spec/api/templates_api_spec.rb +61 -0
  55. data/spec/api_client_spec.rb +226 -0
  56. data/spec/configuration_spec.rb +42 -0
  57. data/spec/models/api_error_spec.rb +58 -0
  58. data/spec/models/compiled_read_spec.rb +66 -0
  59. data/spec/models/created_at_spec.rb +36 -0
  60. data/spec/models/cursor_spec.rb +48 -0
  61. data/spec/models/language_id_spec.rb +36 -0
  62. data/spec/models/localization_id_spec.rb +36 -0
  63. data/spec/models/localization_meta_read_spec.rb +60 -0
  64. data/spec/models/localization_name_spec.rb +36 -0
  65. data/spec/models/localization_read_spec.rb +84 -0
  66. data/spec/models/localization_url_spec.rb +36 -0
  67. data/spec/models/template_description_spec.rb +36 -0
  68. data/spec/models/template_id_spec.rb +36 -0
  69. data/spec/models/template_meta_read_spec.rb +78 -0
  70. data/spec/models/template_name_spec.rb +36 -0
  71. data/spec/models/template_read_spec.rb +84 -0
  72. data/spec/models/template_url_spec.rb +36 -0
  73. data/spec/models/templates_read_spec.rb +48 -0
  74. data/spec/models/updated_at_spec.rb +36 -0
  75. data/spec/spec_helper.rb +111 -0
  76. metadata +329 -0
@@ -0,0 +1,277 @@
1
+ =begin
2
+ #Dyspatch API
3
+
4
+ ## Introduction The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks. - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python)
5
+
6
+ OpenAPI spec version: 2018.08
7
+ Contact: support@dyspatch.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DyspatchClient
16
+
17
+ class CompiledRead
18
+ # Sender address
19
+ attr_accessor :sender
20
+
21
+ # Reply-To address
22
+ attr_accessor :reply_to
23
+
24
+ # Base64 encoded template subject line
25
+ attr_accessor :subject
26
+
27
+ # Base64 encoded template HTML body
28
+ attr_accessor :html
29
+
30
+ # Base64 encoded template text body
31
+ attr_accessor :text
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'sender' => :'sender',
38
+ :'reply_to' => :'replyTo',
39
+ :'subject' => :'subject',
40
+ :'html' => :'html',
41
+ :'text' => :'text'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'sender' => :'String',
49
+ :'reply_to' => :'String',
50
+ :'subject' => :'String',
51
+ :'html' => :'String',
52
+ :'text' => :'String'
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?(:'sender')
65
+ self.sender = attributes[:'sender']
66
+ end
67
+
68
+ if attributes.has_key?(:'replyTo')
69
+ self.reply_to = attributes[:'replyTo']
70
+ end
71
+
72
+ if attributes.has_key?(:'subject')
73
+ self.subject = attributes[:'subject']
74
+ end
75
+
76
+ if attributes.has_key?(:'html')
77
+ self.html = attributes[:'html']
78
+ end
79
+
80
+ if attributes.has_key?(:'text')
81
+ self.text = attributes[:'text']
82
+ end
83
+
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ if !@subject.nil? && @subject !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
91
+ invalid_properties.push("invalid value for 'subject', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
92
+ end
93
+
94
+ if !@html.nil? && @html !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
95
+ invalid_properties.push("invalid value for 'html', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
96
+ end
97
+
98
+ if !@text.nil? && @text !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
99
+ invalid_properties.push("invalid value for 'text', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
100
+ end
101
+
102
+ return invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ return false if !@subject.nil? && @subject !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
109
+ return false if !@html.nil? && @html !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
110
+ return false if !@text.nil? && @text !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
111
+ return true
112
+ end
113
+
114
+ # Custom attribute writer method with validation
115
+ # @param [Object] subject Value to be assigned
116
+ def subject=(subject)
117
+
118
+ if !subject.nil? && subject !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
119
+ fail ArgumentError, "invalid value for 'subject', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
120
+ end
121
+
122
+ @subject = subject
123
+ end
124
+
125
+ # Custom attribute writer method with validation
126
+ # @param [Object] html Value to be assigned
127
+ def html=(html)
128
+
129
+ if !html.nil? && html !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
130
+ fail ArgumentError, "invalid value for 'html', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
131
+ end
132
+
133
+ @html = html
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] text Value to be assigned
138
+ def text=(text)
139
+
140
+ if !text.nil? && text !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
141
+ fail ArgumentError, "invalid value for 'text', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
142
+ end
143
+
144
+ @text = text
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ sender == o.sender &&
153
+ reply_to == o.reply_to &&
154
+ subject == o.subject &&
155
+ html == o.html &&
156
+ text == o.text
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Fixnum] Hash code
167
+ def hash
168
+ [sender, reply_to, subject, html, text].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ self.class.swagger_types.each_pair do |key, type|
177
+ if type =~ /\AArray<(.*)>/i
178
+ # check to ensure the input is an array given that the the attribute
179
+ # is documented as an array but the input is not
180
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
181
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
182
+ end
183
+ elsif !attributes[self.class.attribute_map[key]].nil?
184
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
186
+ end
187
+
188
+ self
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def _deserialize(type, value)
196
+ case type.to_sym
197
+ when :DateTime
198
+ DateTime.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :BOOLEAN
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ temp_model = DyspatchClient.const_get(type).new
229
+ temp_model.build_from_hash(value)
230
+ end
231
+ end
232
+
233
+ # Returns the string representation of the object
234
+ # @return [String] String presentation of the object
235
+ def to_s
236
+ to_hash.to_s
237
+ end
238
+
239
+ # to_body is an alias to to_hash (backward compatibility)
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_body
242
+ to_hash
243
+ end
244
+
245
+ # Returns the object in the form of hash
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_hash
248
+ hash = {}
249
+ self.class.attribute_map.each_pair do |attr, param|
250
+ value = self.send(attr)
251
+ next if value.nil?
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map{ |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+
277
+ end
@@ -0,0 +1,179 @@
1
+ =begin
2
+ #Dyspatch API
3
+
4
+ ## Introduction The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks. - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python)
5
+
6
+ OpenAPI spec version: 2018.08
7
+ Contact: support@dyspatch.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DyspatchClient
16
+ # The time of initial creation
17
+ class CreatedAt
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ }
29
+ end
30
+
31
+ # Initializes the object
32
+ # @param [Hash] attributes Model attributes in the form of hash
33
+ def initialize(attributes = {})
34
+ return unless attributes.is_a?(Hash)
35
+
36
+ # convert string to symbol for hash key
37
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
38
+
39
+ end
40
+
41
+ # Show invalid properties with the reasons. Usually used together with valid?
42
+ # @return Array for valid properties with the reasons
43
+ def list_invalid_properties
44
+ invalid_properties = Array.new
45
+ return invalid_properties
46
+ end
47
+
48
+ # Check to see if the all the properties in the model are valid
49
+ # @return true if the model is valid
50
+ def valid?
51
+ return true
52
+ end
53
+
54
+ # Checks equality by comparing each attribute.
55
+ # @param [Object] Object to be compared
56
+ def ==(o)
57
+ return true if self.equal?(o)
58
+ self.class == o.class
59
+ end
60
+
61
+ # @see the `==` method
62
+ # @param [Object] Object to be compared
63
+ def eql?(o)
64
+ self == o
65
+ end
66
+
67
+ # Calculates hash code according to all attributes.
68
+ # @return [Fixnum] Hash code
69
+ def hash
70
+ [].hash
71
+ end
72
+
73
+ # Builds the object from hash
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @return [Object] Returns the model itself
76
+ def build_from_hash(attributes)
77
+ return nil unless attributes.is_a?(Hash)
78
+ self.class.swagger_types.each_pair do |key, type|
79
+ if type =~ /\AArray<(.*)>/i
80
+ # check to ensure the input is an array given that the the attribute
81
+ # is documented as an array but the input is not
82
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
83
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
84
+ end
85
+ elsif !attributes[self.class.attribute_map[key]].nil?
86
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
87
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
88
+ end
89
+
90
+ self
91
+ end
92
+
93
+ # Deserializes the data based on type
94
+ # @param string type Data type
95
+ # @param string value Value to be deserialized
96
+ # @return [Object] Deserialized data
97
+ def _deserialize(type, value)
98
+ case type.to_sym
99
+ when :DateTime
100
+ DateTime.parse(value)
101
+ when :Date
102
+ Date.parse(value)
103
+ when :String
104
+ value.to_s
105
+ when :Integer
106
+ value.to_i
107
+ when :Float
108
+ value.to_f
109
+ when :BOOLEAN
110
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
111
+ true
112
+ else
113
+ false
114
+ end
115
+ when :Object
116
+ # generic object (usually a Hash), return directly
117
+ value
118
+ when /\AArray<(?<inner_type>.+)>\z/
119
+ inner_type = Regexp.last_match[:inner_type]
120
+ value.map { |v| _deserialize(inner_type, v) }
121
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
122
+ k_type = Regexp.last_match[:k_type]
123
+ v_type = Regexp.last_match[:v_type]
124
+ {}.tap do |hash|
125
+ value.each do |k, v|
126
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
127
+ end
128
+ end
129
+ else # model
130
+ temp_model = DyspatchClient.const_get(type).new
131
+ temp_model.build_from_hash(value)
132
+ end
133
+ end
134
+
135
+ # Returns the string representation of the object
136
+ # @return [String] String presentation of the object
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # to_body is an alias to to_hash (backward compatibility)
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_body
144
+ to_hash
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ next if value.nil?
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ # Outputs non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ # @param [Object] value Any valid value
162
+ # @return [Hash] Returns the value in the form of hash
163
+ def _to_hash(value)
164
+ if value.is_a?(Array)
165
+ value.compact.map{ |v| _to_hash(v) }
166
+ elsif value.is_a?(Hash)
167
+ {}.tap do |hash|
168
+ value.each { |k, v| hash[k] = _to_hash(v) }
169
+ end
170
+ elsif value.respond_to? :to_hash
171
+ value.to_hash
172
+ else
173
+ value
174
+ end
175
+ end
176
+
177
+ end
178
+
179
+ end