groupdocs_viewer_cloud 19.3 → 20.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/groupdocs_viewer_cloud.rb +21 -3
- data/lib/groupdocs_viewer_cloud/api/file_api.rb +7 -7
- data/lib/groupdocs_viewer_cloud/api/folder_api.rb +7 -7
- data/lib/groupdocs_viewer_cloud/api/info_api.rb +266 -0
- data/lib/groupdocs_viewer_cloud/api/storage_api.rb +5 -5
- data/lib/groupdocs_viewer_cloud/api/{viewer_api.rb → view_api.rb} +22 -168
- data/lib/groupdocs_viewer_cloud/api_client.rb +1 -1
- data/lib/groupdocs_viewer_cloud/api_error.rb +7 -4
- data/lib/groupdocs_viewer_cloud/configuration.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/archive_options.rb +214 -0
- data/lib/groupdocs_viewer_cloud/models/archive_view_info.rb +216 -0
- data/lib/groupdocs_viewer_cloud/models/attachment_info.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/attachment_view.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/cad_options.rb +54 -5
- data/lib/groupdocs_viewer_cloud/models/cad_view_info.rb +228 -0
- data/lib/groupdocs_viewer_cloud/models/character.rb +274 -0
- data/lib/groupdocs_viewer_cloud/models/delete_view_options.rb +15 -5
- data/lib/groupdocs_viewer_cloud/models/disc_usage.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/email_options.rb +44 -2
- data/lib/groupdocs_viewer_cloud/models/error.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/error_details.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/field_label.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/file_info.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/file_version.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/file_versions.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/files_list.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/files_upload_result.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/format.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/formats_result.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/html_options.rb +146 -10
- data/lib/groupdocs_viewer_cloud/models/html_resource.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/image_options.rb +86 -7
- data/lib/groupdocs_viewer_cloud/models/info_result.rb +75 -5
- data/lib/groupdocs_viewer_cloud/models/layer.rb +229 -0
- data/lib/groupdocs_viewer_cloud/models/layout.rb +244 -0
- data/lib/groupdocs_viewer_cloud/models/{row.rb → line.rb} +60 -72
- data/lib/groupdocs_viewer_cloud/models/object_exist.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/outlook_options.rb +249 -0
- data/lib/groupdocs_viewer_cloud/models/outlook_view_info.rb +216 -0
- data/lib/groupdocs_viewer_cloud/models/page_info.rb +28 -13
- data/lib/groupdocs_viewer_cloud/models/page_rotation.rb +271 -0
- data/lib/groupdocs_viewer_cloud/models/page_view.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/pdf_document_options.rb +316 -0
- data/lib/groupdocs_viewer_cloud/models/pdf_options.rb +490 -0
- data/lib/groupdocs_viewer_cloud/models/pdf_view_info.rb +219 -0
- data/lib/groupdocs_viewer_cloud/models/project_management_options.rb +66 -3
- data/lib/groupdocs_viewer_cloud/models/project_management_view_info.rb +234 -0
- data/lib/groupdocs_viewer_cloud/models/render_options.rb +89 -10
- data/lib/groupdocs_viewer_cloud/models/resource.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/spreadsheet_options.rb +57 -5
- data/lib/groupdocs_viewer_cloud/models/storage_exist.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/storage_file.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/text_element.rb +274 -0
- data/lib/groupdocs_viewer_cloud/models/tile.rb +264 -0
- data/lib/groupdocs_viewer_cloud/models/view_options.rb +15 -5
- data/lib/groupdocs_viewer_cloud/models/view_result.rb +1 -1
- data/lib/groupdocs_viewer_cloud/models/watermark.rb +44 -2
- data/lib/groupdocs_viewer_cloud/models/word.rb +286 -0
- data/lib/groupdocs_viewer_cloud/models/word_processing_options.rb +219 -0
- data/lib/groupdocs_viewer_cloud/version.rb +2 -2
- metadata +22 -4
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
|
-
# <copyright company="Aspose Pty Ltd" file="
|
4
|
-
# Copyright (c) 2003-
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="line.rb">
|
4
|
+
# Copyright (c) 2003-2020 Aspose Pty Ltd
|
5
5
|
# </copyright>
|
6
6
|
# <summary>
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -28,53 +28,48 @@
|
|
28
28
|
require 'date'
|
29
29
|
|
30
30
|
module GroupDocsViewerCloud
|
31
|
-
#
|
32
|
-
class
|
31
|
+
# Represents relatively positioned rectangle which contains single line
|
32
|
+
class Line
|
33
33
|
|
34
|
-
#
|
35
|
-
attr_accessor :
|
34
|
+
# The X coordinate of the highest left point on the page layout where the rectangle that contains element begins.
|
35
|
+
attr_accessor :x
|
36
36
|
|
37
|
-
#
|
38
|
-
attr_accessor :
|
37
|
+
# The Y coordinate of the highest left point on the page layout where the rectangle that contains element begins.
|
38
|
+
attr_accessor :y
|
39
39
|
|
40
|
-
#
|
41
|
-
attr_accessor :
|
40
|
+
# The width of the rectangle which contains the element (in pixels).
|
41
|
+
attr_accessor :width
|
42
42
|
|
43
|
-
#
|
44
|
-
attr_accessor :
|
43
|
+
# The height of the rectangle which contains the element (in pixels).
|
44
|
+
attr_accessor :height
|
45
45
|
|
46
|
-
#
|
47
|
-
attr_accessor :
|
46
|
+
# The element value
|
47
|
+
attr_accessor :value
|
48
48
|
|
49
|
-
#
|
50
|
-
attr_accessor :
|
51
|
-
|
52
|
-
# Characters coordinates
|
53
|
-
attr_accessor :character_coordinates
|
49
|
+
# The words contained by the line
|
50
|
+
attr_accessor :words
|
54
51
|
|
55
52
|
# Attribute mapping from ruby-style variable name to JSON key.
|
56
53
|
def self.attribute_map
|
57
54
|
{
|
58
|
-
:'
|
59
|
-
:'
|
60
|
-
:'
|
61
|
-
:'
|
62
|
-
:'
|
63
|
-
:'
|
64
|
-
:'character_coordinates' => :'CharacterCoordinates'
|
55
|
+
:'x' => :'X',
|
56
|
+
:'y' => :'Y',
|
57
|
+
:'width' => :'Width',
|
58
|
+
:'height' => :'Height',
|
59
|
+
:'value' => :'Value',
|
60
|
+
:'words' => :'Words'
|
65
61
|
}
|
66
62
|
end
|
67
63
|
|
68
64
|
# Attribute type mapping.
|
69
65
|
def self.swagger_types
|
70
66
|
{
|
71
|
-
:'
|
72
|
-
:'
|
73
|
-
:'
|
74
|
-
:'
|
75
|
-
:'
|
76
|
-
:'
|
77
|
-
:'character_coordinates' => :'Array<Float>'
|
67
|
+
:'x' => :'Float',
|
68
|
+
:'y' => :'Float',
|
69
|
+
:'width' => :'Float',
|
70
|
+
:'height' => :'Float',
|
71
|
+
:'value' => :'String',
|
72
|
+
:'words' => :'Array<Word>'
|
78
73
|
}
|
79
74
|
end
|
80
75
|
|
@@ -86,35 +81,29 @@ module GroupDocsViewerCloud
|
|
86
81
|
# convert string to symbol for hash key
|
87
82
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
88
83
|
|
89
|
-
if attributes.key?(:'
|
90
|
-
self.
|
91
|
-
end
|
92
|
-
|
93
|
-
if attributes.key?(:'RowLeft')
|
94
|
-
self.row_left = attributes[:'RowLeft']
|
84
|
+
if attributes.key?(:'X')
|
85
|
+
self.x = attributes[:'X']
|
95
86
|
end
|
96
87
|
|
97
|
-
if attributes.key?(:'
|
98
|
-
self.
|
88
|
+
if attributes.key?(:'Y')
|
89
|
+
self.y = attributes[:'Y']
|
99
90
|
end
|
100
91
|
|
101
|
-
if attributes.key?(:'
|
102
|
-
self.
|
92
|
+
if attributes.key?(:'Width')
|
93
|
+
self.width = attributes[:'Width']
|
103
94
|
end
|
104
95
|
|
105
|
-
if attributes.key?(:'
|
106
|
-
self.
|
96
|
+
if attributes.key?(:'Height')
|
97
|
+
self.height = attributes[:'Height']
|
107
98
|
end
|
108
99
|
|
109
|
-
if attributes.key?(:'
|
110
|
-
|
111
|
-
self.text_coordinates = value
|
112
|
-
end
|
100
|
+
if attributes.key?(:'Value')
|
101
|
+
self.value = attributes[:'Value']
|
113
102
|
end
|
114
103
|
|
115
|
-
if attributes.key?(:'
|
116
|
-
if (value = attributes[:'
|
117
|
-
self.
|
104
|
+
if attributes.key?(:'Words')
|
105
|
+
if (value = attributes[:'Words']).is_a?(Array)
|
106
|
+
self.words = value
|
118
107
|
end
|
119
108
|
end
|
120
109
|
|
@@ -124,20 +113,20 @@ module GroupDocsViewerCloud
|
|
124
113
|
# @return Array for valid properies with the reasons
|
125
114
|
def list_invalid_properties
|
126
115
|
invalid_properties = []
|
127
|
-
if @
|
128
|
-
invalid_properties.push("invalid value for '
|
116
|
+
if @x.nil?
|
117
|
+
invalid_properties.push("invalid value for 'x', x cannot be nil.")
|
129
118
|
end
|
130
119
|
|
131
|
-
if @
|
132
|
-
invalid_properties.push("invalid value for '
|
120
|
+
if @y.nil?
|
121
|
+
invalid_properties.push("invalid value for 'y', y cannot be nil.")
|
133
122
|
end
|
134
123
|
|
135
|
-
if @
|
136
|
-
invalid_properties.push("invalid value for '
|
124
|
+
if @width.nil?
|
125
|
+
invalid_properties.push("invalid value for 'width', width cannot be nil.")
|
137
126
|
end
|
138
127
|
|
139
|
-
if @
|
140
|
-
invalid_properties.push("invalid value for '
|
128
|
+
if @height.nil?
|
129
|
+
invalid_properties.push("invalid value for 'height', height cannot be nil.")
|
141
130
|
end
|
142
131
|
|
143
132
|
return invalid_properties
|
@@ -146,10 +135,10 @@ module GroupDocsViewerCloud
|
|
146
135
|
# Check to see if the all the properties in the model are valid
|
147
136
|
# @return true if the model is valid
|
148
137
|
def valid?
|
149
|
-
return false if @
|
150
|
-
return false if @
|
151
|
-
return false if @
|
152
|
-
return false if @
|
138
|
+
return false if @x.nil?
|
139
|
+
return false if @y.nil?
|
140
|
+
return false if @width.nil?
|
141
|
+
return false if @height.nil?
|
153
142
|
return true
|
154
143
|
end
|
155
144
|
|
@@ -158,13 +147,12 @@ module GroupDocsViewerCloud
|
|
158
147
|
def ==(other)
|
159
148
|
return true if self.equal?(other)
|
160
149
|
self.class == other.class &&
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
character_coordinates == other.character_coordinates
|
150
|
+
x == other.x &&
|
151
|
+
y == other.y &&
|
152
|
+
width == other.width &&
|
153
|
+
height == other.height &&
|
154
|
+
value == other.value &&
|
155
|
+
words == other.words
|
168
156
|
end
|
169
157
|
|
170
158
|
# @see the `==` method
|
@@ -176,7 +164,7 @@ module GroupDocsViewerCloud
|
|
176
164
|
# Calculates hash code according to all attributes.
|
177
165
|
# @return [Fixnum] Hash code
|
178
166
|
def hash
|
179
|
-
[
|
167
|
+
[x, y, width, height, value, words].hash
|
180
168
|
end
|
181
169
|
|
182
170
|
# Downcases first letter.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
3
|
# <copyright company="Aspose Pty Ltd" file="object_exist.rb">
|
4
|
-
# Copyright (c) 2003-
|
4
|
+
# Copyright (c) 2003-2020 Aspose Pty Ltd
|
5
5
|
# </copyright>
|
6
6
|
# <summary>
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -0,0 +1,249 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="outlook_options.rb">
|
4
|
+
# Copyright (c) 2003-2020 Aspose Pty Ltd
|
5
|
+
# </copyright>
|
6
|
+
# <summary>
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
# </summary>
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'date'
|
29
|
+
|
30
|
+
module GroupDocsViewerCloud
|
31
|
+
# Provides options for rendering Outlook data files
|
32
|
+
class OutlookOptions
|
33
|
+
|
34
|
+
# The name of the folder (e.g. Inbox, Sent Item or Deleted Items) to render
|
35
|
+
attr_accessor :folder
|
36
|
+
|
37
|
+
# The keywords used to filter messages
|
38
|
+
attr_accessor :text_filter
|
39
|
+
|
40
|
+
# The email-address used to filter messages by sender or recipient
|
41
|
+
attr_accessor :address_filter
|
42
|
+
|
43
|
+
# The maximum number of messages or items, that can be rendered from one folder
|
44
|
+
attr_accessor :max_items_in_folder
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'folder' => :'Folder',
|
50
|
+
:'text_filter' => :'TextFilter',
|
51
|
+
:'address_filter' => :'AddressFilter',
|
52
|
+
:'max_items_in_folder' => :'MaxItemsInFolder'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'folder' => :'String',
|
60
|
+
:'text_filter' => :'String',
|
61
|
+
:'address_filter' => :'String',
|
62
|
+
:'max_items_in_folder' => :'Integer'
|
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.key?(:'Folder')
|
75
|
+
self.folder = attributes[:'Folder']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'TextFilter')
|
79
|
+
self.text_filter = attributes[:'TextFilter']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'AddressFilter')
|
83
|
+
self.address_filter = attributes[:'AddressFilter']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'MaxItemsInFolder')
|
87
|
+
self.max_items_in_folder = attributes[:'MaxItemsInFolder']
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
93
|
+
# @return Array for valid properies with the reasons
|
94
|
+
def list_invalid_properties
|
95
|
+
invalid_properties = []
|
96
|
+
if @max_items_in_folder.nil?
|
97
|
+
invalid_properties.push("invalid value for 'max_items_in_folder', max_items_in_folder cannot be nil.")
|
98
|
+
end
|
99
|
+
|
100
|
+
return invalid_properties
|
101
|
+
end
|
102
|
+
|
103
|
+
# Check to see if the all the properties in the model are valid
|
104
|
+
# @return true if the model is valid
|
105
|
+
def valid?
|
106
|
+
return false if @max_items_in_folder.nil?
|
107
|
+
return true
|
108
|
+
end
|
109
|
+
|
110
|
+
# Checks equality by comparing each attribute.
|
111
|
+
# @param [Object] Object to be compared
|
112
|
+
def ==(other)
|
113
|
+
return true if self.equal?(other)
|
114
|
+
self.class == other.class &&
|
115
|
+
folder == other.folder &&
|
116
|
+
text_filter == other.text_filter &&
|
117
|
+
address_filter == other.address_filter &&
|
118
|
+
max_items_in_folder == other.max_items_in_folder
|
119
|
+
end
|
120
|
+
|
121
|
+
# @see the `==` method
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def eql?(other)
|
124
|
+
self == other
|
125
|
+
end
|
126
|
+
|
127
|
+
# Calculates hash code according to all attributes.
|
128
|
+
# @return [Fixnum] Hash code
|
129
|
+
def hash
|
130
|
+
[folder, text_filter, address_filter, max_items_in_folder].hash
|
131
|
+
end
|
132
|
+
|
133
|
+
# Downcases first letter.
|
134
|
+
# @return downcased string
|
135
|
+
def uncap(str)
|
136
|
+
str[0, 1].downcase + str[1..-1]
|
137
|
+
end
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def build_from_hash(attributes)
|
143
|
+
return nil unless attributes.is_a?(Hash)
|
144
|
+
self.class.swagger_types.each_pair do |key, type|
|
145
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
146
|
+
value = attributes[pname]
|
147
|
+
if type =~ /\AArray<(.*)>/i
|
148
|
+
# check to ensure the input is an array given that the the attribute
|
149
|
+
# is documented as an array but the input is not
|
150
|
+
if value.is_a?(Array)
|
151
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
152
|
+
end
|
153
|
+
elsif !value.nil?
|
154
|
+
self.send("#{key}=", _deserialize(type, value))
|
155
|
+
end
|
156
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
157
|
+
end
|
158
|
+
|
159
|
+
self
|
160
|
+
end
|
161
|
+
|
162
|
+
# Deserializes the data based on type
|
163
|
+
# @param string type Data type
|
164
|
+
# @param string value Value to be deserialized
|
165
|
+
# @return [Object] Deserialized data
|
166
|
+
def _deserialize(type, value)
|
167
|
+
case type.to_sym
|
168
|
+
when :DateTime
|
169
|
+
Date.parse value
|
170
|
+
when :Date
|
171
|
+
Date.parse value
|
172
|
+
when :String
|
173
|
+
value.to_s
|
174
|
+
when :Integer
|
175
|
+
value.to_i
|
176
|
+
when :Float
|
177
|
+
value.to_f
|
178
|
+
when :BOOLEAN
|
179
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
180
|
+
true
|
181
|
+
else
|
182
|
+
false
|
183
|
+
end
|
184
|
+
when :Object
|
185
|
+
# generic object (usually a Hash), return directly
|
186
|
+
value
|
187
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
188
|
+
inner_type = Regexp.last_match[:inner_type]
|
189
|
+
value.map { |v| _deserialize(inner_type, v) }
|
190
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
191
|
+
k_type = Regexp.last_match[:k_type]
|
192
|
+
v_type = Regexp.last_match[:v_type]
|
193
|
+
{}.tap do |hash|
|
194
|
+
value.each do |k, v|
|
195
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
else
|
199
|
+
# model
|
200
|
+
temp_model = GroupDocsViewerCloud.const_get(type).new
|
201
|
+
temp_model.build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the string representation of the object
|
206
|
+
# @return [String] String presentation of the object
|
207
|
+
def to_s
|
208
|
+
to_hash.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
# to_body is an alias to to_hash (backward compatibility)
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_body
|
214
|
+
to_hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the object in the form of hash
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_hash
|
220
|
+
hash = {}
|
221
|
+
self.class.attribute_map.each_pair do |attr, param|
|
222
|
+
value = self.send(attr)
|
223
|
+
next if value.nil?
|
224
|
+
hash[param] = _to_hash(value)
|
225
|
+
end
|
226
|
+
hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Outputs non-array value in the form of hash
|
230
|
+
# For object, use to_hash. Otherwise, just return the value
|
231
|
+
# @param [Object] value Any valid value
|
232
|
+
# @return [Hash] Returns the value in the form of hash
|
233
|
+
def _to_hash(value)
|
234
|
+
if value.is_a?(Array)
|
235
|
+
value.compact.map { |v| _to_hash(v) }
|
236
|
+
elsif value.is_a?(Hash)
|
237
|
+
{}.tap do |hash|
|
238
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
+
end
|
240
|
+
elsif value.respond_to? :to_hash
|
241
|
+
value.to_hash
|
242
|
+
else
|
243
|
+
value
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|