dyspatch_client 1.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 (76) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE +202 -0
  4. data/README.md +130 -0
  5. data/Rakefile +8 -0
  6. data/docs/APIError.md +10 -0
  7. data/docs/CompiledRead.md +12 -0
  8. data/docs/CreatedAt.md +7 -0
  9. data/docs/Cursor.md +9 -0
  10. data/docs/LanguageId.md +7 -0
  11. data/docs/LocalizationId.md +7 -0
  12. data/docs/LocalizationMetaRead.md +11 -0
  13. data/docs/LocalizationName.md +7 -0
  14. data/docs/LocalizationRead.md +15 -0
  15. data/docs/LocalizationUrl.md +7 -0
  16. data/docs/LocalizationsApi.md +66 -0
  17. data/docs/TemplateDescription.md +7 -0
  18. data/docs/TemplateId.md +7 -0
  19. data/docs/TemplateMetaRead.md +14 -0
  20. data/docs/TemplateName.md +7 -0
  21. data/docs/TemplateRead.md +15 -0
  22. data/docs/TemplateUrl.md +7 -0
  23. data/docs/TemplatesApi.md +125 -0
  24. data/docs/TemplatesRead.md +9 -0
  25. data/docs/UpdatedAt.md +7 -0
  26. data/dyspatch_client.gemspec +45 -0
  27. data/git_push.sh +55 -0
  28. data/lib/dyspatch_client.rb +59 -0
  29. data/lib/dyspatch_client/api/localizations_api.rb +83 -0
  30. data/lib/dyspatch_client/api/templates_api.rb +140 -0
  31. data/lib/dyspatch_client/api_client.rb +389 -0
  32. data/lib/dyspatch_client/api_error.rb +38 -0
  33. data/lib/dyspatch_client/configuration.rb +209 -0
  34. data/lib/dyspatch_client/models/api_error.rb +242 -0
  35. data/lib/dyspatch_client/models/compiled_read.rb +277 -0
  36. data/lib/dyspatch_client/models/created_at.rb +179 -0
  37. data/lib/dyspatch_client/models/cursor.rb +199 -0
  38. data/lib/dyspatch_client/models/language_id.rb +179 -0
  39. data/lib/dyspatch_client/models/localization_id.rb +179 -0
  40. data/lib/dyspatch_client/models/localization_meta_read.rb +219 -0
  41. data/lib/dyspatch_client/models/localization_name.rb +179 -0
  42. data/lib/dyspatch_client/models/localization_read.rb +258 -0
  43. data/lib/dyspatch_client/models/localization_url.rb +179 -0
  44. data/lib/dyspatch_client/models/template_description.rb +179 -0
  45. data/lib/dyspatch_client/models/template_id.rb +179 -0
  46. data/lib/dyspatch_client/models/template_meta_read.rb +251 -0
  47. data/lib/dyspatch_client/models/template_name.rb +179 -0
  48. data/lib/dyspatch_client/models/template_read.rb +260 -0
  49. data/lib/dyspatch_client/models/template_url.rb +179 -0
  50. data/lib/dyspatch_client/models/templates_read.rb +200 -0
  51. data/lib/dyspatch_client/models/updated_at.rb +179 -0
  52. data/lib/dyspatch_client/version.rb +15 -0
  53. data/spec/api/localizations_api_spec.rb +48 -0
  54. data/spec/api/templates_api_spec.rb +61 -0
  55. data/spec/api_client_spec.rb +226 -0
  56. data/spec/configuration_spec.rb +42 -0
  57. data/spec/models/api_error_spec.rb +58 -0
  58. data/spec/models/compiled_read_spec.rb +66 -0
  59. data/spec/models/created_at_spec.rb +36 -0
  60. data/spec/models/cursor_spec.rb +48 -0
  61. data/spec/models/language_id_spec.rb +36 -0
  62. data/spec/models/localization_id_spec.rb +36 -0
  63. data/spec/models/localization_meta_read_spec.rb +60 -0
  64. data/spec/models/localization_name_spec.rb +36 -0
  65. data/spec/models/localization_read_spec.rb +84 -0
  66. data/spec/models/localization_url_spec.rb +36 -0
  67. data/spec/models/template_description_spec.rb +36 -0
  68. data/spec/models/template_id_spec.rb +36 -0
  69. data/spec/models/template_meta_read_spec.rb +78 -0
  70. data/spec/models/template_name_spec.rb +36 -0
  71. data/spec/models/template_read_spec.rb +84 -0
  72. data/spec/models/template_url_spec.rb +36 -0
  73. data/spec/models/templates_read_spec.rb +48 -0
  74. data/spec/models/updated_at_spec.rb +36 -0
  75. data/spec/spec_helper.rb +111 -0
  76. metadata +329 -0
