purecloud 0.18.0 → 0.25.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 (143) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +2 -2
  4. data/README.md +1 -7
  5. data/config-ruby.json +1 -1
  6. data/extensions/auth.rb +2 -2
  7. data/lib/purecloud.rb +110 -75
  8. data/lib/purecloud/api/architect_api.rb +3127 -74
  9. data/lib/purecloud/api/attributes_api.rb +33 -33
  10. data/lib/purecloud/api/authorization_api.rb +83 -83
  11. data/lib/purecloud/api/compliance_api.rb +5 -5
  12. data/lib/purecloud/api/configuration_api.rb +594 -397
  13. data/lib/purecloud/api/content_management_api.rb +183 -183
  14. data/lib/purecloud/api/conversations_api.rb +289 -159
  15. data/lib/purecloud/api/downloads_api.rb +6 -6
  16. data/lib/purecloud/api/external_contacts_api.rb +1693 -0
  17. data/lib/purecloud/api/fax_api.rb +24 -24
  18. data/lib/purecloud/api/geolocation_api.rb +14 -14
  19. data/lib/purecloud/api/greetings_api.rb +68 -68
  20. data/lib/purecloud/api/groups_api.rb +31 -20
  21. data/lib/purecloud/api/languages_api.rb +18 -11
  22. data/lib/purecloud/api/licensing_api.rb +5 -5
  23. data/lib/purecloud/api/locations_api.rb +11 -11
  24. data/lib/purecloud/api/notifications_api.rb +41 -41
  25. data/lib/purecloud/api/o_auth_api.rb +69 -69
  26. data/lib/purecloud/api/outbound_api.rb +505 -325
  27. data/lib/purecloud/api/presence_api.rb +65 -65
  28. data/lib/purecloud/api/quality_api.rb +66 -639
  29. data/lib/purecloud/api/recording_api.rb +1343 -0
  30. data/lib/purecloud/api/response_management_api.rb +687 -0
  31. data/lib/purecloud/api/routing_api.rb +224 -170
  32. data/lib/purecloud/api/scripts_api.rb +52 -52
  33. data/lib/purecloud/api/search_api.rb +5 -5
  34. data/lib/purecloud/api/stations_api.rb +8 -8
  35. data/lib/purecloud/api/telephony_providers_edge_api.rb +138 -138
  36. data/lib/purecloud/api/user_recordings_api.rb +29 -29
  37. data/lib/purecloud/api/users_api.rb +123 -123
  38. data/lib/purecloud/api/utilities_api.rb +71 -15
  39. data/lib/purecloud/api/voicemail_api.rb +42 -42
  40. data/lib/purecloud/api_client.rb +1 -1
  41. data/lib/purecloud/models/address.rb +49 -51
  42. data/lib/purecloud/models/attribute_filter_item.rb +177 -0
  43. data/lib/purecloud/models/automate_queue_member_entity_listing.rb +238 -0
  44. data/lib/purecloud/models/available_additional_service.rb +40 -1
  45. data/lib/purecloud/models/{topic_entity_listing.rb → available_topic_entity_listing.rb} +1 -1
  46. data/lib/purecloud/models/call.rb +36 -5
  47. data/lib/purecloud/models/{line_properties.rb → call_command.rb} +13 -3
  48. data/lib/purecloud/models/callback.rb +15 -4
  49. data/lib/purecloud/models/campaign.rb +219 -17
  50. data/lib/purecloud/models/campaign_progress.rb +186 -0
  51. data/lib/purecloud/models/channel_topic_entity_listing.rb +238 -0
  52. data/lib/purecloud/models/charge.rb +14 -4
  53. data/lib/purecloud/models/{attribute_value.rb → client_text_table_transform.rb} +52 -82
  54. data/lib/purecloud/models/contact.rb +1 -1
  55. data/lib/purecloud/models/contact_list.rb +111 -1
  56. data/lib/purecloud/models/contact_listing.rb +238 -0
  57. data/lib/purecloud/models/content_attribute_filter_item.rb +177 -0
  58. data/lib/purecloud/models/content_facet_filter_item.rb +1 -1
  59. data/lib/purecloud/models/content_query_request.rb +16 -4
  60. data/lib/purecloud/models/control.rb +221 -0
  61. data/lib/purecloud/models/{flow_activate_request.rb → control_options.rb} +18 -12
  62. data/lib/purecloud/models/create_callback_command.rb +200 -0
  63. data/lib/purecloud/models/discount.rb +220 -0
  64. data/lib/purecloud/models/document.rb +13 -1
  65. data/lib/purecloud/models/document_attribute.rb +158 -0
  66. data/lib/purecloud/models/document_update.rb +28 -16
  67. data/lib/purecloud/models/document_upload.rb +4 -16
  68. data/lib/purecloud/models/domain_voice_rate_extended_response_item_entity_listing.rb +238 -0
  69. data/lib/purecloud/models/domain_voice_rate_international_response_item_entity_listing.rb +238 -0
  70. data/lib/purecloud/models/domain_voice_rate_response_item_entity_listing.rb +1 -1
  71. data/lib/purecloud/models/edge_line.rb +1 -1
  72. data/lib/purecloud/models/edge_logs_job.rb +181 -0
  73. data/lib/purecloud/models/edge_logs_job_file.rb +243 -0
  74. data/lib/purecloud/models/edge_logs_job_request.rb +168 -0
  75. data/lib/purecloud/models/{backend_work_item_data_element.rb → edge_logs_job_response.rb} +16 -24
  76. data/lib/purecloud/models/{flow_lock_request.rb → edge_logs_job_upload_request.rb} +10 -12
  77. data/lib/purecloud/models/email.rb +15 -4
  78. data/lib/purecloud/models/endpoint.rb +1 -1
  79. data/lib/purecloud/models/{flow_associate_workspaces_request.rb → estimated_wait_time_predictions.rb} +10 -11
  80. data/lib/purecloud/models/external_contact.rb +320 -0
  81. data/lib/purecloud/models/external_organization.rb +306 -0
  82. data/lib/purecloud/models/external_organization_listing.rb +238 -0
  83. data/lib/purecloud/models/facet_filter_item.rb +1 -1
  84. data/lib/purecloud/models/flow_body.rb +1 -1
  85. data/lib/purecloud/models/flow_body_format.rb +10 -20
  86. data/lib/purecloud/models/flow_terminate_request.rb +3 -16
  87. data/lib/purecloud/models/form.rb +148 -0
  88. data/lib/purecloud/models/group.rb +11 -1
  89. data/lib/purecloud/models/health_check_info.rb +268 -0
  90. data/lib/purecloud/models/{body_2.rb → inline_response_200.rb} +1 -1
  91. data/lib/purecloud/models/integration_type.rb +209 -0
  92. data/lib/purecloud/models/integration_type_entity_listing.rb +238 -0
  93. data/lib/purecloud/models/key_rotation_schedule.rb +1 -0
  94. data/lib/purecloud/models/language.rb +41 -1
  95. data/lib/purecloud/models/line.rb +1 -1
  96. data/lib/purecloud/models/line_base.rb +1 -1
  97. data/lib/purecloud/models/media_policies.rb +169 -0
  98. data/lib/purecloud/models/media_policy.rb +171 -0
  99. data/lib/purecloud/models/note.rb +200 -0
  100. data/lib/purecloud/models/{user_station_resource.rb → note_listing.rb} +68 -58
  101. data/lib/purecloud/models/o_auth_client.rb +1 -1
  102. data/lib/purecloud/models/page.rb +2 -2
  103. data/lib/purecloud/models/{byte_buffer.rb → payment_method.rb} +48 -61
  104. data/lib/purecloud/models/payment_method_listing.rb +238 -0
  105. data/lib/purecloud/models/payment_token_provider.rb +180 -0
  106. data/lib/purecloud/models/phone.rb +1 -1
  107. data/lib/purecloud/models/phone_base.rb +1 -1
  108. data/lib/purecloud/models/phone_number.rb +198 -0
  109. data/lib/purecloud/models/phones_reboot.rb +14 -4
  110. data/lib/purecloud/models/policy.rb +14 -1
  111. data/lib/purecloud/models/prediction_results.rb +167 -0
  112. data/lib/purecloud/models/query_request.rb +16 -4
  113. data/lib/purecloud/models/queue_member_entity_listing.rb +1 -1
  114. data/lib/purecloud/models/quote.rb +13 -1
  115. data/lib/purecloud/models/recording_settings.rb +146 -0
  116. data/lib/purecloud/models/relationship.rb +201 -0
  117. data/lib/purecloud/models/relationship_listing.rb +238 -0
  118. data/lib/purecloud/models/report_schedule.rb +3 -2
  119. data/lib/purecloud/models/service_type.rb +12 -1
  120. data/lib/purecloud/models/social_expression.rb +25 -4
  121. data/lib/purecloud/models/spreadsheet_transform_entity_listing.rb +1 -1
  122. data/lib/purecloud/models/template.rb +1 -1
  123. data/lib/purecloud/models/text_table_transform_entity_listing.rb +1 -1
  124. data/lib/purecloud/models/ticker.rb +158 -0
  125. data/lib/purecloud/models/time_slot.rb +1 -0
  126. data/lib/purecloud/models/trunk_base.rb +1 -1
  127. data/lib/purecloud/models/vendor_connection_request.rb +166 -0
  128. data/lib/purecloud/models/video.rb +15 -4
  129. data/lib/purecloud/models/work_item_definition.rb +8 -10
  130. data/lib/purecloud/version.rb +1 -1
  131. data/ossindex.json +17 -0
  132. data/purecloud.gemspec +4 -3
  133. data/rakefile +3 -15
  134. data/spec/test.rb +6 -3
  135. data/swagger.json +1 -1
  136. data/swagger_template/api_client.mustache +304 -0
  137. data/swagger_template/base_object.mustache +90 -0
  138. data/{PureCloud.gemspec → swagger_template/gemspec.mustache} +12 -11
  139. data/version.json +1 -1
  140. metadata +76 -25
  141. data/lib/purecloud/api/analytics_api.rb +0 -1554
  142. data/lib/purecloud/api/orphaned_recordings_api.rb +0 -205
  143. data/newVersion.md +0 -1
