purecloud 0.18.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -8,6 +8,9 @@ module PureCloud
8
8
 
9
9
  attr_accessor :codecs
10
10
 
11
+ # Prefix striping is a mechanism to remove digits from the beginning of a phone number before sending a call out to a carrier, such as international exit codes. This must be configurable on a per carrier basis as all carriers act differently.
12
+ attr_accessor :strip
13
+
11
14
  attr_accessor :calling_party_id
12
15
 
13
16
  attr_accessor :call_history
@@ -24,6 +27,8 @@ module PureCloud
24
27
 
25
28
  :'codecs' => :'codecs',
26
29
 
30
+ :'strip' => :'strip',
31
+
27
32
  :'calling_party_id' => :'callingPartyId',
28
33
 
29
34
  :'call_history' => :'callHistory',
@@ -39,6 +44,7 @@ module PureCloud
39
44
  :'type' => :'String',
40
45
  :'parameters' => :'Hash<String, String>',
41
46
  :'codecs' => :'Array<String>',
47
+ :'strip' => :'String',
42
48
  :'calling_party_id' => :'String',
43
49
  :'call_history' => :'String',
44
50
  :'prefix' => :'String'
@@ -69,6 +75,10 @@ module PureCloud
69
75
  end
70
76
  end
71
77
 
78
+ if attributes[:'strip']
79
+ self.strip = attributes[:'strip']
80
+ end
81
+
72
82
  if attributes[:'callingPartyId']
73
83
  self.calling_party_id = attributes[:'callingPartyId']
74
84
  end
@@ -90,6 +100,7 @@ module PureCloud
90
100
  type == o.type &&
91
101
  parameters == o.parameters &&
92
102
  codecs == o.codecs &&
103
+ strip == o.strip &&
93
104
  calling_party_id == o.calling_party_id &&
94
105
  call_history == o.call_history &&
95
106
  prefix == o.prefix
@@ -102,7 +113,7 @@ module PureCloud
102
113
 
103
114
  # Calculate hash code according to all attributes.
104
115
  def hash
105
- [type, parameters, codecs, calling_party_id, call_history, prefix].hash
116
+ [type, parameters, codecs, strip, calling_party_id, call_history, prefix].hash
106
117
  end
107
118
 
108
119
  # build the object from hash
@@ -10,6 +10,8 @@ module PureCloud
10
10
 
11
11
  attr_accessor :social_media_hub
12
12
 
13
+ attr_accessor :social_user_name
14
+
13
15
  attr_accessor :preview_text
14
16
 
15
17
  attr_accessor :recording_id
@@ -23,6 +25,9 @@ module PureCloud
23
25
  # Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
24
26
  attr_accessor :start_hold_time
25
27
 
28
+ # Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
29
+ attr_accessor :connected_time
30
+
26
31
  # Attribute mapping from ruby-style variable name to JSON key.
27
32
  def self.attribute_map
28
33
  {
@@ -35,6 +40,8 @@ module PureCloud
35
40
 
36
41
  :'social_media_hub' => :'socialMediaHub',
37
42
 
43
+ :'social_user_name' => :'socialUserName',
44
+
38
45
  :'preview_text' => :'previewText',
39
46
 
40
47
  :'recording_id' => :'recordingId',
@@ -45,7 +52,9 @@ module PureCloud
45
52
 
46
53
  :'disconnect_type' => :'disconnectType',
47
54
 
48
- :'start_hold_time' => :'startHoldTime'
55
+ :'start_hold_time' => :'startHoldTime',
56
+
57
+ :'connected_time' => :'connectedTime'
49
58
 
50
59
  }
51
60
  end
@@ -57,12 +66,14 @@ module PureCloud
57
66
  :'id' => :'String',
58
67
  :'social_media_id' => :'String',
59
68
  :'social_media_hub' => :'String',
69
+ :'social_user_name' => :'String',
60
70
  :'preview_text' => :'String',
61
71
  :'recording_id' => :'String',
62
72
  :'segments' => :'Array<Segment>',
63
73
  :'held' => :'BOOLEAN',
64
74
  :'disconnect_type' => :'String',
65
- :'start_hold_time' => :'DateTime'
75
+ :'start_hold_time' => :'DateTime',
76
+ :'connected_time' => :'DateTime'
66
77
 
67
78
  }
68
79
  end
