dyspatch_client 2.0.0 → 3.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 +5 -5
- data/README.md +42 -16
- data/docs/APIError.md +1 -1
- data/docs/Body.md +8 -0
- data/docs/Body1.md +8 -0
- data/docs/CreatedAt.md +7 -0
- data/docs/DraftDescription.md +7 -0
- data/docs/DraftId.md +7 -0
- data/docs/DraftMetaRead.md +14 -0
- data/docs/DraftName.md +7 -0
- data/docs/DraftRead.md +15 -0
- data/docs/DraftUrl.md +7 -0
- data/docs/DraftsApi.md +467 -0
- data/docs/DraftsRead.md +9 -0
- data/docs/LanguageId.md +7 -0
- data/docs/LocalizationId.md +7 -0
- data/docs/LocalizationKeyRead.md +9 -0
- data/docs/LocalizationMetaRead.md +1 -0
- data/docs/LocalizationName.md +7 -0
- data/docs/LocalizationUrl.md +7 -0
- data/docs/LocalizationsApi.md +8 -11
- data/docs/TemplateDescription.md +7 -0
- data/docs/TemplateId.md +7 -0
- data/docs/TemplateMetaRead.md +1 -1
- data/docs/TemplateName.md +7 -0
- data/docs/TemplateRead.md +1 -1
- data/docs/TemplateUrl.md +7 -0
- data/docs/TemplatesApi.md +9 -14
- data/docs/TemplatesRead.md +1 -1
- data/docs/UpdatedAt.md +7 -0
- data/dyspatch_client.gemspec +8 -8
- data/lib/dyspatch_client.rb +24 -3
- data/lib/dyspatch_client/api/drafts_api.rb +479 -0
- data/lib/dyspatch_client/api/localizations_api.rb +23 -22
- data/lib/dyspatch_client/api/templates_api.rb +25 -28
- data/lib/dyspatch_client/api_client.rb +11 -11
- data/lib/dyspatch_client/api_error.rb +3 -3
- data/lib/dyspatch_client/configuration.rb +4 -4
- data/lib/dyspatch_client/models/api_error.rb +11 -15
- data/lib/dyspatch_client/models/body.rb +183 -0
- data/lib/dyspatch_client/models/body_1.rb +183 -0
- data/lib/dyspatch_client/models/compiled_read.rb +14 -22
- data/lib/dyspatch_client/models/created_at.rb +175 -0
- data/lib/dyspatch_client/models/cursor.rb +8 -12
- data/lib/dyspatch_client/models/draft_description.rb +175 -0
- data/lib/dyspatch_client/models/draft_id.rb +175 -0
- data/lib/dyspatch_client/models/draft_meta_read.rb +244 -0
- data/lib/dyspatch_client/models/draft_name.rb +175 -0
- data/lib/dyspatch_client/models/draft_read.rb +255 -0
- data/lib/dyspatch_client/models/draft_url.rb +175 -0
- data/lib/dyspatch_client/models/drafts_read.rb +196 -0
- data/lib/dyspatch_client/models/language_id.rb +175 -0
- data/lib/dyspatch_client/models/localization_id.rb +175 -0
- data/lib/dyspatch_client/models/localization_key_read.rb +192 -0
- data/lib/dyspatch_client/models/localization_meta_read.rb +20 -15
- data/lib/dyspatch_client/models/localization_name.rb +175 -0
- data/lib/dyspatch_client/models/localization_read.rb +8 -13
- data/lib/dyspatch_client/models/localization_url.rb +175 -0
- data/lib/dyspatch_client/models/template_description.rb +175 -0
- data/lib/dyspatch_client/models/template_id.rb +175 -0
- data/lib/dyspatch_client/models/template_meta_read.rb +8 -13
- data/lib/dyspatch_client/models/template_name.rb +175 -0
- data/lib/dyspatch_client/models/template_read.rb +8 -13
- data/lib/dyspatch_client/models/template_url.rb +175 -0
- data/lib/dyspatch_client/models/templates_read.rb +8 -13
- data/lib/dyspatch_client/models/updated_at.rb +175 -0
- data/lib/dyspatch_client/version.rb +4 -4
- data/spec/api/drafts_api_spec.rb +138 -0
- data/spec/api/localizations_api_spec.rb +6 -7
- data/spec/api/templates_api_spec.rb +6 -8
- data/spec/api_client_spec.rb +37 -37
- data/spec/configuration_spec.rb +11 -11
- data/spec/models/api_error_spec.rb +10 -11
- data/spec/models/body_1_spec.rb +41 -0
- data/spec/models/body_spec.rb +41 -0
- data/spec/models/compiled_read_spec.rb +8 -9
- data/spec/models/created_at_spec.rb +35 -0
- data/spec/models/cursor_spec.rb +5 -6
- data/spec/models/draft_description_spec.rb +35 -0
- data/spec/models/draft_id_spec.rb +35 -0
- data/spec/models/draft_meta_read_spec.rb +77 -0
- data/spec/models/draft_name_spec.rb +35 -0
- data/spec/models/draft_read_spec.rb +83 -0
- data/spec/models/draft_url_spec.rb +35 -0
- data/spec/models/drafts_read_spec.rb +47 -0
- data/spec/models/language_id_spec.rb +35 -0
- data/spec/models/localization_id_spec.rb +35 -0
- data/spec/models/localization_key_read_spec.rb +47 -0
- data/spec/models/localization_meta_read_spec.rb +13 -8
- data/spec/models/localization_name_spec.rb +35 -0
- data/spec/models/localization_read_spec.rb +11 -12
- data/spec/models/localization_url_spec.rb +35 -0
- data/spec/models/template_description_spec.rb +35 -0
- data/spec/models/template_id_spec.rb +35 -0
- data/spec/models/template_meta_read_spec.rb +10 -11
- data/spec/models/template_name_spec.rb +35 -0
- data/spec/models/template_read_spec.rb +11 -12
- data/spec/models/template_url_spec.rb +35 -0
- data/spec/models/templates_read_spec.rb +5 -6
- data/spec/models/updated_at_spec.rb +35 -0
- data/spec/spec_helper.rb +3 -3
- metadata +106 -22
@@ -0,0 +1,183 @@
|
|
1
|
+
=begin
|
2
|
+
#Dyspatch API
|
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)
|
5
|
+
|
6
|
+
OpenAPI spec version: 2019.10
|
7
|
+
Contact: support@dyspatch.io
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.9
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module DyspatchClient
|
16
|
+
class Body1
|
17
|
+
attr_accessor :name
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'name' => :'name'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.swagger_types
|
28
|
+
{
|
29
|
+
:'name' => :'String'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
return unless attributes.is_a?(Hash)
|
37
|
+
|
38
|
+
# convert string to symbol for hash key
|
39
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
40
|
+
|
41
|
+
if attributes.has_key?(:'name')
|
42
|
+
self.name = attributes[:'name']
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
47
|
+
# @return Array for valid properties with the reasons
|
48
|
+
def list_invalid_properties
|
49
|
+
invalid_properties = Array.new
|
50
|
+
invalid_properties
|
51
|
+
end
|
52
|
+
|
53
|
+
# Check to see if the all the properties in the model are valid
|
54
|
+
# @return true if the model is valid
|
55
|
+
def valid?
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
# Checks equality by comparing each attribute.
|
60
|
+
# @param [Object] Object to be compared
|
61
|
+
def ==(o)
|
62
|
+
return true if self.equal?(o)
|
63
|
+
self.class == o.class &&
|
64
|
+
name == o.name
|
65
|
+
end
|
66
|
+
|
67
|
+
# @see the `==` method
|
68
|
+
# @param [Object] Object to be compared
|
69
|
+
def eql?(o)
|
70
|
+
self == o
|
71
|
+
end
|
72
|
+
|
73
|
+
# Calculates hash code according to all attributes.
|
74
|
+
# @return [Fixnum] Hash code
|
75
|
+
def hash
|
76
|
+
[name].hash
|
77
|
+
end
|
78
|
+
|
79
|
+
# Builds the object from hash
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
81
|
+
# @return [Object] Returns the model itself
|
82
|
+
def build_from_hash(attributes)
|
83
|
+
return nil unless attributes.is_a?(Hash)
|
84
|
+
self.class.swagger_types.each_pair do |key, type|
|
85
|
+
if type =~ /\AArray<(.*)>/i
|
86
|
+
# check to ensure the input is an array given that the the attribute
|
87
|
+
# is documented as an array but the input is not
|
88
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
89
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
90
|
+
end
|
91
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
92
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
93
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
94
|
+
end
|
95
|
+
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
# Deserializes the data based on type
|
100
|
+
# @param string type Data type
|
101
|
+
# @param string value Value to be deserialized
|
102
|
+
# @return [Object] Deserialized data
|
103
|
+
def _deserialize(type, value)
|
104
|
+
case type.to_sym
|
105
|
+
when :DateTime
|
106
|
+
DateTime.parse(value)
|
107
|
+
when :Date
|
108
|
+
Date.parse(value)
|
109
|
+
when :String
|
110
|
+
value.to_s
|
111
|
+
when :Integer
|
112
|
+
value.to_i
|
113
|
+
when :Float
|
114
|
+
value.to_f
|
115
|
+
when :BOOLEAN
|
116
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
117
|
+
true
|
118
|
+
else
|
119
|
+
false
|
120
|
+
end
|
121
|
+
when :Object
|
122
|
+
# generic object (usually a Hash), return directly
|
123
|
+
value
|
124
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
125
|
+
inner_type = Regexp.last_match[:inner_type]
|
126
|
+
value.map { |v| _deserialize(inner_type, v) }
|
127
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
128
|
+
k_type = Regexp.last_match[:k_type]
|
129
|
+
v_type = Regexp.last_match[:v_type]
|
130
|
+
{}.tap do |hash|
|
131
|
+
value.each do |k, v|
|
132
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
else # model
|
136
|
+
temp_model = DyspatchClient.const_get(type).new
|
137
|
+
temp_model.build_from_hash(value)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# Returns the string representation of the object
|
142
|
+
# @return [String] String presentation of the object
|
143
|
+
def to_s
|
144
|
+
to_hash.to_s
|
145
|
+
end
|
146
|
+
|
147
|
+
# to_body is an alias to to_hash (backward compatibility)
|
148
|
+
# @return [Hash] Returns the object in the form of hash
|
149
|
+
def to_body
|
150
|
+
to_hash
|
151
|
+
end
|
152
|
+
|
153
|
+
# Returns the object in the form of hash
|
154
|
+
# @return [Hash] Returns the object in the form of hash
|
155
|
+
def to_hash
|
156
|
+
hash = {}
|
157
|
+
self.class.attribute_map.each_pair do |attr, param|
|
158
|
+
value = self.send(attr)
|
159
|
+
next if value.nil?
|
160
|
+
hash[param] = _to_hash(value)
|
161
|
+
end
|
162
|
+
hash
|
163
|
+
end
|
164
|
+
|
165
|
+
# Outputs non-array value in the form of hash
|
166
|
+
# For object, use to_hash. Otherwise, just return the value
|
167
|
+
# @param [Object] value Any valid value
|
168
|
+
# @return [Hash] Returns the value in the form of hash
|
169
|
+
def _to_hash(value)
|
170
|
+
if value.is_a?(Array)
|
171
|
+
value.compact.map { |v| _to_hash(v) }
|
172
|
+
elsif value.is_a?(Hash)
|
173
|
+
{}.tap do |hash|
|
174
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
175
|
+
end
|
176
|
+
elsif value.respond_to? :to_hash
|
177
|
+
value.to_hash
|
178
|
+
else
|
179
|
+
value
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
@@ -1,19 +1,18 @@
|
|
1
1
|
=begin
|
2
2
|
#Dyspatch API
|
3
3
|
|
4
|
-
## Introduction The Dyspatch API is based on the REST paradigm
|
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)
|
5
5
|
|
6
|
-
OpenAPI spec version: 2019.
|
6
|
+
OpenAPI spec version: 2019.10
|
7
7
|
Contact: support@dyspatch.io
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.9
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module DyspatchClient
|
16
|
-
|
17
16
|
class CompiledRead
|
18
17
|
# Sender address
|
19
18
|
attr_accessor :sender
|
@@ -30,7 +29,6 @@ module DyspatchClient
|
|
30
29
|
# Base64 encoded template text body
|
31
30
|
attr_accessor :text
|
32
31
|
|
33
|
-
|
34
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
35
33
|
def self.attribute_map
|
36
34
|
{
|
@@ -59,7 +57,7 @@ module DyspatchClient
|
|
59
57
|
return unless attributes.is_a?(Hash)
|
60
58
|
|
61
59
|
# convert string to symbol for hash key
|
62
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
60
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
63
61
|
|
64
62
|
if attributes.has_key?(:'sender')
|
65
63
|
self.sender = attributes[:'sender']
|
@@ -80,7 +78,6 @@ module DyspatchClient
|
|
80
78
|
if attributes.has_key?(:'text')
|
81
79
|
self.text = attributes[:'text']
|
82
80
|
end
|
83
|
-
|
84
81
|
end
|
85
82
|
|
86
83
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -88,18 +85,18 @@ module DyspatchClient
|
|
88
85
|
def list_invalid_properties
|
89
86
|
invalid_properties = Array.new
|
90
87
|
if !@subject.nil? && @subject !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
91
|
-
invalid_properties.push(
|
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}=)?$/.')
|
92
89
|
end
|
93
90
|
|
94
91
|
if !@html.nil? && @html !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
95
|
-
invalid_properties.push(
|
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}=)?$/.')
|
96
93
|
end
|
97
94
|
|
98
95
|
if !@text.nil? && @text !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
99
|
-
invalid_properties.push(
|
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}=)?$/.')
|
100
97
|
end
|
101
98
|
|
102
|
-
|
99
|
+
invalid_properties
|
103
100
|
end
|
104
101
|
|
105
102
|
# Check to see if the all the properties in the model are valid
|
@@ -108,15 +105,14 @@ module DyspatchClient
|
|
108
105
|
return false if !@subject.nil? && @subject !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
109
106
|
return false if !@html.nil? && @html !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
110
107
|
return false if !@text.nil? && @text !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
111
|
-
|
108
|
+
true
|
112
109
|
end
|
113
110
|
|
114
111
|
# Custom attribute writer method with validation
|
115
112
|
# @param [Object] subject Value to be assigned
|
116
113
|
def subject=(subject)
|
117
|
-
|
118
114
|
if !subject.nil? && subject !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
119
|
-
fail ArgumentError,
|
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}=)?$/.'
|
120
116
|
end
|
121
117
|
|
122
118
|
@subject = subject
|
@@ -125,9 +121,8 @@ module DyspatchClient
|
|
125
121
|
# Custom attribute writer method with validation
|
126
122
|
# @param [Object] html Value to be assigned
|
127
123
|
def html=(html)
|
128
|
-
|
129
124
|
if !html.nil? && html !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
130
|
-
fail ArgumentError,
|
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}=)?$/.'
|
131
126
|
end
|
132
127
|
|
133
128
|
@html = html
|
@@ -136,9 +131,8 @@ module DyspatchClient
|
|
136
131
|
# Custom attribute writer method with validation
|
137
132
|
# @param [Object] text Value to be assigned
|
138
133
|
def text=(text)
|
139
|
-
|
140
134
|
if !text.nil? && text !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
141
|
-
fail ArgumentError,
|
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}=)?$/.'
|
142
136
|
end
|
143
137
|
|
144
138
|
@text = text
|
@@ -178,7 +172,7 @@ module DyspatchClient
|
|
178
172
|
# check to ensure the input is an array given that the the attribute
|
179
173
|
# is documented as an array but the input is not
|
180
174
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
181
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
175
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
182
176
|
end
|
183
177
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
184
178
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -260,7 +254,7 @@ module DyspatchClient
|
|
260
254
|
# @return [Hash] Returns the value in the form of hash
|
261
255
|
def _to_hash(value)
|
262
256
|
if value.is_a?(Array)
|
263
|
-
value.compact.map{ |v| _to_hash(v) }
|
257
|
+
value.compact.map { |v| _to_hash(v) }
|
264
258
|
elsif value.is_a?(Hash)
|
265
259
|
{}.tap do |hash|
|
266
260
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -271,7 +265,5 @@ module DyspatchClient
|
|
271
265
|
value
|
272
266
|
end
|
273
267
|
end
|
274
|
-
|
275
268
|
end
|
276
|
-
|
277
269
|
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
=begin
|
2
|
+
#Dyspatch API
|
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)
|
5
|
+
|
6
|
+
OpenAPI spec version: 2019.10
|
7
|
+
Contact: support@dyspatch.io
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.9
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module DyspatchClient
|
16
|
+
# The time of initial creation
|
17
|
+
class CreatedAt
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Attribute type mapping.
|
25
|
+
def self.swagger_types
|
26
|
+
{
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Initializes the object
|
31
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
32
|
+
def initialize(attributes = {})
|
33
|
+
return unless attributes.is_a?(Hash)
|
34
|
+
|
35
|
+
# convert string to symbol for hash key
|
36
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
37
|
+
end
|
38
|
+
|
39
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
40
|
+
# @return Array for valid properties with the reasons
|
41
|
+
def list_invalid_properties
|
42
|
+
invalid_properties = Array.new
|
43
|
+
invalid_properties
|
44
|
+
end
|
45
|
+
|
46
|
+
# Check to see if the all the properties in the model are valid
|
47
|
+
# @return true if the model is valid
|
48
|
+
def valid?
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
# Checks equality by comparing each attribute.
|
53
|
+
# @param [Object] Object to be compared
|
54
|
+
def ==(o)
|
55
|
+
return true if self.equal?(o)
|
56
|
+
self.class == o.class
|
57
|
+
end
|
58
|
+
|
59
|
+
# @see the `==` method
|
60
|
+
# @param [Object] Object to be compared
|
61
|
+
def eql?(o)
|
62
|
+
self == o
|
63
|
+
end
|
64
|
+
|
65
|
+
# Calculates hash code according to all attributes.
|
66
|
+
# @return [Fixnum] Hash code
|
67
|
+
def hash
|
68
|
+
[].hash
|
69
|
+
end
|
70
|
+
|
71
|
+
# Builds the object from hash
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
# @return [Object] Returns the model itself
|
74
|
+
def build_from_hash(attributes)
|
75
|
+
return nil unless attributes.is_a?(Hash)
|
76
|
+
self.class.swagger_types.each_pair do |key, type|
|
77
|
+
if type =~ /\AArray<(.*)>/i
|
78
|
+
# check to ensure the input is an array given that the the attribute
|
79
|
+
# is documented as an array but the input is not
|
80
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
81
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
82
|
+
end
|
83
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
84
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
85
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
86
|
+
end
|
87
|
+
|
88
|
+
self
|
89
|
+
end
|
90
|
+
|
91
|
+
# Deserializes the data based on type
|
92
|
+
# @param string type Data type
|
93
|
+
# @param string value Value to be deserialized
|
94
|
+
# @return [Object] Deserialized data
|
95
|
+
def _deserialize(type, value)
|
96
|
+
case type.to_sym
|
97
|
+
when :DateTime
|
98
|
+
DateTime.parse(value)
|
99
|
+
when :Date
|
100
|
+
Date.parse(value)
|
101
|
+
when :String
|
102
|
+
value.to_s
|
103
|
+
when :Integer
|
104
|
+
value.to_i
|
105
|
+
when :Float
|
106
|
+
value.to_f
|
107
|
+
when :BOOLEAN
|
108
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
109
|
+
true
|
110
|
+
else
|
111
|
+
false
|
112
|
+
end
|
113
|
+
when :Object
|
114
|
+
# generic object (usually a Hash), return directly
|
115
|
+
value
|
116
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
117
|
+
inner_type = Regexp.last_match[:inner_type]
|
118
|
+
value.map { |v| _deserialize(inner_type, v) }
|
119
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
120
|
+
k_type = Regexp.last_match[:k_type]
|
121
|
+
v_type = Regexp.last_match[:v_type]
|
122
|
+
{}.tap do |hash|
|
123
|
+
value.each do |k, v|
|
124
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
else # model
|
128
|
+
temp_model = DyspatchClient.const_get(type).new
|
129
|
+
temp_model.build_from_hash(value)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Returns the string representation of the object
|
134
|
+
# @return [String] String presentation of the object
|
135
|
+
def to_s
|
136
|
+
to_hash.to_s
|
137
|
+
end
|
138
|
+
|
139
|
+
# to_body is an alias to to_hash (backward compatibility)
|
140
|
+
# @return [Hash] Returns the object in the form of hash
|
141
|
+
def to_body
|
142
|
+
to_hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the object in the form of hash
|
146
|
+
# @return [Hash] Returns the object in the form of hash
|
147
|
+
def to_hash
|
148
|
+
hash = {}
|
149
|
+
self.class.attribute_map.each_pair do |attr, param|
|
150
|
+
value = self.send(attr)
|
151
|
+
next if value.nil?
|
152
|
+
hash[param] = _to_hash(value)
|
153
|
+
end
|
154
|
+
hash
|
155
|
+
end
|
156
|
+
|
157
|
+
# Outputs non-array value in the form of hash
|
158
|
+
# For object, use to_hash. Otherwise, just return the value
|
159
|
+
# @param [Object] value Any valid value
|
160
|
+
# @return [Hash] Returns the value in the form of hash
|
161
|
+
def _to_hash(value)
|
162
|
+
if value.is_a?(Array)
|
163
|
+
value.compact.map { |v| _to_hash(v) }
|
164
|
+
elsif value.is_a?(Hash)
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
167
|
+
end
|
168
|
+
elsif value.respond_to? :to_hash
|
169
|
+
value.to_hash
|
170
|
+
else
|
171
|
+
value
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|