@@ -1,16 +1,18 @@
1
1
  require 'date'
2
2
 
3
3
  module PureCloud
4
- # Used as the body to the activateFlow request.
5
- class FlowActivateRequest
6
- # Change the activated state of the flow definition. True to activate the flow definition so it can be launched, false to disable the flow.
7
- attr_accessor :activated
4
+ class ControlOptions
5
+ attr_accessor :value
6
+
7
+ attr_accessor :label
8
8
 
9
9
  # Attribute mapping from ruby-style variable name to JSON key.
10
10
  def self.attribute_map
11
11
  {
12
12
 
13
- :'activated' => :'activated'
13
+ :'value' => :'value',
14
+
15
+ :'label' => :'label'
14
16
 
15
17
  }
16
18
  end
@@ -18,7 +20,8 @@ module PureCloud
18
20
  # Attribute type mapping.
19
21
  def self.swagger_types
20
22
  {
21
- :'activated' => :'BOOLEAN'
23
+ :'value' => :'String',
24
+ :'label' => :'String'
22
25
 
23
26
  }
24
27
  end
@@ -30,10 +33,12 @@ module PureCloud
30
33
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
31
34
 
32
35
 
33
- if attributes[:'activated']
34
- self.activated = attributes[:'activated']
35
- else
36
- self.activated = false
36
+ if attributes[:'value']
37
+ self.value = attributes[:'value']
38
+ end
39
+
40
+ if attributes[:'label']
41
+ self.label = attributes[:'label']
37
42
  end