@@ -90,6 +101,10 @@ module PureCloud
90
101
  self.social_media_hub = attributes[:'socialMediaHub']
91
102
  end
92
103
 
104
+ if attributes[:'socialUserName']
105
+ self.social_user_name = attributes[:'socialUserName']
106
+ end
107
+
93
108
  if attributes[:'previewText']
94
109
  self.preview_text = attributes[:'previewText']
95
110
  end
@@ -118,6 +133,10 @@ module PureCloud
118
133
  self.start_hold_time = attributes[:'startHoldTime']
119
134
  end
120
135
 
136
+ if attributes[:'connectedTime']
137
+ self.connected_time = attributes[:'connectedTime']
138
+ end
139
+
121
140
  end
122
141
 
123
142
  # Custom attribute writer method checking allowed values (enum).
@@ -146,12 +165,14 @@ module PureCloud
146
165
  id == o.id &&
147
166
  social_media_id == o.social_media_id &&
148
167
  social_media_hub == o.social_media_hub &&
168
+ social_user_name == o.social_user_name &&
149
169
  preview_text == o.preview_text &&
150
170
  recording_id == o.recording_id &&
151
171
  segments == o.segments &&
152
172
  held == o.held &&
153
173
  disconnect_type == o.disconnect_type &&
154
- start_hold_time == o.start_hold_time
174
+ start_hold_time == o.start_hold_time &&
175
+ connected_time == o.connected_time
155
176
  end
156
177
 
157
178
  # @see the `==` method
@@ -161,7 +182,7 @@ module PureCloud
161
182
 
162
183
  # Calculate hash code according to all attributes.
163
184
  def hash
164
- [state, id, social_media_id, social_media_hub, preview_text, recording_id, segments, held, disconnect_type, start_hold_time].hash
185
+ [state, id, social_media_id, social_media_hub, social_user_name, preview_text, recording_id, segments, held, disconnect_type, start_hold_time, connected_time].hash
165
186
  end
166
187
 
167
188
  # build the object from hash
@@ -55,7 +55,7 @@ module PureCloud
55
55
  :'page_size' => :'Integer',
56
56
  :'page_number' => :'Integer',
57
57
  :'total' => :'Integer',
58
- :'entities' => :'Array<SpreadsheetTransform>',
58
+ :'entities' => :'Array<ClientSpreadsheetTransform>',
59
59
  :'self_uri' => :'String',
60
60
  :'first_uri' => :'String',
61
61
  :'previous_uri' => :'String',
@@ -64,7 +64,7 @@ module PureCloud
64
64
  :'version' => :'Integer',
65
65
  :'level' => :'String',
66
66
  :'tags' => :'Array<String>',
67
- :'data' => :'Hash<String, Line_properties>',
67
+ :'data' => :'Hash<String, inline_response_200>',
68
68
  :'self_uri' => :'String'
69
69
 
70
70
  }
@@ -55,7 +55,7 @@ module PureCloud
55
55
  :'page_size' => :'Integer',
56
56
  :'page_number' => :'Integer',
57
57
  :'total' => :'Integer',
58
- :'entities' => :'Array<TextTableTransform>',
58
+ :'entities' => :'Array<ClientTextTableTransform>',
59
59
  :'self_uri' => :'String',
60
60
  :'first_uri' => :'String',
61
61
  :'previous_uri' => :'String',
