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.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +35 -41
- data/Rakefile +2 -0
- data/docs/APIError.md +13 -2
- data/docs/CompiledRead.md +13 -0
- data/docs/Cursor.md +11 -1
- data/docs/DraftMetaRead.md +15 -0
- data/docs/DraftRead.md +17 -1
- data/docs/DraftsApi.md +140 -133
- data/docs/DraftsRead.md +11 -1
- data/docs/{Body.md → InlineObject.md} +10 -1
- data/docs/LocalizationKeyRead.md +10 -0
- data/docs/LocalizationMetaRead.md +14 -3
- data/docs/LocalizationRead.md +17 -1
- data/docs/LocalizationsApi.md +14 -13
- data/docs/TemplateMetaRead.md +16 -1
- data/docs/TemplateRead.md +17 -1
- data/docs/TemplatesApi.md +40 -36
- data/docs/TemplatesRead.md +11 -1
- data/dyspatch_client.gemspec +5 -11
- data/lib/dyspatch_client.rb +5 -19
- data/lib/dyspatch_client/api/drafts_api.rb +372 -236
- data/lib/dyspatch_client/api/localizations_api.rb +47 -30
- data/lib/dyspatch_client/api/templates_api.rb +98 -64
- data/lib/dyspatch_client/api_client.rb +40 -43
- data/lib/dyspatch_client/api_error.rb +23 -4
- data/lib/dyspatch_client/configuration.rb +48 -9
- data/lib/dyspatch_client/models/api_error.rb +46 -22
- data/lib/dyspatch_client/models/compiled_read.rb +45 -66
- data/lib/dyspatch_client/models/cursor.rb +43 -20
- data/lib/dyspatch_client/models/draft_meta_read.rb +49 -25
- data/lib/dyspatch_client/models/draft_read.rb +49 -25
- data/lib/dyspatch_client/models/drafts_read.rb +41 -17
- data/lib/dyspatch_client/models/{body.rb → inline_object.rb} +40 -17
- data/lib/dyspatch_client/models/localization_key_read.rb +41 -17
- data/lib/dyspatch_client/models/localization_meta_read.rb +53 -39
- data/lib/dyspatch_client/models/localization_read.rb +50 -26
- data/lib/dyspatch_client/models/template_meta_read.rb +48 -24
- data/lib/dyspatch_client/models/template_read.rb +49 -25
- data/lib/dyspatch_client/models/templates_read.rb +41 -17
- data/lib/dyspatch_client/version.rb +5 -5
- data/spec/api/drafts_api_spec.rb +61 -53
- data/spec/api/localizations_api_spec.rb +11 -10
- data/spec/api/templates_api_spec.rb +22 -20
- data/spec/api_client_spec.rb +5 -5
- data/spec/configuration_spec.rb +12 -14
- data/spec/integration_spec.rb +41 -0
- data/spec/models/api_error_spec.rb +6 -6
- data/spec/models/compiled_read_spec.rb +5 -5
- data/spec/models/cursor_spec.rb +5 -5
- data/spec/models/draft_meta_read_spec.rb +5 -5
- data/spec/models/draft_read_spec.rb +5 -5
- data/spec/models/drafts_read_spec.rb +5 -5
- data/spec/models/inline_object_spec.rb +41 -0
- data/spec/models/localization_key_read_spec.rb +5 -5
- data/spec/models/localization_meta_read_spec.rb +6 -12
- data/spec/models/localization_read_spec.rb +5 -5
- data/spec/models/template_meta_read_spec.rb +5 -5
- data/spec/models/template_read_spec.rb +5 -5
- data/spec/models/templates_read_spec.rb +5 -5
- data/spec/spec_helper.rb +4 -4
- metadata +15 -190
- data/docs/CreatedAt.md +0 -7
- data/docs/DraftDescription.md +0 -7
- data/docs/DraftId.md +0 -7
- data/docs/DraftName.md +0 -7
- data/docs/DraftUrl.md +0 -7
- data/docs/LanguageId.md +0 -7
- data/docs/LocalizationId.md +0 -7
- data/docs/LocalizationName.md +0 -7
- data/docs/LocalizationUrl.md +0 -7
- data/docs/TemplateDescription.md +0 -7
- data/docs/TemplateId.md +0 -7
- data/docs/TemplateName.md +0 -7
- data/docs/TemplateUrl.md +0 -7
- data/docs/UpdatedAt.md +0 -7
- data/git_push.sh +0 -55
- data/lib/dyspatch_client/models/created_at.rb +0 -175
- data/lib/dyspatch_client/models/draft_description.rb +0 -175
- data/lib/dyspatch_client/models/draft_id.rb +0 -175
- data/lib/dyspatch_client/models/draft_name.rb +0 -175
- data/lib/dyspatch_client/models/draft_url.rb +0 -175
- data/lib/dyspatch_client/models/language_id.rb +0 -175
- data/lib/dyspatch_client/models/localization_id.rb +0 -175
- data/lib/dyspatch_client/models/localization_name.rb +0 -175
- data/lib/dyspatch_client/models/localization_url.rb +0 -175
- data/lib/dyspatch_client/models/template_description.rb +0 -175
- data/lib/dyspatch_client/models/template_id.rb +0 -175
- data/lib/dyspatch_client/models/template_name.rb +0 -175
- data/lib/dyspatch_client/models/template_url.rb +0 -175
- data/lib/dyspatch_client/models/updated_at.rb +0 -175
- data/spec/models/body_spec.rb +0 -41
- data/spec/models/created_at_spec.rb +0 -35
- data/spec/models/draft_description_spec.rb +0 -35
- data/spec/models/draft_id_spec.rb +0 -35
- data/spec/models/draft_name_spec.rb +0 -35
- data/spec/models/draft_url_spec.rb +0 -35
- data/spec/models/language_id_spec.rb +0 -35
- data/spec/models/localization_id_spec.rb +0 -35
- data/spec/models/localization_name_spec.rb +0 -35
- data/spec/models/localization_url_spec.rb +0 -35
- data/spec/models/template_description_spec.rb +0 -35
- data/spec/models/template_id_spec.rb +0 -35
- data/spec/models/template_name_spec.rb +0 -35
- data/spec/models/template_url_spec.rb +0 -35
- 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
|
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
|
6
|
+
The version of the OpenAPI document: 2019.10
|
7
7
|
Contact: support@dyspatch.io
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.3-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -34,5 +34,24 @@ module DyspatchClient
|
|
34
34
|
super arg
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
# Override to_s to display a friendly error message
|
39
|
+
def to_s
|
40
|
+
message
|
41
|
+
end
|
42
|
+
|
43
|
+
def message
|
44
|
+
if @message.nil?
|
45
|
+
msg = "Error message: the server returns an error"
|
46
|
+
else
|
47
|
+
msg = @message
|
48
|
+
end
|
49
|
+
|
50
|
+
msg += "\nHTTP status code: #{code}" if code
|
51
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
52
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
53
|
+
|
54
|
+
msg
|
55
|
+
end
|
37
56
|
end
|
38
57
|
end
|
@@ -1,17 +1,15 @@
|
|
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
|
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
|
6
|
+
The version of the OpenAPI document: 2019.10
|
7
7
|
Contact: support@dyspatch.io
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.2.3-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require 'uri'
|
14
|
-
|
15
13
|
module DyspatchClient
|
16
14
|
class Configuration
|
17
15
|
# Defines url scheme
|
@@ -130,7 +128,7 @@ module DyspatchClient
|
|
130
128
|
def initialize
|
131
129
|
@scheme = 'https'
|
132
130
|
@host = 'api.dyspatch.io'
|
133
|
-
@base_path = '
|
131
|
+
@base_path = ''
|
134
132
|
@api_key = {}
|
135
133
|
@api_key_prefix = {}
|
136
134
|
@timeout = 0
|
@@ -174,8 +172,7 @@ module DyspatchClient
|
|
174
172
|
end
|
175
173
|
|
176
174
|
def base_url
|
177
|
-
|
178
|
-
URI.encode(url)
|
175
|
+
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
179
176
|
end
|
180
177
|
|
181
178
|
# Gets API key (with prefix if set).
|
@@ -205,5 +202,47 @@ module DyspatchClient
|
|
205
202
|
},
|
206
203
|
}
|
207
204
|
end
|
205
|
+
|
206
|
+
# Returns an array of Server setting
|
207
|
+
def server_settings
|
208
|
+
[
|
209
|
+
{
|
210
|
+
url: "https://api.dyspatch.io",
|
211
|
+
description: "No description provided",
|
212
|
+
}
|
213
|
+
]
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns URL based on server settings
|
217
|
+
#
|
218
|
+
# @param index array index of the server settings
|
219
|
+
# @param variables hash of variable and the corresponding value
|
220
|
+
def server_url(index, variables = {})
|
221
|
+
servers = server_settings
|
222
|
+
|
223
|
+
# check array index out of bound
|
224
|
+
if (index < 0 || index >= servers.size)
|
225
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
226
|
+
end
|
227
|
+
|
228
|
+
server = servers[index]
|
229
|
+
url = server[:url]
|
230
|
+
|
231
|
+
# go through variable and assign a value
|
232
|
+
server[:variables].each do |name, variable|
|
233
|
+
if variables.key?(name)
|
234
|
+
if (server[:variables][name][:enum_values].include? variables[name])
|
235
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
236
|
+
else
|
237
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
238
|
+
end
|
239
|
+
else
|
240
|
+
# use default value
|
241
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
url
|
246
|
+
end
|
208
247
|
end
|
209
248
|
end
|
@@ -1,20 +1,21 @@
|
|
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
|
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
|
6
|
+
The version of the OpenAPI document: 2019.10
|
7
7
|
Contact: support@dyspatch.io
|
8
|
-
Generated by: https://
|
9
|
-
|
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
|
+
# possible errors from the api
|
16
17
|
class APIError
|
17
|
-
# Error code: * server_error - Internal server error. * invalid_parameter - Validation error, parameter will contain invalid field and message will contain the reason. * invalid_body - Body could not be parsed, message will contain the reason. * invalid_request - Validation error, the protocol used to make the request was not https. * unauthorized - Credentials were found but permissions were not sufficient. * unauthenticated - Credentials were not found or were not valid. * not_found - The requested resource was not found. * rate_limited - The request was refused because a rate limit was exceeded. There is an account wide rate limit of 3600 requests per-minute, although that is subject to change. The current remaining rate limit can be viewed by checking the X-Ratelimit-Remaining header.
|
18
|
+
# Error code: * server_error - Internal server error. * invalid_parameter - Validation error, parameter will contain invalid field and message will contain the reason. * invalid_body - Body could not be parsed, message will contain the reason. * invalid_request - Validation error, the protocol used to make the request was not https. * unauthorized - Credentials were found but permissions were not sufficient. * unauthenticated - Credentials were not found or were not valid. * not_found - The requested resource was not found. * rate_limited - The request was refused because a rate limit was exceeded. There is an account wide rate limit of 3600 requests per-minute, although that is subject to change. The current remaining rate limit can be viewed by checking the X-Ratelimit-Remaining header. * prohibited_action - The request was refused because an action was not valid for the requested resource. Typically this will happen if you try to make changes to a locked resource.
|
18
19
|
attr_accessor :code
|
19
20
|
|
20
21
|
# Human readable error message
|
@@ -55,7 +56,7 @@ module DyspatchClient
|
|
55
56
|
end
|
56
57
|
|
57
58
|
# Attribute type mapping.
|
58
|
-
def self.
|
59
|
+
def self.openapi_types
|
59
60
|
{
|
60
61
|
:'code' => :'String',
|
61
62
|
:'message' => :'String',
|
@@ -63,23 +64,36 @@ module DyspatchClient
|
|
63
64
|
}
|
64
65
|
end
|
65
66
|
|
67
|
+
# List of attributes with nullable: true
|
68
|
+
def self.openapi_nullable
|
69
|
+
Set.new([
|
70
|
+
])
|
71
|
+
end
|
72
|
+
|
66
73
|
# Initializes the object
|
67
74
|
# @param [Hash] attributes Model attributes in the form of hash
|
68
75
|
def initialize(attributes = {})
|
69
|
-
|
76
|
+
if (!attributes.is_a?(Hash))
|
77
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::APIError` initialize method"
|
78
|
+
end
|
70
79
|
|
71
|
-
# convert string to symbol for hash key
|
72
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
82
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::APIError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
84
|
+
end
|
85
|
+
h[k.to_sym] = v
|
86
|
+
}
|
73
87
|
|
74
|
-
if attributes.
|
88
|
+
if attributes.key?(:'code')
|
75
89
|
self.code = attributes[:'code']
|
76
90
|
end
|
77
91
|
|
78
|
-
if attributes.
|
92
|
+
if attributes.key?(:'message')
|
79
93
|
self.message = attributes[:'message']
|
80
94
|
end
|
81
95
|
|
82
|
-
if attributes.
|
96
|
+
if attributes.key?(:'parameter')
|
83
97
|
self.parameter = attributes[:'parameter']
|
84
98
|
end
|
85
99
|
end
|
@@ -94,7 +108,7 @@ module DyspatchClient
|
|
94
108
|
# Check to see if the all the properties in the model are valid
|
95
109
|
# @return true if the model is valid
|
96
110
|
def valid?
|
97
|
-
code_validator = EnumAttributeValidator.new('String', [
|
111
|
+
code_validator = EnumAttributeValidator.new('String', ["server_error", "invalid_parameter", "invalid_body", "invalid_request", "unauthorized", "unauthenticated", "not_found", "rate_limited", "prohibited_action"])
|
98
112
|
return false unless code_validator.valid?(@code)
|
99
113
|
true
|
100
114
|
end
|
@@ -102,9 +116,9 @@ module DyspatchClient
|
|
102
116
|
# Custom attribute writer method checking allowed values (enum).
|
103
117
|
# @param [Object] code Object to be assigned
|
104
118
|
def code=(code)
|
105
|
-
validator = EnumAttributeValidator.new('String', [
|
119
|
+
validator = EnumAttributeValidator.new('String', ["server_error", "invalid_parameter", "invalid_body", "invalid_request", "unauthorized", "unauthenticated", "not_found", "rate_limited", "prohibited_action"])
|
106
120
|
unless validator.valid?(code)
|
107
|
-
fail ArgumentError,
|
121
|
+
fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
|
108
122
|
end
|
109
123
|
@code = code
|
110
124
|
end
|
@@ -126,19 +140,26 @@ module DyspatchClient
|
|
126
140
|
end
|
127
141
|
|
128
142
|
# Calculates hash code according to all attributes.
|
129
|
-
# @return [
|
143
|
+
# @return [Integer] Hash code
|
130
144
|
def hash
|
131
145
|
[code, message, parameter].hash
|
132
146
|
end
|
133
147
|
|
148
|
+
# Builds the object from hash
|
149
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
150
|
+
# @return [Object] Returns the model itself
|
151
|
+
def self.build_from_hash(attributes)
|
152
|
+
new.build_from_hash(attributes)
|
153
|
+
end
|
154
|
+
|
134
155
|
# Builds the object from hash
|
135
156
|
# @param [Hash] attributes Model attributes in the form of hash
|
136
157
|
# @return [Object] Returns the model itself
|
137
158
|
def build_from_hash(attributes)
|
138
159
|
return nil unless attributes.is_a?(Hash)
|
139
|
-
self.class.
|
160
|
+
self.class.openapi_types.each_pair do |key, type|
|
140
161
|
if type =~ /\AArray<(.*)>/i
|
141
|
-
# check to ensure the input is an array given that the
|
162
|
+
# check to ensure the input is an array given that the attribute
|
142
163
|
# is documented as an array but the input is not
|
143
164
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
144
165
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -167,7 +188,7 @@ module DyspatchClient
|
|
167
188
|
value.to_i
|
168
189
|
when :Float
|
169
190
|
value.to_f
|
170
|
-
when :
|
191
|
+
when :Boolean
|
171
192
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
193
|
true
|
173
194
|
else
|
@@ -188,8 +209,7 @@ module DyspatchClient
|
|
188
209
|
end
|
189
210
|
end
|
190
211
|
else # model
|
191
|
-
|
192
|
-
temp_model.build_from_hash(value)
|
212
|
+
DyspatchClient.const_get(type).build_from_hash(value)
|
193
213
|
end
|
194
214
|
end
|
195
215
|
|
@@ -211,7 +231,11 @@ module DyspatchClient
|
|
211
231
|
hash = {}
|
212
232
|
self.class.attribute_map.each_pair do |attr, param|
|
213
233
|
value = self.send(attr)
|
214
|
-
|
234
|
+
if value.nil?
|
235
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
236
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
237
|
+
end
|
238
|
+
|
215
239
|
hash[param] = _to_hash(value)
|
216
240
|
end
|
217
241
|
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
|
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
|
6
|
+
The version of the OpenAPI document: 2019.10
|
7
7
|
Contact: support@dyspatch.io
|
8
|
-
Generated by: https://
|
9
|
-
|
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
|
+
# revision data
|
16
17
|
class CompiledRead
|
17
18
|
# Sender address
|
18
19
|
attr_accessor :sender
|
@@ -41,7 +42,7 @@ module DyspatchClient
|
|
41
42
|
end
|
42
43
|
|
43
44
|
# Attribute type mapping.
|
44
|
-
def self.
|
45
|
+
def self.openapi_types
|
45
46
|
{
|
46
47
|
:'sender' => :'String',
|
47
48
|
:'reply_to' => :'String',
|
@@ -51,31 +52,44 @@ module DyspatchClient
|
|
51
52
|
}
|
52
53
|
end
|
53
54
|
|
55
|
+
# List of attributes with nullable: true
|
56
|
+
def self.openapi_nullable
|
57
|
+
Set.new([
|
58
|
+
])
|
59
|
+
end
|
60
|
+
|
54
61
|
# Initializes the object
|
55
62
|
# @param [Hash] attributes Model attributes in the form of hash
|
56
63
|
def initialize(attributes = {})
|
57
|
-
|
64
|
+
if (!attributes.is_a?(Hash))
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::CompiledRead` initialize method"
|
66
|
+
end
|
58
67
|
|
59
|
-
# convert string to symbol for hash key
|
60
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
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::CompiledRead`. 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
|
+
}
|
61
75
|
|
62
|
-
if attributes.
|
76
|
+
if attributes.key?(:'sender')
|
63
77
|
self.sender = attributes[:'sender']
|
64
78
|
end
|
65
79
|
|
66
|
-
if attributes.
|
67
|
-
self.reply_to = attributes[:'
|
80
|
+
if attributes.key?(:'reply_to')
|
81
|
+
self.reply_to = attributes[:'reply_to']
|
68
82
|
end
|
69
83
|
|
70
|
-
if attributes.
|
84
|
+
if attributes.key?(:'subject')
|
71
85
|
self.subject = attributes[:'subject']
|
72
86
|
end
|
73
87
|
|
74
|
-
if attributes.
|
88
|
+
if attributes.key?(:'html')
|
75
89
|
self.html = attributes[:'html']
|
76
90
|
end
|
77
91
|
|
78
|
-
if attributes.
|
92
|
+
if attributes.key?(:'text')
|
79
93
|
self.text = attributes[:'text']
|
80
94
|
end
|
81
95
|
end
|
@@ -84,60 +98,15 @@ module DyspatchClient
|
|
84
98
|
# @return Array for valid properties with the reasons
|
85
99
|
def list_invalid_properties
|
86
100
|
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
101
|
invalid_properties
|
100
102
|
end
|
101
103
|
|
102
104
|
# Check to see if the all the properties in the model are valid
|
103
105
|
# @return true if the model is valid
|
104
106
|
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
107
|
true
|
109
108
|
end
|
110
109
|
|
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
110
|
# Checks equality by comparing each attribute.
|
142
111
|
# @param [Object] Object to be compared
|
143
112
|
def ==(o)
|
@@ -157,19 +126,26 @@ module DyspatchClient
|
|
157
126
|
end
|
158
127
|
|
159
128
|
# Calculates hash code according to all attributes.
|
160
|
-
# @return [
|
129
|
+
# @return [Integer] Hash code
|
161
130
|
def hash
|
162
131
|
[sender, reply_to, subject, html, text].hash
|
163
132
|
end
|
164
133
|
|
134
|
+
# Builds the object from hash
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
+
# @return [Object] Returns the model itself
|
137
|
+
def self.build_from_hash(attributes)
|
138
|
+
new.build_from_hash(attributes)
|
139
|
+
end
|
140
|
+
|
165
141
|
# Builds the object from hash
|
166
142
|
# @param [Hash] attributes Model attributes in the form of hash
|
167
143
|
# @return [Object] Returns the model itself
|
168
144
|
def build_from_hash(attributes)
|
169
145
|
return nil unless attributes.is_a?(Hash)
|
170
|
-
self.class.
|
146
|
+
self.class.openapi_types.each_pair do |key, type|
|
171
147
|
if type =~ /\AArray<(.*)>/i
|
172
|
-
# check to ensure the input is an array given that the
|
148
|
+
# check to ensure the input is an array given that the attribute
|
173
149
|
# is documented as an array but the input is not
|
174
150
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
151
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
@@ -198,7 +174,7 @@ module DyspatchClient
|
|
198
174
|
value.to_i
|
199
175
|
when :Float
|
200
176
|
value.to_f
|
201
|
-
when :
|
177
|
+
when :Boolean
|
202
178
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
179
|
true
|
204
180
|
else
|
@@ -219,8 +195,7 @@ module DyspatchClient
|
|
219
195
|
end
|
220
196
|
end
|
221
197
|
else # model
|
222
|
-
|
223
|
-
temp_model.build_from_hash(value)
|
198
|
+
DyspatchClient.const_get(type).build_from_hash(value)
|
224
199
|
end
|
225
200
|
end
|
226
201
|
|
@@ -242,7 +217,11 @@ module DyspatchClient
|
|
242
217
|
hash = {}
|
243
218
|
self.class.attribute_map.each_pair do |attr, param|
|
244
219
|
value = self.send(attr)
|
245
|
-
|
220
|
+
if value.nil?
|
221
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
222
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
223
|
+
end
|
224
|
+
|
246
225
|
hash[param] = _to_hash(value)
|
247
226
|
end
|
248
227
|
hash
|