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