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,90 +1,112 @@
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
+ # localization metadata
17
17
  class LocalizationMetaRead
18
18
  # An opaque, unique identifier for a localization
19
19
  attr_accessor :id
20
20
 
21
- # A language identifier comprised of a language and a country identifier. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/).
22
- attr_accessor :language
23
-
24
21
  # The user-specified name of a localization
25
22
  attr_accessor :name
26
23
 
27
24
  # The API url for a specific localization
28
25
  attr_accessor :url
29
26
 
27
+ # the locale group this localization belongs to, if this field is empty the localization does not belong to any locale group
28
+ attr_accessor :locale_group
29
+
30
+ # a list of locale codes that are available in the localization. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/) for an exhaustive list of locale codes.
31
+ attr_accessor :languages
30
32
 
31
33
  # Attribute mapping from ruby-style variable name to JSON key.
32
34
  def self.attribute_map
33
35
  {
34
36
  :'id' => :'id',
35
- :'language' => :'language',
36
37
  :'name' => :'name',
37
- :'url' => :'url'
38
+ :'url' => :'url',
39
+ :'locale_group' => :'localeGroup',
40
+ :'languages' => :'languages'
38
41
  }
39
42
  end
40
43
 
41
44
  # Attribute type mapping.
42
- def self.swagger_types
45
+ def self.openapi_types
43
46
  {
44
47
  :'id' => :'String',
45
- :'language' => :'String',
46
48
  :'name' => :'String',
47
- :'url' => :'String'
49
+ :'url' => :'String',
50
+ :'locale_group' => :'String',
51
+ :'languages' => :'Array<String>'
48
52
  }
49
53
  end
50
54
 
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
51
61
  # Initializes the object
52
62
  # @param [Hash] attributes Model attributes in the form of hash
53
63
  def initialize(attributes = {})
