dyspatch_client 2.0.0 → 5.0.1

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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/README.md +50 -34
  4. data/Rakefile +2 -0
  5. data/docs/APIError.md +12 -1
  6. data/docs/CompiledRead.md +13 -0
  7. data/docs/Cursor.md +11 -1
  8. data/docs/DraftMetaRead.md +27 -0
  9. data/docs/DraftRead.md +31 -0
  10. data/docs/DraftsApi.md +476 -0
  11. data/docs/DraftsRead.md +19 -0
  12. data/docs/InlineObject.md +17 -0
  13. data/docs/LocalizationKeyRead.md +19 -0
  14. data/docs/LocalizationMetaRead.md +15 -1
  15. data/docs/LocalizationRead.md +19 -1
  16. data/docs/LocalizationsApi.md +16 -18
  17. data/docs/TemplateMetaRead.md +15 -0
  18. data/docs/TemplateRead.md +16 -0
  19. data/docs/TemplatesApi.md +39 -40
  20. data/docs/TemplatesRead.md +10 -0
  21. data/dyspatch_client.gemspec +10 -16
  22. data/lib/dyspatch_client.rb +10 -4
  23. data/lib/dyspatch_client/api/drafts_api.rb +620 -0
  24. data/lib/dyspatch_client/api/localizations_api.rb +52 -34
  25. data/lib/dyspatch_client/api/templates_api.rb +100 -69
  26. data/lib/dyspatch_client/api_client.rb +54 -55
  27. data/lib/dyspatch_client/api_error.rb +23 -4
  28. data/lib/dyspatch_client/configuration.rb +49 -10
  29. data/lib/dyspatch_client/models/api_error.rb +50 -30
  30. data/lib/dyspatch_client/models/compiled_read.rb +49 -78
  31. data/lib/dyspatch_client/models/cursor.rb +47 -28
  32. data/lib/dyspatch_client/models/draft_meta_read.rb +258 -0
  33. data/lib/dyspatch_client/models/draft_read.rb +279 -0
  34. data/lib/dyspatch_client/models/drafts_read.rb +219 -0
  35. data/lib/dyspatch_client/models/inline_object.rb +206 -0
  36. data/lib/dyspatch_client/models/localization_key_read.rb +216 -0
  37. data/lib/dyspatch_client/models/localization_meta_read.rb +70 -39
  38. data/lib/dyspatch_client/models/localization_read.rb +73 -42
  39. data/lib/dyspatch_client/models/template_meta_read.rb +52 -33
  40. data/lib/dyspatch_client/models/template_read.rb +53 -34
  41. data/lib/dyspatch_client/models/templates_read.rb +45 -26
  42. data/lib/dyspatch_client/version.rb +5 -5
  43. data/pkg/dyspatch_client-5.0.0.gem +0 -0
  44. data/pkg/dyspatch_client-5.0.1.gem +0 -0
  45. data/spec/api/drafts_api_spec.rb +146 -0
  46. data/spec/api/localizations_api_spec.rb +12 -12
  47. data/spec/api/templates_api_spec.rb +24 -24
  48. data/spec/api_client_spec.rb +39 -39
  49. data/spec/configuration_spec.rb +12 -12
  50. data/spec/integration_spec.rb +41 -0
  51. data/spec/models/api_error_spec.rb +12 -13
  52. data/spec/models/compiled_read_spec.rb +10 -11
  53. data/spec/models/cursor_spec.rb +7 -8
  54. data/spec/models/draft_meta_read_spec.rb +77 -0
  55. data/spec/models/draft_read_spec.rb +83 -0
  56. data/spec/models/drafts_read_spec.rb +47 -0
  57. data/spec/models/inline_object_spec.rb +41 -0
  58. data/spec/models/localization_key_read_spec.rb +47 -0
  59. data/spec/models/localization_meta_read_spec.rb +18 -13
  60. data/spec/models/localization_read_spec.rb +20 -15
  61. data/spec/models/template_meta_read_spec.rb +12 -13
  62. data/spec/models/template_read_spec.rb +13 -14
  63. data/spec/models/templates_read_spec.rb +7 -8
  64. data/spec/spec_helper.rb +4 -4
  65. metadata +34 -128
  66. data/git_push.sh +0 -55
@@ -1,19 +1,19 @@
1
1
  =begin
2
2
  #Dyspatch API
