dyspatch_client 3.0.1 → 4.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/README.md +35 -41
  4. data/Rakefile +2 -0
  5. data/docs/APIError.md +13 -2
  6. data/docs/CompiledRead.md +13 -0
  7. data/docs/Cursor.md +11 -1
  8. data/docs/DraftMetaRead.md +15 -0
  9. data/docs/DraftRead.md +17 -1
  10. data/docs/DraftsApi.md +140 -133
  11. data/docs/DraftsRead.md +11 -1
  12. data/docs/{Body.md → InlineObject.md} +10 -1
  13. data/docs/LocalizationKeyRead.md +10 -0
  14. data/docs/LocalizationMetaRead.md +14 -3
  15. data/docs/LocalizationRead.md +17 -1
  16. data/docs/LocalizationsApi.md +14 -13
  17. data/docs/TemplateMetaRead.md +16 -1
  18. data/docs/TemplateRead.md +17 -1
  19. data/docs/TemplatesApi.md +40 -36
  20. data/docs/TemplatesRead.md +11 -1
  21. data/dyspatch_client.gemspec +5 -11
  22. data/lib/dyspatch_client.rb +5 -19
  23. data/lib/dyspatch_client/api/drafts_api.rb +372 -236
  24. data/lib/dyspatch_client/api/localizations_api.rb +47 -30
  25. data/lib/dyspatch_client/api/templates_api.rb +98 -64
  26. data/lib/dyspatch_client/api_client.rb +40 -43
  27. data/lib/dyspatch_client/api_error.rb +23 -4
  28. data/lib/dyspatch_client/configuration.rb +48 -9
  29. data/lib/dyspatch_client/models/api_error.rb +46 -22
  30. data/lib/dyspatch_client/models/compiled_read.rb +45 -66
  31. data/lib/dyspatch_client/models/cursor.rb +43 -20
  32. data/lib/dyspatch_client/models/draft_meta_read.rb +49 -25
  33. data/lib/dyspatch_client/models/draft_read.rb +49 -25
  34. data/lib/dyspatch_client/models/drafts_read.rb +41 -17
  35. data/lib/dyspatch_client/models/{body.rb → inline_object.rb} +40 -17
  36. data/lib/dyspatch_client/models/localization_key_read.rb +41 -17
  37. data/lib/dyspatch_client/models/localization_meta_read.rb +53 -39
  38. data/lib/dyspatch_client/models/localization_read.rb +50 -26
  39. data/lib/dyspatch_client/models/template_meta_read.rb +48 -24
  40. data/lib/dyspatch_client/models/template_read.rb +49 -25
  41. data/lib/dyspatch_client/models/templates_read.rb +41 -17
  42. data/lib/dyspatch_client/version.rb +5 -5
  43. data/spec/api/drafts_api_spec.rb +61 -53
  44. data/spec/api/localizations_api_spec.rb +11 -10
  45. data/spec/api/templates_api_spec.rb +22 -20
  46. data/spec/api_client_spec.rb +5 -5
  47. data/spec/configuration_spec.rb +12 -14
  48. data/spec/integration_spec.rb +41 -0
  49. data/spec/models/api_error_spec.rb +6 -6
  50. data/spec/models/compiled_read_spec.rb +5 -5
  51. data/spec/models/cursor_spec.rb +5 -5
  52. data/spec/models/draft_meta_read_spec.rb +5 -5
  53. data/spec/models/draft_read_spec.rb +5 -5
  54. data/spec/models/drafts_read_spec.rb +5 -5
  55. data/spec/models/inline_object_spec.rb +41 -0
  56. data/spec/models/localization_key_read_spec.rb +5 -5
  57. data/spec/models/localization_meta_read_spec.rb +6 -12
  58. data/spec/models/localization_read_spec.rb +5 -5
  59. data/spec/models/template_meta_read_spec.rb +5 -5
  60. data/spec/models/template_read_spec.rb +5 -5
  61. data/spec/models/templates_read_spec.rb +5 -5
  62. data/spec/spec_helper.rb +4 -4
  63. metadata +15 -190
  64. data/docs/CreatedAt.md +0 -7
  65. data/docs/DraftDescription.md +0 -7
  66. data/docs/DraftId.md +0 -7
  67. data/docs/DraftName.md +0 -7
  68. data/docs/DraftUrl.md +0 -7
  69. data/docs/LanguageId.md +0 -7
  70. data/docs/LocalizationId.md +0 -7
  71. data/docs/LocalizationName.md +0 -7
  72. data/docs/LocalizationUrl.md +0 -7
  73. data/docs/TemplateDescription.md +0 -7
  74. data/docs/TemplateId.md +0 -7
  75. data/docs/TemplateName.md +0 -7
  76. data/docs/TemplateUrl.md +0 -7
  77. data/docs/UpdatedAt.md +0 -7
  78. data/git_push.sh +0 -55
  79. data/lib/dyspatch_client/models/created_at.rb +0 -175
  80. data/lib/dyspatch_client/models/draft_description.rb +0 -175
  81. data/lib/dyspatch_client/models/draft_id.rb +0 -175
  82. data/lib/dyspatch_client/models/draft_name.rb +0 -175
  83. data/lib/dyspatch_client/models/draft_url.rb +0 -175
  84. data/lib/dyspatch_client/models/language_id.rb +0 -175
  85. data/lib/dyspatch_client/models/localization_id.rb +0 -175
  86. data/lib/dyspatch_client/models/localization_name.rb +0 -175
  87. data/lib/dyspatch_client/models/localization_url.rb +0 -175
  88. data/lib/dyspatch_client/models/template_description.rb +0 -175
  89. data/lib/dyspatch_client/models/template_id.rb +0 -175
  90. data/lib/dyspatch_client/models/template_name.rb +0 -175
  91. data/lib/dyspatch_client/models/template_url.rb +0 -175
  92. data/lib/dyspatch_client/models/updated_at.rb +0 -175
  93. data/spec/models/body_spec.rb +0 -41
  94. data/spec/models/created_at_spec.rb +0 -35
  95. data/spec/models/draft_description_spec.rb +0 -35
  96. data/spec/models/draft_id_spec.rb +0 -35
  97. data/spec/models/draft_name_spec.rb +0 -35
  98. data/spec/models/draft_url_spec.rb +0 -35
  99. data/spec/models/language_id_spec.rb +0 -35
  100. data/spec/models/localization_id_spec.rb +0 -35
  101. data/spec/models/localization_name_spec.rb +0 -35
  102. data/spec/models/localization_url_spec.rb +0 -35
  103. data/spec/models/template_description_spec.rb +0 -35
  104. data/spec/models/template_id_spec.rb +0 -35
  105. data/spec/models/template_name_spec.rb +0 -35
  106. data/spec/models/template_url_spec.rb +0 -35
  107. data/spec/models/updated_at_spec.rb +0 -35
