test_kaferi_cloud 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/D://tmp//2018-02027//Ruby//.gitignore +42 -0
  3. data/D://tmp//2018-02027//Ruby//.idea//.rakeTasks +7 -0
  4. data/D://tmp//2018-02027//Ruby//.idea//inspectionProfiles//Project_Default.xml +6 -0
  5. data/D://tmp//2018-02027//Ruby//.idea//misc.xml +4 -0
  6. data/D://tmp//2018-02027//Ruby//.idea//modules.xml +8 -0
  7. data/D://tmp//2018-02027//Ruby//.idea//ruby.iml +15 -0
  8. data/D://tmp//2018-02027//Ruby//.idea//vcs.xml +6 -0
  9. data/D://tmp//2018-02027//Ruby//.idea//workspace.xml +776 -0
  10. data/D://tmp//2018-02027//Ruby//.swagger-codegen-ignore +58 -0
  11. data/D://tmp//2018-02027//Ruby//.swagger-codegen//VERSION +1 -0
  12. data/D://tmp//2018-02027//Ruby//LICENSE +21 -0
  13. data/D://tmp//2018-02027//Ruby//README.md +37 -0
  14. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud.rb +126 -0
  15. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//api//pdf_api.rb +4026 -0
  16. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//api_client.rb +523 -0
  17. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//api_error.rb +47 -0
  18. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//configuration.rb +189 -0
  19. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//annotation.rb +260 -0
  20. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//annotation_response.rb +222 -0
  21. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//annotations.rb +211 -0
  22. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//annotations_response.rb +222 -0
  23. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//append_document.rb +228 -0
  24. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//attachment.rb +270 -0
  25. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//attachment_response.rb +222 -0
  26. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//attachments.rb +211 -0
  27. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//attachments_response.rb +222 -0
  28. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//bookmarks.rb +211 -0
  29. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//bookmarks_response.rb +222 -0
  30. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//color.rb +244 -0
  31. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//document.rb +220 -0
  32. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//document_pages_response.rb +222 -0
  33. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//document_properties.rb +211 -0
  34. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//document_properties_response.rb +222 -0
  35. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//document_property.rb +227 -0
  36. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//document_property_response.rb +222 -0
  37. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//document_response.rb +233 -0
  38. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//document_text_replace_response.rb +231 -0
  39. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//field.rb +254 -0
  40. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//field_response.rb +222 -0
  41. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//field_type.rb +44 -0
  42. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//fields.rb +211 -0
  43. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//fields_response.rb +222 -0
  44. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//font_styles.rb +43 -0
  45. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//horizontal_alignment.rb +44 -0
  46. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//http_status_code.rb +87 -0
  47. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//image.rb +220 -0
  48. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//image_response.rb +222 -0
  49. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//images.rb +211 -0
  50. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//images_list_request.rb +205 -0
  51. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//images_response.rb +222 -0
  52. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//line_spacing.rb +43 -0
  53. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//link.rb +228 -0
  54. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//link_action_type.rb +46 -0
  55. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//link_annotation.rb +236 -0
  56. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//link_annotation_response.rb +222 -0
  57. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//link_annotations.rb +211 -0
  58. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//link_annotations_response.rb +222 -0
  59. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//link_element.rb +200 -0
  60. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//link_highlighting_mode.rb +45 -0
  61. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//merge_documents.rb +200 -0
  62. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//optimize_options.rb +293 -0
  63. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//page.rb +228 -0
  64. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//page_text_replace_response.rb +231 -0
  65. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//page_word_count.rb +218 -0
  66. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//pages.rb +211 -0
  67. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//paragraph.rb +303 -0
  68. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//rectangle.rb +244 -0
  69. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//rotation.rb +44 -0
  70. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//saa_spose_response.rb +213 -0
  71. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//segment.rb +206 -0
  72. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//signature.rb +333 -0
  73. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//signature_type.rb +42 -0
  74. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//split_result.rb +200 -0
  75. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//split_result_document.rb +238 -0
  76. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//split_result_response.rb +223 -0
  77. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//stamp.rb +413 -0
  78. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//stamp_type.rb +44 -0
  79. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_format.rb +227 -0
  80. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_format_response.rb +222 -0
  81. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_horizontal_alignment.rb +47 -0
  82. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_item.rb +218 -0
  83. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_item_response.rb +222 -0
  84. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_items.rb +211 -0
  85. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_items_response.rb +222 -0
  86. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_line.rb +210 -0
  87. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_rect.rb +220 -0
  88. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_rects.rb +199 -0
  89. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_rects_response.rb +222 -0
  90. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_replace.rb +253 -0
  91. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_replace_list_request.rb +232 -0
  92. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_replace_request.rb +262 -0
  93. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_replace_response.rb +222 -0
  94. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//text_state.rb +248 -0
  95. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//tiff_export_options.rb +348 -0
  96. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//vertical_alignment.rb +45 -0
  97. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//word_count.rb +199 -0
  98. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//word_count_response.rb +223 -0
  99. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//models//wrap_mode.rb +44 -0
  100. data/D://tmp//2018-02027//Ruby//lib//test_kaferi_cloud//version.rb +24 -0
  101. data/D://tmp//2018-02027//Ruby//test_kaferi_cloud.gemspec +49 -0
  102. metadata +102 -2