3
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) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
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) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ The version of the OpenAPI document: 2020.04
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
-
16
+ # the template metadata
17
17
  class TemplateMetaRead
18
18
  # An opaque, unique identifier for a template
19
19
  attr_accessor :id
@@ -36,7 +36,6 @@ module DyspatchClient
36
36
  # The time of last update
37
37
  attr_accessor :updated_at
38
38
 
39
-
40
39
  # Attribute mapping from ruby-style variable name to JSON key.
41
40
  def self.attribute_map
42
41
  {
@@ -51,7 +50,7 @@ module DyspatchClient
51
50
  end
52
51
 
53
52
  # Attribute type mapping.
54
- def self.swagger_types
53
+ def self.openapi_types
55
54
  {
56
55
  :'id' => :'String',
57
56
  :'name' => :'String',
@@ -63,57 +62,69 @@ module DyspatchClient
63
62
  }
64
63
  end
65
64
 
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
66
71
  # Initializes the object
67
72
  # @param [Hash] attributes Model attributes in the form of hash
68
73
  def initialize(attributes = {})
69
- return unless attributes.is_a?(Hash)
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::TemplateMetaRead` initialize method"
76
+ end
70
77
 
71
- # convert string to symbol for hash key
72
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::TemplateMetaRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
73
85
 
74
- if attributes.has_key?(:'id')
86
+ if attributes.key?(:'id')
75
87
  self.id = attributes[:'id']
76
88
  end
77
89
 
78
- if attributes.has_key?(:'name')
90
+ if attributes.key?(:'name')
79
91
  self.name = attributes[:'name']
80
92
  end
81
93
 
82
- if attributes.has_key?(:'description')
94
+ if attributes.key?(:'description')
83
95
  self.description = attributes[:'description']
84
96
  end
85
97
 
86
- if attributes.has_key?(:'url')
98
+ if attributes.key?(:'url')
87
99
  self.url = attributes[:'url']
88
100
  end
89
101
 
90
- if attributes.has_key?(:'localizations')
102
+ if attributes.key?(:'localizations')
91
103
  if (value = attributes[:'localizations']).is_a?(Array)
92
104
  self.localizations = value
93
105
  end
94
106
  end
95
107
 
96
- if attributes.has_key?(:'createdAt')
97
- self.created_at = attributes[:'createdAt']
108
+ if attributes.key?(:'created_at')
109
+ self.created_at = attributes[:'created_at']
98
110
  end
99
111
 
100
- if attributes.has_key?(:'updatedAt')
101
- self.updated_at = attributes[:'updatedAt']
112
+ if attributes.key?(:'updated_at')
113
+ self.updated_at = attributes[:'updated_at']
102
114
  end
103
-
104
115
  end
105
116
 
106
117
  # Show invalid properties with the reasons. Usually used together with valid?
107
118
  # @return Array for valid properties with the reasons
108
119
  def list_invalid_properties
109
120
  invalid_properties = Array.new
110
- return invalid_properties
121
+ invalid_properties
111
122
  end
112
123
 
113
124
  # Check to see if the all the properties in the model are valid
114
125
  # @return true if the model is valid
115
126
  def valid?
116
- return true
127
+ true
117
128
  end
118
129
 
119
130
  # Checks equality by comparing each attribute.
@@ -137,22 +148,29 @@ module DyspatchClient
137
148
  end
138
149
 
139
150
  # Calculates hash code according to all attributes.
140
- # @return [Fixnum] Hash code
151
+ # @return [Integer] Hash code
141
152
  def hash
142
153
  [id, name, description, url, localizations, created_at, updated_at].hash
143
154
  end
144
155
 
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
145
163
  # Builds the object from hash
146
164
  # @param [Hash] attributes Model attributes in the form of hash
147
165
  # @return [Object] Returns the model itself
148
166
  def build_from_hash(attributes)
149
167
  return nil unless attributes.is_a?(Hash)
150
- self.class.swagger_types.each_pair do |key, type|
168
+ self.class.openapi_types.each_pair do |key, type|
151
169
  if type =~ /\AArray<(.*)>/i
152
- # check to ensure the input is an array given that the the attribute
170
+ # check to ensure the input is an array given that the attribute
153
171
  # is documented as an array but the input is not
154
172
  if attributes[self.class.attribute_map[key]].is_a?(Array)
155
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
174
  end
157
175
  elsif !attributes[self.class.attribute_map[key]].nil?
158
176
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -178,7 +196,7 @@ module DyspatchClient
178
196
  value.to_i
179
197
  when :Float
180
198
  value.to_f
181
- when :BOOLEAN
199
+ when :Boolean
182
200
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
201
  true
184
202
  else
@@ -199,8 +217,7 @@ module DyspatchClient
199
217
  end
200
218
  end
201
219
  else # model
202
- temp_model = DyspatchClient.const_get(type).new
203
- temp_model.build_from_hash(value)
220
+ DyspatchClient.const_get(type).build_from_hash(value)
204
221
  end
205
222
  end
206
223
 
@@ -222,7 +239,11 @@ module DyspatchClient
222
239
  hash = {}
223
240
  self.class.attribute_map.each_pair do |attr, param|
224
241
  value = self.send(attr)
225
- next if value.nil?
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
226
247
  hash[param] = _to_hash(value)
227
248
  end
228
249
  hash
@@ -234,7 +255,7 @@ module DyspatchClient
234
255
  # @return [Hash] Returns the value in the form of hash
235
256
  def _to_hash(value)
236
257
  if value.is_a?(Array)
237
- value.compact.map{ |v| _to_hash(v) }
258
+ value.compact.map { |v| _to_hash(v) }
238
259
  elsif value.is_a?(Hash)
239
260
  {}.tap do |hash|
240
261
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -245,7 +266,5 @@ module DyspatchClient
245
266
  value
246
267
  end
247
268
  end
248
-
249
269
  end
250
-
251
270
  end
@@ -1,19 +1,19 @@
1
1
  =begin
2
2
  #Dyspatch API
3
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) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
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) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ The version of the OpenAPI document: 2020.04
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
-
16
+ # list of template metadata
17
17
  class TemplateRead
18
18
  # An opaque, unique identifier for a template
19
19
  attr_accessor :id
@@ -38,7 +38,6 @@ module DyspatchClient
38
38
  # A list of the Template's available localizations
39
39
  attr_accessor :localizations
40
40
 
41
-
42
41
  # Attribute mapping from ruby-style variable name to JSON key.
43
42
  def self.attribute_map
44
43
  {
@@ -54,7 +53,7 @@ module DyspatchClient
54
53
  end
55
54
 
56
55
  # Attribute type mapping.
57
- def self.swagger_types
56
+ def self.openapi_types
58
57
  {
59
58
  :'id' => :'String',
60
59
  :'name' => :'String',
@@ -67,61 +66,73 @@ module DyspatchClient
67
66
  }
68
67
  end
69
68
 
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
70
75
  # Initializes the object
71
76
  # @param [Hash] attributes Model attributes in the form of hash
72
77
  def initialize(attributes = {})
73
- return unless attributes.is_a?(Hash)
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::TemplateRead` initialize method"
80
+ end
74
81
 
75
- # convert string to symbol for hash key
76
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::TemplateRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
77
89
 
78
- if attributes.has_key?(:'id')
90
+ if attributes.key?(:'id')
79
91
  self.id = attributes[:'id']
80
92
  end
81
93
 
82
- if attributes.has_key?(:'name')
94
+ if attributes.key?(:'name')
83
95
  self.name = attributes[:'name']
84
96
  end
85
97
 
86
- if attributes.has_key?(:'description')
98
+ if attributes.key?(:'description')
87
99
  self.description = attributes[:'description']
88
100
  end
89
101
 
90
- if attributes.has_key?(:'url')
102
+ if attributes.key?(:'url')
91
103
  self.url = attributes[:'url']
92
104
  end
93
105
 
94
- if attributes.has_key?(:'compiled')
106
+ if attributes.key?(:'compiled')
95
107
  self.compiled = attributes[:'compiled']
96
108
  end
97
109
 
98
- if attributes.has_key?(:'createdAt')
99
- self.created_at = attributes[:'createdAt']
110
+ if attributes.key?(:'created_at')
111
+ self.created_at = attributes[:'created_at']
100
112
  end
101
113
 
102
- if attributes.has_key?(:'updatedAt')
103
- self.updated_at = attributes[:'updatedAt']
114
+ if attributes.key?(:'updated_at')
115
+ self.updated_at = attributes[:'updated_at']
104
116
  end
105
117
 
106
- if attributes.has_key?(:'localizations')
118
+ if attributes.key?(:'localizations')
107
119
  if (value = attributes[:'localizations']).is_a?(Array)
108
120
  self.localizations = value
109
121
  end
110
122
  end
111
-
112
123
  end
113
124
 
114
125
  # Show invalid properties with the reasons. Usually used together with valid?
115
126
  # @return Array for valid properties with the reasons
116
127
  def list_invalid_properties
117
128
  invalid_properties = Array.new
118
- return invalid_properties
129
+ invalid_properties
119
130
  end
120
131
 
121
132
  # Check to see if the all the properties in the model are valid
122
133
  # @return true if the model is valid
123
134
  def valid?
124
- return true
135
+ true
125
136
  end
126
137
 
127
138
  # Checks equality by comparing each attribute.
@@ -146,22 +157,29 @@ module DyspatchClient
146
157
  end
147
158
 
148
159
  # Calculates hash code according to all attributes.
149
- # @return [Fixnum] Hash code
160
+ # @return [Integer] Hash code
150
161
  def hash
151
162
  [id, name, description, url, compiled, created_at, updated_at, localizations].hash
152
163
  end
153
164
 
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def self.build_from_hash(attributes)
169
+ new.build_from_hash(attributes)
170
+ end
171
+
154
172
  # Builds the object from hash
155
173
  # @param [Hash] attributes Model attributes in the form of hash
156
174
  # @return [Object] Returns the model itself
157
175
  def build_from_hash(attributes)
158
176
  return nil unless attributes.is_a?(Hash)
159
- self.class.swagger_types.each_pair do |key, type|
177
+ self.class.openapi_types.each_pair do |key, type|
160
178
  if type =~ /\AArray<(.*)>/i
161
- # check to ensure the input is an array given that the the attribute
179
+ # check to ensure the input is an array given that the attribute
162
180
  # is documented as an array but the input is not
163
181
  if attributes[self.class.attribute_map[key]].is_a?(Array)
164
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
182
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
165
183
  end
166
184
  elsif !attributes[self.class.attribute_map[key]].nil?
167
185
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -187,7 +205,7 @@ module DyspatchClient
187
205
  value.to_i
188
206
  when :Float
189
207
  value.to_f
190
- when :BOOLEAN
208
+ when :Boolean
191
209
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
210
  true
193
211
  else
@@ -208,8 +226,7 @@ module DyspatchClient
208
226
  end
209
227
  end
210
228
  else # model
211
- temp_model = DyspatchClient.const_get(type).new
212
- temp_model.build_from_hash(value)
229
+ DyspatchClient.const_get(type).build_from_hash(value)
213
230
  end
214
231
  end
215
232
 
@@ -231,7 +248,11 @@ module DyspatchClient
231
248
  hash = {}
232
249
  self.class.attribute_map.each_pair do |attr, param|
233
250
  value = self.send(attr)
234
- next if value.nil?
251
+ if value.nil?
252
+ is_nullable = self.class.openapi_nullable.include?(attr)
253
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
254
+ end
255
+
235
256
  hash[param] = _to_hash(value)
236
257
  end
237
258
  hash
@@ -243,7 +264,7 @@ module DyspatchClient
243
264
  # @return [Hash] Returns the value in the form of hash
244
265
  def _to_hash(value)
245
266
  if value.is_a?(Array)
246
- value.compact.map{ |v| _to_hash(v) }
267
+ value.compact.map { |v| _to_hash(v) }
247
268
  elsif value.is_a?(Hash)
248
269
  {}.tap do |hash|
249
270
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -254,7 +275,5 @@ module DyspatchClient
254
275
  value
255
276
  end
256
277
  end
257
-
258
278
  end
259
-
260
279
  end
@@ -1,26 +1,25 @@
1
1
  =begin
2
2
  #Dyspatch API
3
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) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
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) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ The version of the OpenAPI document: 2020.04
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
-
16
+ # list of template metadata
17
17
  class TemplatesRead