@@ -1,12 +1,12 @@
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 the following 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.10
6
+ The version of the OpenAPI document: 2019.10
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.10
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -30,27 +30,40 @@ module DyspatchClient
30
30
  end
31
31
 
32
32
  # Attribute type mapping.
33
- def self.swagger_types
33
+ def self.openapi_types
34
34
  {
35
35
  :'_next' => :'String',
36
- :'has_more' => :'BOOLEAN'
36
+ :'has_more' => :'Boolean'
37
37
  }
38
38
  end
39
39
 
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
40
46
  # Initializes the object
41
47
  # @param [Hash] attributes Model attributes in the form of hash
42
48
  def initialize(attributes = {})
43
- return unless attributes.is_a?(Hash)
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::Cursor` initialize method"
51
+ end
44
52
 
45
- # convert string to symbol for hash key
46
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::Cursor`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
47
60
 
48
- if attributes.has_key?(:'next')
49
- self._next = attributes[:'next']
61
+ if attributes.key?(:'_next')
62
+ self._next = attributes[:'_next']
50
63
  end
51
64
 
52
- if attributes.has_key?(:'hasMore')
53
- self.has_more = attributes[:'hasMore']
65
+ if attributes.key?(:'has_more')
66
+ self.has_more = attributes[:'has_more']
54
67
  end
55
68
  end
56
69
 
@@ -83,19 +96,26 @@ module DyspatchClient
83
96
  end
84
97
 
85
98
  # Calculates hash code according to all attributes.
86
- # @return [Fixnum] Hash code
99
+ # @return [Integer] Hash code
87
100
  def hash
88
101
  [_next, has_more].hash
89
102
  end
90
103
 
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
91
111
  # Builds the object from hash
92
112
  # @param [Hash] attributes Model attributes in the form of hash
93
113
  # @return [Object] Returns the model itself
94
114
  def build_from_hash(attributes)
95
115
  return nil unless attributes.is_a?(Hash)
96
- self.class.swagger_types.each_pair do |key, type|
116
+ self.class.openapi_types.each_pair do |key, type|
97
117
  if type =~ /\AArray<(.*)>/i