38
43
 
39
44
  end
@@ -42,7 +47,8 @@ module PureCloud
42
47
  def ==(o)
43
48
  return true if self.equal?(o)
44
49
  self.class == o.class &&
45
- activated == o.activated
50
+ value == o.value &&
51
+ label == o.label
46
52
  end
47
53
 
48
54
  # @see the `==` method
@@ -52,7 +58,7 @@ module PureCloud
52
58
 
53
59
  # Calculate hash code according to all attributes.
54
60
  def hash
55
- [activated].hash
61
+ [value, label].hash
56
62
  end
57
63
 
58
64
  # build the object from hash
@@ -0,0 +1,200 @@
1
+ require 'date'
2
+
3
+ module PureCloud
4
+ class CreateCallbackCommand
5
+ attr_accessor :script_id
6
+
7
+ attr_accessor :queue_id
8
+
9
+ attr_accessor :callback_user_name
10
+
11
+ attr_accessor :callback_numbers
12
+
13
+ attr_accessor :country_code
14
+
15
+ attr_accessor :skip_enabled
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+
21
+ :'script_id' => :'scriptId',
22
+
23
+ :'queue_id' => :'queueId',
24
+
25
+ :'callback_user_name' => :'callbackUserName',
26
+
27
+ :'callback_numbers' => :'callbackNumbers',
28
+
29
+ :'country_code' => :'countryCode',
30
+
31
+ :'skip_enabled' => :'skipEnabled'
32
+
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'script_id' => :'String',
40
+ :'queue_id' => :'String',
41
+ :'callback_user_name' => :'String',
42
+ :'callback_numbers' => :'Array<String>',
43
+ :'country_code' => :'String',
44
+ :'skip_enabled' => :'BOOLEAN'
45
+
46
+ }
47
+ end
48
+
49
+ def initialize(attributes = {})
50
+ return unless attributes.is_a?(Hash)
51
+
52
+ # convert string to symbol for hash key
53
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
54
+
55
+
56
+ if attributes[:'scriptId']
57
+ self.script_id = attributes[:'scriptId']
58
+ end
59
+
60
+ if attributes[:'queueId']
61
+ self.queue_id = attributes[:'queueId']
62
+ end
63
+
64
+ if attributes[:'callbackUserName']
65
+ self.callback_user_name = attributes[:'callbackUserName']
66
+ end
67
+
68
+ if attributes[:'callbackNumbers']
69
+ if (value = attributes[:'callbackNumbers']).is_a?(Array)
70
+ self.callback_numbers = value
71
+ end
72
+ end
73
+
74
+ if attributes[:'countryCode']
75
+ self.country_code = attributes[:'countryCode']
76
+ end
77
+
78
+ if attributes[:'skipEnabled']
79
+ self.skip_enabled = attributes[:'skipEnabled']
80
+ else
81
+ self.skip_enabled = false
82
+ end
83
+
84
+ end
85
+
86
+ # Check equality by comparing each attribute.
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ script_id == o.script_id &&
91
+ queue_id == o.queue_id &&
92
+ callback_user_name == o.callback_user_name &&
93
+ callback_numbers == o.callback_numbers &&
94
+ country_code == o.country_code &&
95
+ skip_enabled == o.skip_enabled
96
+ end
97
+
98
+ # @see the `==` method
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculate hash code according to all attributes.
104
+ def hash
105
+ [script_id, queue_id, callback_user_name, callback_numbers, country_code, skip_enabled].hash
106
+ end
107
+
108
+ # build the object from hash
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ self.class.swagger_types.each_pair do |key, type|
112
+ if type =~ /^Array<(.*)>/i
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
115
+ else
116
+ #TODO show warning in debug mode
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ else
121
+ # data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ def _deserialize(type, value)
129
+ case type.to_sym
130
+ when :DateTime
131
+ DateTime.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :BOOLEAN
141
+ if value =~ /^(true|t|yes|y|1)$/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ _model = Object.const_get("PureCloud").const_get(type).new
159
+ _model.build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ def to_s
164
+ to_hash.to_s
165
+ end
166
+
167
+ # to_body is an alias to to_body (backward compatibility))
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # return the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ next if value.nil?
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ # Method to output non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ def _to_hash(value)
186
+ if value.is_a?(Array)
187
+ value.compact.map{ |v| _to_hash(v) }
188
+ elsif value.is_a?(Hash)
189
+ {}.tap do |hash|
190
+ value.each { |k, v| hash[k] = _to_hash(v) }
191
+ end
192
+ elsif value.respond_to? :to_hash
193
+ value.to_hash
194
+ else
195
+ value
196
+ end
197
+ end
198
+
199
+ end
200
+ end
@@ -0,0 +1,220 @@
1
+ require 'date'
2
+
3
+ module PureCloud
4
+ class Discount
5
+ # The globally unique identifier for the object.
6
+ attr_accessor :id
7
+
8
+ attr_accessor :name
9
+
10
+ attr_accessor :annual_pre_pay
11
+
12
+ attr_accessor :discount
13
+
14
+ attr_accessor :maximum
15
+
16
+ attr_accessor :minimum
17
+
18
+ attr_accessor :product_category
19
+
20
+ # The URI for this object
21
+ attr_accessor :self_uri
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+
27
+ :'id' => :'id',
28
+
29
+ :'name' => :'name',
30
+
31
+ :'annual_pre_pay' => :'annualPrePay',
32
+
33
+ :'discount' => :'discount',
34
+
35
+ :'maximum' => :'maximum',
36
+
37
+ :'minimum' => :'minimum',
38
+
39
+ :'product_category' => :'productCategory',
40
+
41
+ :'self_uri' => :'selfUri'
42
+
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ :'id' => :'String',
50
+ :'name' => :'String',
51
+ :'annual_pre_pay' => :'BOOLEAN',
52
+ :'discount' => :'String',
53
+ :'maximum' => :'String',
54
+ :'minimum' => :'String',
55
+ :'product_category' => :'String',
56
+ :'self_uri' => :'String'
57
+
58
+ }
59
+ end
60
+
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
66
+
67
+
68
+ if attributes[:'id']
69
+ self.id = attributes[:'id']
70
+ end
71
+
72
+ if attributes[:'name']
73
+ self.name = attributes[:'name']
74
+ end
75
+
76
+ if attributes[:'annualPrePay']
77
+ self.annual_pre_pay = attributes[:'annualPrePay']
78
+ else
79
+ self.annual_pre_pay = false
80
+ end
81
+
82
+ if attributes[:'discount']
83
+ self.discount = attributes[:'discount']
84
+ end
85
+
86
+ if attributes[:'maximum']
87
+ self.maximum = attributes[:'maximum']
88
+ end
89
+
90
+ if attributes[:'minimum']
91
+ self.minimum = attributes[:'minimum']
92
+ end
93
+
94
+ if attributes[:'productCategory']
95
+ self.product_category = attributes[:'productCategory']
96
+ end
97
+
98
+ if attributes[:'selfUri']
99
+ self.self_uri = attributes[:'selfUri']
100
+ end
101
+
102
+ end
103
+
104
+ # Check equality by comparing each attribute.
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ id == o.id &&
109
+ name == o.name &&
110
+ annual_pre_pay == o.annual_pre_pay &&
111
+ discount == o.discount &&
112
+ maximum == o.maximum &&
113
+ minimum == o.minimum &&
114
+ product_category == o.product_category &&
115
+ self_uri == o.self_uri
116
+ end
117
+
118
+ # @see the `==` method
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculate hash code according to all attributes.
124
+ def hash
125
+ [id, name, annual_pre_pay, discount, maximum, minimum, product_category, self_uri].hash
126
+ end
127
+
128
+ # build the object from hash
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.swagger_types.each_pair do |key, type|
132
+ if type =~ /^Array<(.*)>/i
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
135
+ else
136
+ #TODO show warning in debug mode
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ else
141
+ # data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :BOOLEAN
161
+ if value =~ /^(true|t|yes|y|1)$/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ _model = Object.const_get("PureCloud").const_get(type).new
179
+ _model.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_body (backward compatibility))
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # return the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ next if value.nil?
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Method to output non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map{ |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+ end