@@ -0,0 +1,251 @@
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 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)
5
+
6
+ OpenAPI spec version: 2018.08
7
+ Contact: support@dyspatch.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DyspatchClient
16
+
17
+ class TemplateMetaRead
18
+ # An opaque, unique identifier for a template
19
+ attr_accessor :id
20
+
21
+ # The name of a template
22
+ attr_accessor :name
23
+
24
+ # A description of the template
25
+ attr_accessor :description
26
+
27
+ # The API url for a specific template
28
+ attr_accessor :url
29
+
30
+ # A list of the template's available localization objects
31
+ attr_accessor :localizations
32
+
33
+ # The time of initial creation
34
+ attr_accessor :created_at
35
+
36
+ # The time of last update
37
+ attr_accessor :updated_at
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'id' => :'id',
44
+ :'name' => :'name',
45
+ :'description' => :'description',
46
+ :'url' => :'url',
47
+ :'localizations' => :'localizations',
48
+ :'created_at' => :'createdAt',
49
+ :'updated_at' => :'updatedAt'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'id' => :'String',
57
+ :'name' => :'String',
58
+ :'description' => :'String',
59
+ :'url' => :'String',
60
+ :'localizations' => :'Array<LocalizationMetaRead>',
61
+ :'created_at' => :'DateTime',
62
+ :'updated_at' => :'DateTime'
63
+ }
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ return unless attributes.is_a?(Hash)
70
+
71
+ # convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
73
+
74
+ if attributes.has_key?(:'id')
75
+ self.id = attributes[:'id']
76
+ end
77
+
78
+ if attributes.has_key?(:'name')
79
+ self.name = attributes[:'name']
80
+ end
81
+
82
+ if attributes.has_key?(:'description')
83
+ self.description = attributes[:'description']
84
+ end
85
+
86
+ if attributes.has_key?(:'url')
87
+ self.url = attributes[:'url']
88
+ end
89
+
90
+ if attributes.has_key?(:'localizations')
91
+ if (value = attributes[:'localizations']).is_a?(Array)
92
+ self.localizations = value
93
+ end
94
+ end
95
+
96
+ if attributes.has_key?(:'createdAt')
97
+ self.created_at = attributes[:'createdAt']
98
+ end
99
+
100
+ if attributes.has_key?(:'updatedAt')
101
+ self.updated_at = attributes[:'updatedAt']
102
+ end
103
+
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ return invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ return true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ id == o.id &&
125
+ name == o.name &&
126
+ description == o.description &&
127
+ url == o.url &&
128
+ localizations == o.localizations &&
129
+ created_at == o.created_at &&
130
+ updated_at == o.updated_at
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Fixnum] Hash code
141
+ def hash
142
+ [id, name, description, url, localizations, created_at, updated_at].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ self.class.swagger_types.each_pair do |key, type|
151
+ if type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :DateTime
172
+ DateTime.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :BOOLEAN
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ temp_model = DyspatchClient.const_get(type).new
203
+ temp_model.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ next if value.nil?
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map{ |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+
249
+ end
250
+
251
+ end
@@ -0,0 +1,179 @@
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 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)
5
+
6
+ OpenAPI spec version: 2018.08
7
+ Contact: support@dyspatch.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DyspatchClient
16
+ # The name of a template
17
+ class TemplateName
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ }
29
+ end
30
+
31
+ # Initializes the object
32
+ # @param [Hash] attributes Model attributes in the form of hash
33
+ def initialize(attributes = {})
34
+ return unless attributes.is_a?(Hash)
35
+
36
+ # convert string to symbol for hash key
37
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
38
+
39
+ end
40
+
41
+ # Show invalid properties with the reasons. Usually used together with valid?
42
+ # @return Array for valid properties with the reasons
43
+ def list_invalid_properties
44
+ invalid_properties = Array.new
45
+ return invalid_properties
46
+ end
47
+
48
+ # Check to see if the all the properties in the model are valid
49
+ # @return true if the model is valid
50
+ def valid?
51
+ return true
52
+ end
53
+
54
+ # Checks equality by comparing each attribute.
55
+ # @param [Object] Object to be compared
56
+ def ==(o)
57
+ return true if self.equal?(o)
58
+ self.class == o.class
59
+ end
60
+
61
+ # @see the `==` method
62
+ # @param [Object] Object to be compared
63
+ def eql?(o)
64
+ self == o
65
+ end
66
+
67
+ # Calculates hash code according to all attributes.
68
+ # @return [Fixnum] Hash code
69
+ def hash
70
+ [].hash
71
+ end
72
+
73
+ # Builds the object from hash
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @return [Object] Returns the model itself
76
+ def build_from_hash(attributes)
77
+ return nil unless attributes.is_a?(Hash)
78
+ self.class.swagger_types.each_pair do |key, type|
79
+ if type =~ /\AArray<(.*)>/i
80
+ # check to ensure the input is an array given that the the attribute
81
+ # is documented as an array but the input is not
82
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
83
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
84
+ end
85
+ elsif !attributes[self.class.attribute_map[key]].nil?
86
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
87
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
88
+ end
89
+
90
+ self
91
+ end
92
+
93
+ # Deserializes the data based on type
94
+ # @param string type Data type
95
+ # @param string value Value to be deserialized
96
+ # @return [Object] Deserialized data
97
+ def _deserialize(type, value)
98
+ case type.to_sym
99
+ when :DateTime
100
+ DateTime.parse(value)
101
+ when :Date
102
+ Date.parse(value)
103
+ when :String
104
+ value.to_s
105
+ when :Integer
106
+ value.to_i
107
+ when :Float
108
+ value.to_f
109
+ when :BOOLEAN
110
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
111
+ true
112
+ else
113
+ false
114
+ end
115
+ when :Object
116
+ # generic object (usually a Hash), return directly
117
+ value
118
+ when /\AArray<(?<inner_type>.+)>\z/
119
+ inner_type = Regexp.last_match[:inner_type]
120
+ value.map { |v| _deserialize(inner_type, v) }
121
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
122
+ k_type = Regexp.last_match[:k_type]
123
+ v_type = Regexp.last_match[:v_type]
124
+ {}.tap do |hash|
125
+ value.each do |k, v|
126
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
127
+ end
128
+ end
129
+ else # model
130
+ temp_model = DyspatchClient.const_get(type).new
131
+ temp_model.build_from_hash(value)
132
+ end
133
+ end
134
+
135
+ # Returns the string representation of the object
136
+ # @return [String] String presentation of the object
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # to_body is an alias to to_hash (backward compatibility)
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_body
144
+ to_hash
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ next if value.nil?
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ # Outputs non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ # @param [Object] value Any valid value
162
+ # @return [Hash] Returns the value in the form of hash
163
+ def _to_hash(value)
164
+ if value.is_a?(Array)
165
+ value.compact.map{ |v| _to_hash(v) }
166
+ elsif value.is_a?(Hash)
167
+ {}.tap do |hash|
168
+ value.each { |k, v| hash[k] = _to_hash(v) }
169
+ end
170
+ elsif value.respond_to? :to_hash
171
+ value.to_hash
172
+ else
173
+ value
174
+ end
175
+ end
176
+
177
+ end
178
+
179
+ end
@@ -0,0 +1,260 @@
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 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)
5
+
6
+ OpenAPI spec version: 2018.08
7
+ Contact: support@dyspatch.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DyspatchClient
16
+
17
+ class TemplateRead
18
+ # An opaque, unique identifier for a template
19
+ attr_accessor :id
20
+
21
+ # The name of a template
22
+ attr_accessor :name
23
+
24
+ # A description of the template
25
+ attr_accessor :description
26
+
27
+ # The API url for a specific template
28
+ attr_accessor :url
29
+
30
+ attr_accessor :compiled
31
+
32
+ # The time of initial creation
33
+ attr_accessor :created_at
34
+
35
+ # The time of last update
36
+ attr_accessor :updated_at
37
+
38
+ # A list of the Template's available localizations
39
+ attr_accessor :localizations
40
+
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'id' => :'id',
46
+ :'name' => :'name',
47
+ :'description' => :'description',
48
+ :'url' => :'url',
49
+ :'compiled' => :'compiled',
50
+ :'created_at' => :'createdAt',
51
+ :'updated_at' => :'updatedAt',
52
+ :'localizations' => :'localizations'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'id' => :'String',
60
+ :'name' => :'String',
61
+ :'description' => :'String',
62
+ :'url' => :'String',
63
+ :'compiled' => :'CompiledRead',
64
+ :'created_at' => :'DateTime',
65
+ :'updated_at' => :'DateTime',
66
+ :'localizations' => :'Array<LocalizationMetaRead>'
67
+ }
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ return unless attributes.is_a?(Hash)
74
+
75
+ # convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
77
+
78
+ if attributes.has_key?(:'id')
79
+ self.id = attributes[:'id']
80
+ end
81
+
82
+ if attributes.has_key?(:'name')
83
+ self.name = attributes[:'name']
84
+ end
85
+
86
+ if attributes.has_key?(:'description')
87
+ self.description = attributes[:'description']
88
+ end
89
+
90
+ if attributes.has_key?(:'url')
91
+ self.url = attributes[:'url']
92
+ end
93
+
94
+ if attributes.has_key?(:'compiled')
95
+ self.compiled = attributes[:'compiled']
96
+ end
97
+
98
+ if attributes.has_key?(:'createdAt')
99
+ self.created_at = attributes[:'createdAt']
100
+ end
101
+
102
+ if attributes.has_key?(:'updatedAt')
103
+ self.updated_at = attributes[:'updatedAt']
104
+ end
105
+
106
+ if attributes.has_key?(:'localizations')
107
+ if (value = attributes[:'localizations']).is_a?(Array)
108
+ self.localizations = value
109
+ end
110
+ end
111
+
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properties with the reasons
116
+ def list_invalid_properties
117
+ invalid_properties = Array.new
118
+ return invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ return true
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ id == o.id &&
133
+ name == o.name &&
134
+ description == o.description &&
135
+ url == o.url &&
136
+ compiled == o.compiled &&
137
+ created_at == o.created_at &&
138
+ updated_at == o.updated_at &&
139
+ localizations == o.localizations
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Fixnum] Hash code
150
+ def hash
151
+ [id, name, description, url, compiled, created_at, updated_at, localizations].hash
152
+ end
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 build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ self.class.swagger_types.each_pair do |key, type|
160
+ if type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
164
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
165
+ end
166
+ elsif !attributes[self.class.attribute_map[key]].nil?
167
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
168
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ # Deserializes the data based on type
175
+ # @param string type Data type
176
+ # @param string value Value to be deserialized
177
+ # @return [Object] Deserialized data
178
+ def _deserialize(type, value)
179
+ case type.to_sym
180
+ when :DateTime
181
+ DateTime.parse(value)
182
+ when :Date
183
+ Date.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :BOOLEAN
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ temp_model = DyspatchClient.const_get(type).new
212
+ temp_model.build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ next if value.nil?
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map{ |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end