@@ -0,0 +1,158 @@
1
+ require 'date'
2
+
3
+ module PureCloud
4
+ class Ticker
5
+ # The ticker symbol for this organization. Example: ININ, AAPL, MSFT, etc.
6
+ attr_accessor :symbol
7
+
8
+ # The exchange for this ticker symbol. Examples: NYSE, FTSE, NASDAQ, etc.
9
+ attr_accessor :exchange
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+
15
+ :'symbol' => :'symbol',
16
+
17
+ :'exchange' => :'exchange'
18
+
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.swagger_types
24
+ {
25
+ :'symbol' => :'String',
26
+ :'exchange' => :'String'
27
+
28
+ }
29
+ end
30
+
31
+ def initialize(attributes = {})
32
+ return unless attributes.is_a?(Hash)
33
+
34
+ # convert string to symbol for hash key
35
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
36
+
37
+
38
+ if attributes[:'symbol']
39
+ self.symbol = attributes[:'symbol']
40
+ end
41
+
42
+ if attributes[:'exchange']
43
+ self.exchange = attributes[:'exchange']
44
+ end
45
+
46
+ end
47
+
48
+ # Check equality by comparing each attribute.
49
+ def ==(o)
50
+ return true if self.equal?(o)
51
+ self.class == o.class &&
52
+ symbol == o.symbol &&
53
+ exchange == o.exchange
54
+ end
55
+
56
+ # @see the `==` method
57
+ def eql?(o)
58
+ self == o
59
+ end
60
+
61
+ # Calculate hash code according to all attributes.
62
+ def hash
63
+ [symbol, exchange].hash
64
+ end
65
+
66
+ # build the object from hash
67
+ def build_from_hash(attributes)
68
+ return nil unless attributes.is_a?(Hash)
69
+ self.class.swagger_types.each_pair do |key, type|
70
+ if type =~ /^Array<(.*)>/i
71
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
72
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
73
+ else
74
+ #TODO show warning in debug mode
75
+ end
76
+ elsif !attributes[self.class.attribute_map[key]].nil?
77
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
78
+ else
79
+ # data not found in attributes(hash), not an issue as the data can be optional
80
+ end
81
+ end
82
+
83
+ self
84
+ end
85
+
86
+ def _deserialize(type, value)
87
+ case type.to_sym
88
+ when :DateTime
89
+ DateTime.parse(value)
90
+ when :Date
91
+ Date.parse(value)
92
+ when :String
93
+ value.to_s
94
+ when :Integer
95
+ value.to_i
96
+ when :Float
97
+ value.to_f
98
+ when :BOOLEAN
99
+ if value =~ /^(true|t|yes|y|1)$/i
100
+ true
101
+ else
102
+ false
103
+ end
104
+ when /\AArray<(?<inner_type>.+)>\z/
105
+ inner_type = Regexp.last_match[:inner_type]
106
+ value.map { |v| _deserialize(inner_type, v) }
107
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
108
+ k_type = Regexp.last_match[:k_type]
109
+ v_type = Regexp.last_match[:v_type]
110
+ {}.tap do |hash|
111
+ value.each do |k, v|
112
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
113
+ end
114
+ end
115
+ else # model
116
+ _model = Object.const_get("PureCloud").const_get(type).new
117
+ _model.build_from_hash(value)
118
+ end
119
+ end
120
+
121
+ def to_s
122
+ to_hash.to_s
123
+ end
124
+
125
+ # to_body is an alias to to_body (backward compatibility))
126
+ def to_body
127
+ to_hash
128
+ end
129
+
130
+ # return the object in the form of hash
131
+ def to_hash
132
+ hash = {}
133
+ self.class.attribute_map.each_pair do |attr, param|
134
+ value = self.send(attr)
135
+ next if value.nil?
136
+ hash[param] = _to_hash(value)
137
+ end
138
+ hash
139
+ end
140
+
141
+ # Method to output non-array value in the form of hash
142
+ # For object, use to_hash. Otherwise, just return the value
143
+ def _to_hash(value)
144
+ if value.is_a?(Array)
145
+ value.compact.map{ |v| _to_hash(v) }
146
+ elsif value.is_a?(Hash)
147
+ {}.tap do |hash|
148
+ value.each { |k, v| hash[k] = _to_hash(v) }
149
+ end
150
+ elsif value.respond_to? :to_hash
151
+ value.to_hash
152
+ else
153
+ value
154
+ end
155
+ end
156
+
157
+ end
158
+ end
@@ -8,6 +8,7 @@ module PureCloud
8
8
  # stop time in xx:xx:xx.xxx format
9
9
  attr_accessor :stop_time
10
10
 
11
+ # Day for this time slot, Monday = 1 ... Sunday = 7
11
12
  attr_accessor :day
12
13
 
13
14
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -95,7 +95,7 @@ module PureCloud
95
95
  :'modified_by_app' => :'String',
96
96
  :'created_by_app' => :'String',
97
97
  :'trunk_metabase' => :'UriReference',
98
- :'properties' => :'Hash<String, Line_properties>',
98
+ :'properties' => :'Hash<String, inline_response_200>',
99
99
  :'trunk_type' => :'String',
100
100
  :'managed' => :'BOOLEAN',
101
101
  :'self_uri' => :'String'