98
- # check to ensure the input is an array given that the the attribute
118
+ # check to ensure the input is an array given that the attribute
99
119
  # is documented as an array but the input is not
100
120
  if attributes[self.class.attribute_map[key]].is_a?(Array)
101
121
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -124,7 +144,7 @@ module DyspatchClient
124
144
  value.to_i
125
145
  when :Float
126
146
  value.to_f
127
- when :BOOLEAN
147
+ when :Boolean
128
148
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
149
  true
130
150
  else
@@ -145,8 +165,7 @@ module DyspatchClient
145
165
  end
146
166
  end
147
167
  else # model
148
- temp_model = DyspatchClient.const_get(type).new
149
- temp_model.build_from_hash(value)
168
+ DyspatchClient.const_get(type).build_from_hash(value)
150
169
  end
151
170
  end
152
171
 
@@ -168,7 +187,11 @@ module DyspatchClient
168
187
  hash = {}
169
188
  self.class.attribute_map.each_pair do |attr, param|
170
189
  value = self.send(attr)
171
- next if value.nil?
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
172
195
  hash[param] = _to_hash(value)
173
196
  end
174
197
  hash
@@ -1,18 +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 the following 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.10
6
+ The version of the OpenAPI document: 2019.10
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.10
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
+ # draft metadata
16
17
  class DraftMetaRead
17
18
  # An opaque, unique identifier for a draft
18
19
  attr_accessor :id
@@ -49,7 +50,7 @@ module DyspatchClient
49
50
  end
50
51
 
51
52
  # Attribute type mapping.
52
- def self.swagger_types
53
+ def self.openapi_types
53
54
  {
54
55
  :'id' => :'String',
55
56
  :'template_id' => :'String',
@@ -61,40 +62,53 @@ module DyspatchClient
61
62
  }
62
63
  end
63
64
 
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
64
71
  # Initializes the object
65
72
  # @param [Hash] attributes Model attributes in the form of hash
66
73
  def initialize(attributes = {})
67
- 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::DraftMetaRead` initialize method"
76
+ end
68
77
 
69
- # convert string to symbol for hash key
70
- 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::DraftMetaRead`. 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
+ }
71
85
 
72
- if attributes.has_key?(:'id')
86
+ if attributes.key?(:'id')
73
87
  self.id = attributes[:'id']
74
88
  end
75
89
 
76
- if attributes.has_key?(:'templateId')
77
- self.template_id = attributes[:'templateId']
90
+ if attributes.key?(:'template_id')
91
+ self.template_id = attributes[:'template_id']
78
92
  end
79
93
 
80
- if attributes.has_key?(:'name')
94
+ if attributes.key?(:'name')
81
95
  self.name = attributes[:'name']
82
96
  end
83
97
 
84
- if attributes.has_key?(:'description')
98
+ if attributes.key?(:'description')
85
99
  self.description = attributes[:'description']
86
100
  end
87
101
 
88
- if attributes.has_key?(:'url')
102
+ if attributes.key?(:'url')
89
103
  self.url = attributes[:'url']
90
104
  end
91
105
 
92
- if attributes.has_key?(:'createdAt')
93
- self.created_at = attributes[:'createdAt']
106
+ if attributes.key?(:'created_at')
107
+ self.created_at = attributes[:'created_at']
94
108
  end
95
109
 
96
- if attributes.has_key?(:'updatedAt')
97
- self.updated_at = attributes[:'updatedAt']
110
+ if attributes.key?(:'updated_at')
111
+ self.updated_at = attributes[:'updated_at']
98
112
  end
99
113
  end
100
114
 
@@ -132,19 +146,26 @@ module DyspatchClient
132
146
  end
133
147
 
134
148
  # Calculates hash code according to all attributes.
135
- # @return [Fixnum] Hash code
149
+ # @return [Integer] Hash code
136
150
  def hash
137
151
  [id, template_id, name, description, url, created_at, updated_at].hash
138
152
  end
139
153
 
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def self.build_from_hash(attributes)
158
+ new.build_from_hash(attributes)
159
+ end
160
+
140
161
  # Builds the object from hash
141
162
  # @param [Hash] attributes Model attributes in the form of hash
142
163
  # @return [Object] Returns the model itself
143
164
  def build_from_hash(attributes)
144
165
  return nil unless attributes.is_a?(Hash)
145
- self.class.swagger_types.each_pair do |key, type|
166
+ self.class.openapi_types.each_pair do |key, type|
146
167
  if type =~ /\AArray<(.*)>/i