54
- return unless attributes.is_a?(Hash)
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::LocalizationMetaRead` initialize method"
66
+ end
55
67
 
56
- # convert string to symbol for hash key
57
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::LocalizationMetaRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
58
75
 
59
- if attributes.has_key?(:'id')
76
+ if attributes.key?(:'id')
60
77
  self.id = attributes[:'id']
61
78
  end
62
79
 
63
- if attributes.has_key?(:'language')
64
- self.language = attributes[:'language']
65
- end
66
-
67
- if attributes.has_key?(:'name')
80
+ if attributes.key?(:'name')
68
81
  self.name = attributes[:'name']
69
82
  end
70
83
 
71
- if attributes.has_key?(:'url')
84
+ if attributes.key?(:'url')
72
85
  self.url = attributes[:'url']
73
86
  end
74
87
 
88
+ if attributes.key?(:'locale_group')
89
+ self.locale_group = attributes[:'locale_group']
90
+ end
91
+
92
+ if attributes.key?(:'languages')
93
+ if (value = attributes[:'languages']).is_a?(Array)
94
+ self.languages = value
95
+ end
96
+ end
75
97
  end
76
98
 
77
99
  # Show invalid properties with the reasons. Usually used together with valid?
78
100
  # @return Array for valid properties with the reasons
79
101
  def list_invalid_properties
80
102
  invalid_properties = Array.new
81
- return invalid_properties
103
+ invalid_properties
82
104
  end
83
105
 
84
106
  # Check to see if the all the properties in the model are valid
85
107
  # @return true if the model is valid
86
108
  def valid?
87
- return true
109
+ true
88
110
  end
89
111
 
90
112
  # Checks equality by comparing each attribute.
@@ -93,9 +115,10 @@ module DyspatchClient
93
115
  return true if self.equal?(o)
94
116
  self.class == o.class &&
95
117
  id == o.id &&
96
- language == o.language &&
97
118
  name == o.name &&
98
- url == o.url
119
+ url == o.url &&
120
+ locale_group == o.locale_group &&
121
+ languages == o.languages
99
122
  end
100
123
 
101
124
  # @see the `==` method
@@ -105,9 +128,16 @@ module DyspatchClient
105
128
  end
106
129
 
107
130
  # Calculates hash code according to all attributes.
108
- # @return [Fixnum] Hash code
131
+ # @return [Integer] Hash code
109
132
  def hash
110
- [id, language, name, url].hash
133
+ [id, name, url, locale_group, languages].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ new.build_from_hash(attributes)
111
141
  end
112
142
 
113
143
  # Builds the object from hash
@@ -115,12 +145,12 @@ module DyspatchClient
115
145
  # @return [Object] Returns the model itself
116
146
  def build_from_hash(attributes)
117
147
  return nil unless attributes.is_a?(Hash)
118
- self.class.swagger_types.each_pair do |key, type|
148
+ self.class.openapi_types.each_pair do |key, type|
119
149
  if type =~ /\AArray<(.*)>/i
120
- # check to ensure the input is an array given that the the attribute
150
+ # check to ensure the input is an array given that the attribute
121
151
  # is documented as an array but the input is not
122
152
  if attributes[self.class.attribute_map[key]].is_a?(Array)
123
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
154
  end
125
155
  elsif !attributes[self.class.attribute_map[key]].nil?
126
156
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -146,7 +176,7 @@ module DyspatchClient
146
176
  value.to_i
147
177
  when :Float
148
178
  value.to_f
149
- when :BOOLEAN
179
+ when :Boolean
150
180
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
181
  true
152
182
  else
@@ -167,8 +197,7 @@ module DyspatchClient
167
197
  end
168
198
  end
169
199
  else # model
170
- temp_model = DyspatchClient.const_get(type).new
171
- temp_model.build_from_hash(value)
200
+ DyspatchClient.const_get(type).build_from_hash(value)
172
201
  end
173
202
  end
174
203
 
@@ -190,7 +219,11 @@ module DyspatchClient
190
219
  hash = {}
191
220
  self.class.attribute_map.each_pair do |attr, param|
192
221
  value = self.send(attr)
193
- next if value.nil?
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
194
227
  hash[param] = _to_hash(value)
195
228
  end
196
229
  hash
@@ -202,7 +235,7 @@ module DyspatchClient
202
235
  # @return [Hash] Returns the value in the form of hash
203
236
  def _to_hash(value)
204
237
  if value.is_a?(Array)
205
- value.compact.map{ |v| _to_hash(v) }
238
+ value.compact.map { |v| _to_hash(v) }
206
239
  elsif value.is_a?(Hash)
207
240
  {}.tap do |hash|
208
241
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -213,7 +246,5 @@ module DyspatchClient
213
246
  value
214
247
  end
215
248
  end
216
-
217
249
  end
218
-
219
250
  end
@@ -1,25 +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
+ # localization metadata and latest revision for associated template
17
17
  class LocalizationRead
18
18
  # An opaque, unique identifier for a localization
19
19
  attr_accessor :id
20
20
 
21
- # A language identifier comprised of a language and a country identifier. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/).
22
- attr_accessor :language
21
+ # a list of locale codes that are available in the localization. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/) for an exhaustive list of locale codes.
22
+ attr_accessor :languages
23
23
 
24
24
  # The API url for a specific localization
25
25
  attr_accessor :url
@@ -38,88 +38,110 @@ module DyspatchClient
38
38
  # The user-specified name of a localization
39
39
  attr_accessor :name
40
40
 
41
+ # the locale group this localization belongs to, if this field is empty the localization does not belong to any locale group
42
+ attr_accessor :locale_group
41
43
 
42
44
  # Attribute mapping from ruby-style variable name to JSON key.
43
45
  def self.attribute_map
44
46
  {
45
47
  :'id' => :'id',
46
- :'language' => :'language',
48
+ :'languages' => :'languages',
47
49
  :'url' => :'url',
48
50
  :'template' => :'template',
49
51
  :'compiled' => :'compiled',
50
52
  :'created_at' => :'createdAt',
51
53
  :'updated_at' => :'updatedAt',
52
- :'name' => :'name'
54
+ :'name' => :'name',
55
+ :'locale_group' => :'localeGroup'
53
56
  }
54
57
  end
55
58
 
56
59
  # Attribute type mapping.
57
- def self.swagger_types
60
+ def self.openapi_types
58
61
  {
59
62
  :'id' => :'String',
60
- :'language' => :'String',
63
+ :'languages' => :'Array<String>',
61
64
  :'url' => :'String',
62
65
  :'template' => :'String',
63
66
  :'compiled' => :'CompiledRead',
64
67
  :'created_at' => :'DateTime',
65
68
  :'updated_at' => :'DateTime',
66
- :'name' => :'String'
69
+ :'name' => :'String',
70
+ :'locale_group' => :'String'
67
71
  }
68
72
  end
69
73
 
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
70
80
  # Initializes the object
71
81
  # @param [Hash] attributes Model attributes in the form of hash
72
82
  def initialize(attributes = {})
73
- return unless attributes.is_a?(Hash)
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::LocalizationRead` initialize method"
85
+ end
74
86
 
75
- # convert string to symbol for hash key
76
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::LocalizationRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
77
94
 
78
- if attributes.has_key?(:'id')
95
+ if attributes.key?(:'id')
79
96
  self.id = attributes[:'id']
80
97
  end
81
98
 
82
- if attributes.has_key?(:'language')
83
- self.language = attributes[:'language']
99
+ if attributes.key?(:'languages')
100
+ if (value = attributes[:'languages']).is_a?(Array)
101
+ self.languages = value
102
+ end
84
103
  end
85
104
 
86
- if attributes.has_key?(:'url')
105
+ if attributes.key?(:'url')
87
106
  self.url = attributes[:'url']
88
107
  end
89
108
 
90
- if attributes.has_key?(:'template')
109
+ if attributes.key?(:'template')
91
110
  self.template = attributes[:'template']
92
111
  end