@@ -0,0 +1,166 @@
1
+ require 'date'
2
+
3
+ module PureCloud
4
+ class VendorConnectionRequest
5
+ attr_accessor :publisher
6
+
7
+ attr_accessor :type
8
+
9
+ attr_accessor :name
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+
15
+ :'publisher' => :'publisher',
16
+
17
+ :'type' => :'type',
18
+
19
+ :'name' => :'name'
20
+
21
+ }
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.swagger_types
26
+ {
27
+ :'publisher' => :'String',
28
+ :'type' => :'String',
29
+ :'name' => :'String'
30
+
31
+ }
32
+ end
33
+
34
+ def initialize(attributes = {})
35
+ return unless attributes.is_a?(Hash)
36
+
37
+ # convert string to symbol for hash key
38
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
39
+
40
+
41
+ if attributes[:'publisher']
42
+ self.publisher = attributes[:'publisher']
43
+ end
44
+
45
+ if attributes[:'type']
46
+ self.type = attributes[:'type']
47
+ end
48
+
49
+ if attributes[:'name']
50
+ self.name = attributes[:'name']
51
+ end
52
+
53
+ end
54
+
55
+ # Check equality by comparing each attribute.
56
+ def ==(o)
57
+ return true if self.equal?(o)
58
+ self.class == o.class &&
59
+ publisher == o.publisher &&
60
+ type == o.type &&
61
+ name == o.name
62
+ end
63
+
64
+ # @see the `==` method
65
+ def eql?(o)
66
+ self == o
67
+ end
68
+
69
+ # Calculate hash code according to all attributes.
70
+ def hash
71
+ [publisher, type, name].hash
72
+ end
73
+
74
+ # build the object from hash
75
+ def build_from_hash(attributes)
76
+ return nil unless attributes.is_a?(Hash)
77
+ self.class.swagger_types.each_pair do |key, type|
78
+ if type =~ /^Array<(.*)>/i
79
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
80
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
81
+ else
82
+ #TODO show warning in debug mode
83
+ end
84
+ elsif !attributes[self.class.attribute_map[key]].nil?
85
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
86
+ else
87
+ # data not found in attributes(hash), not an issue as the data can be optional
88
+ end
89
+ end
90
+
91
+ self
92
+ end
93
+
94
+ def _deserialize(type, value)
95
+ case type.to_sym
96
+ when :DateTime
97
+ DateTime.parse(value)
98
+ when :Date
99
+ Date.parse(value)
100
+ when :String
101
+ value.to_s
102
+ when :Integer
103
+ value.to_i
104
+ when :Float
105
+ value.to_f
106
+ when :BOOLEAN
107
+ if value =~ /^(true|t|yes|y|1)$/i
108
+ true
109
+ else
110
+ false
111
+ end
112
+ when /\AArray<(?<inner_type>.+)>\z/
113
+ inner_type = Regexp.last_match[:inner_type]
114
+ value.map { |v| _deserialize(inner_type, v) }
115
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
116
+ k_type = Regexp.last_match[:k_type]
117
+ v_type = Regexp.last_match[:v_type]
118
+ {}.tap do |hash|
119
+ value.each do |k, v|
120
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
121
+ end
122
+ end
123
+ else # model
124
+ _model = Object.const_get("PureCloud").const_get(type).new
125
+ _model.build_from_hash(value)
126
+ end
127
+ end
128
+
129
+ def to_s
130
+ to_hash.to_s
131
+ end
132
+
133
+ # to_body is an alias to to_body (backward compatibility))
134
+ def to_body
135
+ to_hash
136
+ end
137
+
138
+ # return the object in the form of hash
139
+ def to_hash
140
+ hash = {}
141
+ self.class.attribute_map.each_pair do |attr, param|
142
+ value = self.send(attr)
143
+ next if value.nil?
144
+ hash[param] = _to_hash(value)
145
+ end
146
+ hash
147
+ end
148
+
149
+ # Method to output non-array value in the form of hash
150
+ # For object, use to_hash. Otherwise, just return the value
151
+ def _to_hash(value)
152
+ if value.is_a?(Array)
153
+ value.compact.map{ |v| _to_hash(v) }
154
+ elsif value.is_a?(Hash)
155
+ {}.tap do |hash|
156
+ value.each { |k, v| hash[k] = _to_hash(v) }
157
+ end
158
+ elsif value.respond_to? :to_hash
159
+ value.to_hash
160
+ else
161
+ value
162
+ end
163
+ end
164
+
165
+ end
166
+ end