147
- # check to ensure the input is an array given that the the attribute
168
+ # check to ensure the input is an array given that the attribute
148
169
  # is documented as an array but the input is not
149
170
  if attributes[self.class.attribute_map[key]].is_a?(Array)
150
171
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -173,7 +194,7 @@ module DyspatchClient
173
194
  value.to_i
174
195
  when :Float
175
196
  value.to_f
176
- when :BOOLEAN
197
+ when :Boolean
177
198
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
199
  true
179
200
  else
@@ -194,8 +215,7 @@ module DyspatchClient
194
215
  end
195
216
  end
196
217
  else # model
197
- temp_model = DyspatchClient.const_get(type).new
198
- temp_model.build_from_hash(value)
218
+ DyspatchClient.const_get(type).build_from_hash(value)
199
219
  end
200
220
  end
201
221
 
@@ -217,7 +237,11 @@ module DyspatchClient
217
237
  hash = {}
218
238
  self.class.attribute_map.each_pair do |attr, param|
219
239
  value = self.send(attr)
220
- next if value.nil?
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
221
245
  hash[param] = _to_hash(value)
222
246
  end
223
247
  hash
@@ -1,18 +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 the following 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.10
6
+ The version of the OpenAPI document: 2019.10
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.10
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
+ # template draft metadata included latest draft revision
16
17
  class DraftRead
17
18
  # An opaque, unique identifier for a draft
18
19
  attr_accessor :id
@@ -52,7 +53,7 @@ module DyspatchClient
52
53
  end
53
54
 
54
55
  # Attribute type mapping.
55
- def self.swagger_types
56
+ def self.openapi_types
56
57
  {
57
58
  :'id' => :'String',
58
59
  :'template' => :'String',
@@ -65,43 +66,56 @@ module DyspatchClient
65
66
  }
66
67
  end
67
68
 
69
+ # List of attributes with nullable: true
70
+ def self.openapi_nullable
71
+ Set.new([
72
+ ])
73
+ end
74
+
68
75
  # Initializes the object
69
76
  # @param [Hash] attributes Model attributes in the form of hash
70
77
  def initialize(attributes = {})
71
- 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::DraftRead` initialize method"
80
+ end
72
81
 
73
- # convert string to symbol for hash key
74
- 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::DraftRead`. 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
+ }
75
89
 
76
- if attributes.has_key?(:'id')
90
+ if attributes.key?(:'id')
77
91
  self.id = attributes[:'id']
78
92
  end
79
93
 
80
- if attributes.has_key?(:'template')
94
+ if attributes.key?(:'template')
81
95
  self.template = attributes[:'template']
82
96
  end
83
97
 
84
- if attributes.has_key?(:'name')
98
+ if attributes.key?(:'name')
85
99
  self.name = attributes[:'name']
86
100
  end
87
101
 
88
- if attributes.has_key?(:'url')
102
+ if attributes.key?(:'url')
89
103
  self.url = attributes[:'url']
90
104
  end
91
105
 
92
- if attributes.has_key?(:'compiled')
106
+ if attributes.key?(:'compiled')
93
107
  self.compiled = attributes[:'compiled']
94
108
  end
95
109
 
96
- if attributes.has_key?(:'createdAt')
97
- self.created_at = attributes[:'createdAt']
110
+ if attributes.key?(:'created_at')
111
+ self.created_at = attributes[:'created_at']
98
112
  end
99
113
 
100
- if attributes.has_key?(:'updatedAt')
101
- self.updated_at = attributes[:'updatedAt']
114
+ if attributes.key?(:'updated_at')
115
+ self.updated_at = attributes[:'updated_at']
102
116
  end
103
117
 
104
- if attributes.has_key?(:'localizations')
118
+ if attributes.key?(:'localizations')
105
119
  if (value = attributes[:'localizations']).is_a?(Array)
106
120
  self.localizations = value
107
121
  end
@@ -143,19 +157,26 @@ module DyspatchClient
143
157
  end
144
158
 
145
159
  # Calculates hash code according to all attributes.
146
- # @return [Fixnum] Hash code
160
+ # @return [Integer] Hash code
147
161
  def hash
148
162
  [id, template, name, url, compiled, created_at, updated_at, localizations].hash
149
163
  end
150
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
+
151
172
  # Builds the object from hash
152
173
  # @param [Hash] attributes Model attributes in the form of hash
153
174
  # @return [Object] Returns the model itself
