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,47 @@
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
+ module TestKaferiCloud
23
+ class ApiError < StandardError
24
+ attr_reader :code, :response_headers, :response_body
25
+
26
+ # Usage examples:
27
+ # ApiError.new
28
+ # ApiError.new("message")
29
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
30
+ # ApiError.new(:code => 404, :message => "Not Found")
31
+ def initialize(arg = nil)
32
+ if arg.is_a? Hash
33
+ if arg.key?(:message) || arg.key?('message')
34
+ super(arg[:message] || arg['message'])
35
+ else
36
+ super arg
37
+ end
38
+
39
+ arg.each do |k, v|
40
+ instance_variable_set "@#{k}", v
41
+ end
42
+ else
43
+ super arg
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,189 @@
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 'uri'
23
+
24
+ module TestKaferiCloud
25
+ class Configuration
26
+ # Defines url scheme
27
+ attr_accessor :scheme
28
+
29
+ # Defines url host
30
+ attr_accessor :host
31
+
32
+ # Defines url base path
33
+ attr_accessor :base_path
34
+
35
+ # Auth types
36
+ AUTH_TYPE_O_AUTH_2 = 'OAuth2'
37
+
38
+ AUTH_TYPE_REQUEST_SIGNATURE = 'RequestSignature'
39
+
40
+ # Defines authentication type.
41
+ #
42
+ # @return [AUTH_TYPE_O_AUTH_2, AUTH_TYPE_REQUEST_SIGNATURE]
43
+ attr_accessor :auth_type
44
+
45
+ # Defines the access token (Bearer) used with OAuth2.
46
+ attr_accessor :access_token
47
+
48
+ # Defines the refresh token (Bearer) used with OAuth2.
49
+ attr_accessor :refresh_token
50
+
51
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
52
+ # details will be logged with `logger.debug` (see the `logger` attribute).
53
+ # Default to false.
54
+ #
55
+ # @return [true, false]
56
+ attr_accessor :debugging
57
+
58
+ # Defines the logger used for debugging.
59
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
60
+ #
61
+ # @return [#debug]
62
+ attr_accessor :logger
63
+
64
+ # Defines the temporary folder to store downloaded files
65
+ # (for API endpoints that have file response).
66
+ # Default to use `Tempfile`.
67
+ #
68
+ # @return [String]
69
+ attr_accessor :temp_folder_path
70
+
71
+ # The time limit for HTTP request in seconds.
72
+ # Default to 0 (never times out).
73
+ attr_accessor :timeout
74
+
75
+ # Set this to false to skip client side validation in the operation.
76
+ # Default to true.
77
+ # @return [true, false]
78
+ attr_accessor :client_side_validation
79
+
80
+ ### TLS/SSL setting
81
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
82
+ # Default to true.
83
+ #
84
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
85
+ #
86
+ # @return [true, false]
87
+ attr_accessor :verify_ssl
88
+
89
+ ### TLS/SSL setting
90
+ # Set this to false to skip verifying SSL host name
91
+ # Default to true.
92
+ #
93
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
94
+ #
95
+ # @return [true, false]
96
+ attr_accessor :verify_ssl_host
97
+
98
+ ### TLS/SSL setting
99
+ # Set this to customize the certificate file to verify the peer.
100
+ #
101
+ # @return [String] the path to the certificate file
102
+ #
103
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
104
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
105
+ attr_accessor :ssl_ca_cert
106
+
107
+ ### TLS/SSL setting
108
+ # Client certificate file (for client certificate)
109
+ attr_accessor :cert_file
110
+
111
+ ### TLS/SSL setting
112
+ # Client private key file (for client certificate)
113
+ attr_accessor :key_file
114
+
115
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
116
+ # Default to nil.
117
+ #
118
+ # @see The params_encoding option of Ethon. Related source code:
119
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
120
+ attr_accessor :params_encoding
121
+
122
+ attr_accessor :inject_format
123
+
124
+ attr_accessor :force_ending_format
125
+
126
+ def initialize
127
+ @scheme = 'https'
128
+ @host = 'localhost'
129
+ @base_path = '/v1.1'
130
+ @timeout = 0
131
+ @client_side_validation = true
132
+ @verify_ssl = true
133
+ @verify_ssl_host = true
134
+ @params_encoding = nil
135
+ @cert_file = nil
136
+ @key_file = nil
137
+ @debugging = false
138
+ @inject_format = false
139
+ @force_ending_format = false
140
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
141
+ @auth_type = AUTH_TYPE_O_AUTH_2
142
+
143
+ yield(self) if block_given?
144
+ end
145
+
146
+ # The default Configuration object.
147
+ def self.default
148
+ @@default ||= Configuration.new
149
+ end
150
+
151
+ def configure
152
+ yield(self) if block_given?
153
+ end
154
+
155
+ def scheme=(scheme)
156
+ # remove :// from scheme
157
+ @scheme = scheme.sub(/:\/\//, '')
158
+ end
159
+
160
+ def host=(host)
161
+ # remove http(s):// and anything after a slash
162
+ @host = host.sub(/https?:\/\//, '').split('/').first
163
+ end
164
+
165
+ def base_path=(base_path)
166
+ # Add leading and trailing slashes to base_path
167
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
168
+ @base_path = "" if @base_path == "/"
169
+ end
170
+
171
+ def base_url
172
+ url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
173
+ URI.encode(url)
174
+ end
175
+
176
+ # Returns Auth Settings hash for api client.
177
+ def auth_settings
178
+ {
179
+ 'oauth' =>
180
+ {
181
+ type: 'oauth2',
182
+ in: 'header',
183
+ key: 'Authorization',
184
+ value: "Bearer #{access_token}"
185
+ },
186
+ }
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,260 @@
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
+ # Provides annotation.
26
+ class Annotation
27
+ # Link to the document.
28
+ attr_accessor :links
29
+
30
+ # Get the annotation color.
31
+ attr_accessor :color
32
+
33
+ # Get the annotation content.
34
+ attr_accessor :contents
35
+
36
+ # The date and time when the annotation was created.
37
+ attr_accessor :creation_date
38
+
39
+ # Get the annotation subject.
40
+ attr_accessor :subject
41
+
42
+ # Get the annotation title.
43
+ attr_accessor :title
44
+
45
+ # The date and time when the annotation was last modified.
46
+ attr_accessor :modified
47
+
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'links' => :'Links',
53
+ :'color' => :'Color',
54
+ :'contents' => :'Contents',
55
+ :'creation_date' => :'CreationDate',
56
+ :'subject' => :'Subject',
57
+ :'title' => :'Title',
58
+ :'modified' => :'Modified'
59
+ }
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.swagger_types
64
+ {
65
+ :'links' => :'Array<Link>',
66
+ :'color' => :'Color',
67
+ :'contents' => :'String',
68
+ :'creation_date' => :'String',
69
+ :'subject' => :'String',
70
+ :'title' => :'String',
71
+ :'modified' => :'String'
72
+ }
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
82
+
83
+ if attributes.has_key?(:'Links')
84
+ if (value = attributes[:'Links']).is_a?(Array)
85
+ self.links = value
86
+ end
87
+ end
88
+
89
+ if attributes.has_key?(:'Color')
90
+ self.color = attributes[:'Color']
91
+ end
92
+
93
+ if attributes.has_key?(:'Contents')
94
+ self.contents = attributes[:'Contents']
95
+ end
96
+
97
+ if attributes.has_key?(:'CreationDate')
98
+ self.creation_date = attributes[:'CreationDate']
99
+ end
100
+
101
+ if attributes.has_key?(:'Subject')
102
+ self.subject = attributes[:'Subject']
103
+ end
104
+
105
+ if attributes.has_key?(:'Title')
106
+ self.title = attributes[:'Title']
107
+ end
108
+
109
+ if attributes.has_key?(:'Modified')
110
+ self.modified = attributes[:'Modified']
111
+ end
112
+
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properies with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ return invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ return true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ links == o.links &&
134
+ color == o.color &&
135
+ contents == o.contents &&
136
+ creation_date == o.creation_date &&
137
+ subject == o.subject &&
138
+ title == o.title &&
139
+ modified == o.modified
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
+ [links, color, contents, creation_date, subject, title, modified].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 = TestKaferiCloud.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