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