154
175
  def build_from_hash(attributes)
155
176
  return nil unless attributes.is_a?(Hash)
156
- self.class.swagger_types.each_pair do |key, type|
177
+ self.class.openapi_types.each_pair do |key, type|
157
178
  if type =~ /\AArray<(.*)>/i
158
- # 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
159
180
  # is documented as an array but the input is not
160
181
  if attributes[self.class.attribute_map[key]].is_a?(Array)
161
182
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -184,7 +205,7 @@ module DyspatchClient
184
205
  value.to_i
185
206
  when :Float
186
207
  value.to_f
187
- when :BOOLEAN
208
+ when :Boolean
188
209
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
210
  true
190
211
  else
@@ -205,8 +226,7 @@ module DyspatchClient
205
226
  end
206
227
  end
207
228
  else # model
208
- temp_model = DyspatchClient.const_get(type).new
209
- temp_model.build_from_hash(value)
229
+ DyspatchClient.const_get(type).build_from_hash(value)
210
230
  end
211
231
  end
212
232
 
@@ -228,7 +248,11 @@ module DyspatchClient
228
248
  hash = {}
229
249
  self.class.attribute_map.each_pair do |attr, param|
230
250
  value = self.send(attr)
231
- 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
+
232
256
  hash[param] = _to_hash(value)
233
257
  end
234
258
  hash
@@ -1,18 +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 the following 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.10
6
+ The version of the OpenAPI document: 2019.10
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.10
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
+ # list of draft metadata
16
17
  class DraftsRead
17
18
  attr_accessor :cursor
18
19
 
@@ -28,26 +29,39 @@ module DyspatchClient
28
29
  end
29
30
 
30
31
  # Attribute type mapping.
31
- def self.swagger_types
32
+ def self.openapi_types
32
33
  {
33
34
  :'cursor' => :'Cursor',
34
35
  :'data' => :'Array<DraftMetaRead>'
35
36
  }
36
37
  end
37
38
 
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
38
45
  # Initializes the object
39
46
  # @param [Hash] attributes Model attributes in the form of hash
40
47
  def initialize(attributes = {})
41
- 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::DraftsRead` initialize method"
50
+ end
42
51
 
43
- # convert string to symbol for hash key
44
- 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::DraftsRead`. 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
+ }
45
59
 
46
- if attributes.has_key?(:'cursor')
60
+ if attributes.key?(:'cursor')
47
61
  self.cursor = attributes[:'cursor']
48
62
  end
49
63
 
50
- if attributes.has_key?(:'data')
64
+ if attributes.key?(:'data')
51
65
  if (value = attributes[:'data']).is_a?(Array)
52
66
  self.data = value
53
67
  end
@@ -83,19 +97,26 @@ module DyspatchClient
83
97
  end
84
98
 
85
99
  # Calculates hash code according to all attributes.
86
- # @return [Fixnum] Hash code
100
+ # @return [Integer] Hash code
87
101
  def hash
88
102
  [cursor, data].hash
89
103
  end
90
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
+
91
112
  # Builds the object from hash
92
113
  # @param [Hash] attributes Model attributes in the form of hash
93
114
  # @return [Object] Returns the model itself
94
115
  def build_from_hash(attributes)
95
116
  return nil unless attributes.is_a?(Hash)
96
- self.class.swagger_types.each_pair do |key, type|
117
+ self.class.openapi_types.each_pair do |key, type|
97
118
  if type =~ /\AArray<(.*)>/i
98
- # 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
99
120
  # is documented as an array but the input is not
100
121
  if attributes[self.class.attribute_map[key]].is_a?(Array)
101
122
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -124,7 +145,7 @@ module DyspatchClient
124
145
  value.to_i
125
146
  when :Float
126
147
  value.to_f
127
- when :BOOLEAN
148
+ when :Boolean
128
149
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
150
  true
130
151
  else
@@ -145,8 +166,7 @@ module DyspatchClient
145
166
  end
146
167
  end
147
168
  else # model
148
- temp_model = DyspatchClient.const_get(type).new
149
- temp_model.build_from_hash(value)
169
+ DyspatchClient.const_get(type).build_from_hash(value)
150
170
  end
151
171
  end
152
172
 
@@ -168,7 +188,11 @@ module DyspatchClient
168
188
  hash = {}
169
189
  self.class.attribute_map.each_pair do |attr, param|
170
190
  value = self.send(attr)
171
- 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
+
172
196
  hash[param] = _to_hash(value)
173
197
  end
174
198
  hash