@@ -0,0 +1,244 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2018 Aspose.Pdf for Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+ =end
21
+
22
+ require 'date'
23
+
24
+ module TestKaferiCloud
25
+ # Represents rectangle DTO.
26
+ class Rectangle
27
+ attr_accessor :x
28
+
29
+ attr_accessor :y
30
+
31
+ attr_accessor :width
32
+
33
+ attr_accessor :height
34
+
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'x' => :'X',
40
+ :'y' => :'Y',
41
+ :'width' => :'Width',
42
+ :'height' => :'Height'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ :'x' => :'Integer',
50
+ :'y' => :'Integer',
51
+ :'width' => :'Integer',
52
+ :'height' => :'Integer'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
+
64
+ if attributes.has_key?(:'X')
65
+ self.x = attributes[:'X']
66
+ end
67
+
68
+ if attributes.has_key?(:'Y')
69
+ self.y = attributes[:'Y']
70
+ end
71
+
72
+ if attributes.has_key?(:'Width')
73
+ self.width = attributes[:'Width']
74
+ end
75
+
76
+ if attributes.has_key?(:'Height')
77
+ self.height = attributes[:'Height']
78
+ end
79
+
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properies with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ if @x.nil?
87
+ invalid_properties.push("invalid value for 'x', x cannot be nil.")
88
+ end
89
+
90
+ if @y.nil?
91
+ invalid_properties.push("invalid value for 'y', y cannot be nil.")
92
+ end
93
+
94
+ if @width.nil?
95
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
96
+ end
97
+
98
+ if @height.nil?
99
+ invalid_properties.push("invalid value for 'height', height cannot be nil.")
100
+ end
101
+
102
+ return invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ return false if @x.nil?
109
+ return false if @y.nil?
110
+ return false if @width.nil?
111
+ return false if @height.nil?
112
+ return true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ x == o.x &&
121
+ y == o.y &&
122
+ width == o.width &&
123
+ height == o.height
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Fixnum] Hash code
134
+ def hash
135
+ [x, y, width, height].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.swagger_types.each_pair do |key, type|
144
+ if type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
153
+ end
154
+
155
+ self
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def _deserialize(type, value)
163
+ case type.to_sym
164
+ when :DateTime
165
+ DateTime.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :BOOLEAN
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ temp_model = TestKaferiCloud.const_get(type).new
196
+ temp_model.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ next if value.nil?
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ # Outputs non-array value in the form of hash
225
+ # For object, use to_hash. Otherwise, just return the value
226
+ # @param [Object] value Any valid value
227
+ # @return [Hash] Returns the value in the form of hash
228
+ def _to_hash(value)
229
+ if value.is_a?(Array)
230
+ value.compact.map{ |v| _to_hash(v) }
231
+ elsif value.is_a?(Hash)
232
+ {}.tap do |hash|
233
+ value.each { |k, v| hash[k] = _to_hash(v) }
234
+ end
235
+ elsif value.respond_to? :to_hash
236
+ value.to_hash
237
+ else
238
+ value
239
+ end
240
+ end
241
+
242
+ end
243
+
244
+ end
@@ -0,0 +1,44 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2018 Aspose.Pdf for Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+ =end
21
+
22
+ require 'date'
23
+
24
+ module TestKaferiCloud
25
+ class Rotation
26
+
27
+ NONE = 0.freeze
28
+ ON_90 = 1.freeze
29
+ ON_180 = 2.freeze
30
+ ON_270 = 3.freeze
31
+
32
+ # Builds the enum from string
33
+ # @param [Fixnum] The enum value in the form of the string
34
+ # @return [Fixnum] The enum value
35
+ def build_from_hash(value)
36
+ constantValues = Rotation.constants.select{ |const_name| Rotation.const_get(const_name) == value}
37
+ raise "Invalid ENUM value #{value} for class #Rotation" if constantValues.empty?
38
+ value
39
+ #constantValues[0]
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,213 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2018 Aspose.Pdf for Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+ =end
21
+
22
+ require 'date'
23
+
24
+ module TestKaferiCloud
25
+ # Base class for all responses.
26
+ class SaaSposeResponse
27
+ # Response status code.
28
+ attr_accessor :code
29
+
30
+ # Response status.
31
+ attr_accessor :status
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'code' => :'Code',
38
+ :'status' => :'Status'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ {
45
+ :'code' => :'HttpStatusCode',
46
+ :'status' => :'String'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
57
+
58
+ if attributes.has_key?(:'Code')
59
+ self.code = attributes[:'Code']
60
+ end
61
+
62
+ if attributes.has_key?(:'Status')
63
+ self.status = attributes[:'Status']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properies with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if @code.nil?
73
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
74
+ end
75
+
76
+ return invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ return false if @code.nil?
83
+ return true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ code == o.code &&
92
+ status == o.status
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Fixnum] Hash code
103
+ def hash
104
+ [code, status].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.swagger_types.each_pair do |key, type|
113
+ if type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :DateTime
134
+ DateTime.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :BOOLEAN
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ temp_model = TestKaferiCloud.const_get(type).new
165
+ temp_model.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ next if value.nil?
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map{ |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+
211
+ end
212
+
213
+ end