93
112
 
94
- if attributes.has_key?(:'compiled')
113
+ if attributes.key?(:'compiled')
95
114
  self.compiled = attributes[:'compiled']
96
115
  end
97
116
 
98
- if attributes.has_key?(:'createdAt')
99
- self.created_at = attributes[:'createdAt']
117
+ if attributes.key?(:'created_at')
118
+ self.created_at = attributes[:'created_at']
100
119
  end
101
120
 
102
- if attributes.has_key?(:'updatedAt')
103
- self.updated_at = attributes[:'updatedAt']
121
+ if attributes.key?(:'updated_at')
122
+ self.updated_at = attributes[:'updated_at']
104
123
  end
105
124
 
106
- if attributes.has_key?(:'name')
125
+ if attributes.key?(:'name')
107
126
  self.name = attributes[:'name']
108
127
  end
109
128
 
129
+ if attributes.key?(:'locale_group')
130
+ self.locale_group = attributes[:'locale_group']
131
+ end
110
132
  end
111
133
 
112
134
  # Show invalid properties with the reasons. Usually used together with valid?
113
135
  # @return Array for valid properties with the reasons
114
136
  def list_invalid_properties
115
137
  invalid_properties = Array.new
116
- return invalid_properties
138
+ invalid_properties
117
139
  end
118
140
 
119
141
  # Check to see if the all the properties in the model are valid
120
142
  # @return true if the model is valid
121
143
  def valid?
122
- return true
144
+ true
123
145
  end
124
146
 
125
147
  # Checks equality by comparing each attribute.
@@ -128,13 +150,14 @@ module DyspatchClient
128
150
  return true if self.equal?(o)
129
151
  self.class == o.class &&
130
152
  id == o.id &&
131
- language == o.language &&
153
+ languages == o.languages &&
132
154
  url == o.url &&
133
155
  template == o.template &&
134
156
  compiled == o.compiled &&
135
157
  created_at == o.created_at &&
136
158
  updated_at == o.updated_at &&
137
- name == o.name
159
+ name == o.name &&
160
+ locale_group == o.locale_group
138
161
  end
139
162
 
140
163
  # @see the `==` method
@@ -144,9 +167,16 @@ module DyspatchClient
144
167
  end
145
168
 
146
169
  # Calculates hash code according to all attributes.
147
- # @return [Fixnum] Hash code
170
+ # @return [Integer] Hash code
148
171
  def hash
149
- [id, language, url, template, compiled, created_at, updated_at, name].hash
172
+ [id, languages, url, template, compiled, created_at, updated_at, name, locale_group].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ new.build_from_hash(attributes)
150
180
  end
151
181
 
152
182
  # Builds the object from hash
@@ -154,12 +184,12 @@ module DyspatchClient
154
184
  # @return [Object] Returns the model itself
155
185
  def build_from_hash(attributes)
156
186
  return nil unless attributes.is_a?(Hash)
157
- self.class.swagger_types.each_pair do |key, type|
187
+ self.class.openapi_types.each_pair do |key, type|
158
188
  if type =~ /\AArray<(.*)>/i
159
- # check to ensure the input is an array given that the the attribute
189
+ # check to ensure the input is an array given that the attribute
160
190
  # is documented as an array but the input is not
161
191
  if attributes[self.class.attribute_map[key]].is_a?(Array)
162
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
192
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
193
  end
164
194
  elsif !attributes[self.class.attribute_map[key]].nil?
165
195
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -185,7 +215,7 @@ module DyspatchClient
185
215
  value.to_i
186
216
  when :Float
187
217
  value.to_f
188
- when :BOOLEAN
218
+ when :Boolean
189
219
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
220
  true
191
221
  else
@@ -206,8 +236,7 @@ module DyspatchClient
206
236
  end
207
237
  end
208
238
  else # model
209
- temp_model = DyspatchClient.const_get(type).new
210
- temp_model.build_from_hash(value)
239
+ DyspatchClient.const_get(type).build_from_hash(value)
211
240
  end
212
241
  end
213
242
 
@@ -229,7 +258,11 @@ module DyspatchClient
229
258
  hash = {}
230
259
  self.class.attribute_map.each_pair do |attr, param|
231
260
  value = self.send(attr)
232
- next if value.nil?
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
233
266
  hash[param] = _to_hash(value)
234
267
  end
235
268
  hash
@@ -241,7 +274,7 @@ module DyspatchClient
241
274
  # @return [Hash] Returns the value in the form of hash
242
275
  def _to_hash(value)
243
276
  if value.is_a?(Array)
244
- value.compact.map{ |v| _to_hash(v) }
277
+ value.compact.map { |v| _to_hash(v) }
245
278
  elsif value.is_a?(Hash)
246
279
  {}.tap do |hash|
247
280
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -252,7 +285,5 @@ module DyspatchClient
252
285
  value
253
286
  end
254
287
  end
255
-
256
288
  end
257
-
258
289
  end