18
18
  attr_accessor :cursor
19
19
 
20
20
  # A list of template metadata objects
21
21
  attr_accessor :data
22
22
 
23
-
24
23
  # Attribute mapping from ruby-style variable name to JSON key.
25
24
  def self.attribute_map
26
25
  {
@@ -30,44 +29,56 @@ module DyspatchClient
30
29
  end
31
30
 
32
31
  # Attribute type mapping.
33
- def self.swagger_types
32
+ def self.openapi_types
34
33
  {
35
34
  :'cursor' => :'Cursor',
36
35
  :'data' => :'Array<TemplateMetaRead>'
37
36
  }
38
37
  end
39
38
 
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
40
45
  # Initializes the object
41
46
  # @param [Hash] attributes Model attributes in the form of hash
42
47
  def initialize(attributes = {})
43
- return unless attributes.is_a?(Hash)
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::TemplatesRead` initialize method"
50
+ end
44
51
 
45
- # convert string to symbol for hash key
46
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::TemplatesRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
47
59
 
48
- if attributes.has_key?(:'cursor')
60
+ if attributes.key?(:'cursor')
49
61
  self.cursor = attributes[:'cursor']
50
62
  end
51
63
 
52
- if attributes.has_key?(:'data')
64
+ if attributes.key?(:'data')
53
65
  if (value = attributes[:'data']).is_a?(Array)
54
66
  self.data = value
55
67
  end
56
68
  end
57
-
58
69
  end
59
70
 
60
71
  # Show invalid properties with the reasons. Usually used together with valid?
61
72
  # @return Array for valid properties with the reasons
62
73
  def list_invalid_properties
63
74
  invalid_properties = Array.new
64
- return invalid_properties
75
+ invalid_properties
65
76
  end
66
77
 
67
78
  # Check to see if the all the properties in the model are valid
68
79
  # @return true if the model is valid
69
80
  def valid?
70
- return true
81
+ true
71
82
  end
72
83
 
73
84
  # Checks equality by comparing each attribute.
@@ -86,22 +97,29 @@ module DyspatchClient
86
97
  end
87
98
 
88
99
  # Calculates hash code according to all attributes.
89
- # @return [Fixnum] Hash code
100
+ # @return [Integer] Hash code
90
101
  def hash
91
102
  [cursor, data].hash
92
103
  end
93
104
 
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def self.build_from_hash(attributes)
109
+ new.build_from_hash(attributes)
110
+ end
111
+
94
112
  # Builds the object from hash
95
113
  # @param [Hash] attributes Model attributes in the form of hash
96
114
  # @return [Object] Returns the model itself
97
115
  def build_from_hash(attributes)
98
116
  return nil unless attributes.is_a?(Hash)
99
- self.class.swagger_types.each_pair do |key, type|
117
+ self.class.openapi_types.each_pair do |key, type|
100
118
  if type =~ /\AArray<(.*)>/i
101
- # check to ensure the input is an array given that the the attribute
119
+ # check to ensure the input is an array given that the attribute
102
120
  # is documented as an array but the input is not
103
121
  if attributes[self.class.attribute_map[key]].is_a?(Array)
104
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
105
123
  end
106
124
  elsif !attributes[self.class.attribute_map[key]].nil?
107
125
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -127,7 +145,7 @@ module DyspatchClient
127
145
  value.to_i
128
146
  when :Float
129
147
  value.to_f
130
- when :BOOLEAN
148
+ when :Boolean
131
149
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
132
150
  true
133
151
  else
@@ -148,8 +166,7 @@ module DyspatchClient
148
166
  end
149
167
  end
150
168
  else # model
151
- temp_model = DyspatchClient.const_get(type).new
152
- temp_model.build_from_hash(value)
169
+ DyspatchClient.const_get(type).build_from_hash(value)
153
170
  end
154
171
  end
155
172
 
@@ -171,7 +188,11 @@ module DyspatchClient
171
188
  hash = {}
172
189
  self.class.attribute_map.each_pair do |attr, param|
173
190
  value = self.send(attr)
174
- next if value.nil?
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
175
196
  hash[param] = _to_hash(value)
176
197
  end
177
198
  hash
@@ -183,7 +204,7 @@ module DyspatchClient
183
204
  # @return [Hash] Returns the value in the form of hash
184
205
  def _to_hash(value)
185
206
  if value.is_a?(Array)
186
- value.compact.map{ |v| _to_hash(v) }
207
+ value.compact.map { |v| _to_hash(v) }
187
208
  elsif value.is_a?(Hash)
188
209
  {}.tap do |hash|
189
210
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -194,7 +215,5 @@ module DyspatchClient
194
215
  value
195
216
  end
196
217
  end
197
-
198
218
  end
199
-
200
219
  end