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