purecloud 0.61.1 → 0.62.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/bin/notificationMappings.json +4 -0
- data/config-ruby.json +1 -1
- data/doc_out/BillingTaskResultNotification.html.md +21 -0
- data/doc_out/CampaignRule.html.md +23 -0
- data/doc_out/CampaignRuleAction.html.md +16 -0
- data/doc_out/CampaignRuleActionEntities.html.md +15 -0
- data/doc_out/CampaignRuleCondition.html.md +15 -0
- data/doc_out/CampaignRuleEntities.html.md +14 -0
- data/doc_out/CampaignRuleEntityListing.html.md +22 -0
- data/doc_out/OutboundApi.html.md +299 -0
- data/doc_out/QualityAudit.html.md +1 -1
- data/doc_out/VoicemailGroupPolicy.html.md +2 -0
- data/doc_out/index.html.md +3 -3
- data/lib/purecloud.rb +7 -0
- data/lib/purecloud/api/outbound_api.rb +326 -0
- data/lib/purecloud/api_client.rb +1 -1
- data/lib/purecloud/models/billing_task_result_notification.rb +263 -0
- data/lib/purecloud/models/campaign_rule.rb +281 -0
- data/lib/purecloud/models/campaign_rule_action.rb +206 -0
- data/lib/purecloud/models/campaign_rule_action_entities.rb +191 -0
- data/lib/purecloud/models/campaign_rule_condition.rb +196 -0
- data/lib/purecloud/models/campaign_rule_entities.rb +179 -0
- data/lib/purecloud/models/campaign_rule_entity_listing.rb +257 -0
- data/lib/purecloud/models/quality_audit.rb +11 -11
- data/lib/purecloud/models/voicemail_group_policy.rb +26 -4
- data/lib/purecloud/version.rb +1 -1
- data/newVersion.md +1 -1
- data/swagger.json +1 -1
- data/version.json +1 -1
- metadata +16 -2
@@ -0,0 +1,191 @@
|
|
1
|
+
=begin
|
2
|
+
PureCloud Platform API
|
3
|
+
|
4
|
+
With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more.
|
5
|
+
|
6
|
+
OpenAPI spec version: v2
|
7
|
+
Contact: DeveloperEvangelists@inin.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
License: ININ
|
11
|
+
http://www.inin.com
|
12
|
+
|
13
|
+
Terms of Service: https://developer.mypurecloud.com/tos
|
14
|
+
|
15
|
+
=end
|
16
|
+
|
17
|
+
require 'date'
|
18
|
+
|
19
|
+
module PureCloud
|
20
|
+
class CampaignRuleActionEntities
|
21
|
+
attr_accessor :campaigns
|
22
|
+
|
23
|
+
attr_accessor :sequences
|
24
|
+
|
25
|
+
attr_accessor :use_triggering_entity
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
|
31
|
+
:'campaigns' => :'campaigns',
|
32
|
+
|
33
|
+
:'sequences' => :'sequences',
|
34
|
+
|
35
|
+
:'use_triggering_entity' => :'useTriggeringEntity'
|
36
|
+
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.swagger_types
|
42
|
+
{
|
43
|
+
:'campaigns' => :'Array<UriReference>',
|
44
|
+
:'sequences' => :'Array<UriReference>',
|
45
|
+
:'use_triggering_entity' => :'BOOLEAN'
|
46
|
+
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def initialize(attributes = {})
|
51
|
+
return unless attributes.is_a?(Hash)
|
52
|
+
|
53
|
+
# convert string to symbol for hash key
|
54
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
55
|
+
|
56
|
+
|
57
|
+
if attributes[:'campaigns']
|
58
|
+
if (value = attributes[:'campaigns']).is_a?(Array)
|
59
|
+
self.campaigns = value
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes[:'sequences']
|
64
|
+
if (value = attributes[:'sequences']).is_a?(Array)
|
65
|
+
self.sequences = value
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes[:'useTriggeringEntity']
|
70
|
+
self.use_triggering_entity = attributes[:'useTriggeringEntity']
|
71
|
+
else
|
72
|
+
self.use_triggering_entity = false
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check equality by comparing each attribute.
|
78
|
+
def ==(o)
|
79
|
+
return true if self.equal?(o)
|
80
|
+
self.class == o.class &&
|
81
|
+
campaigns == o.campaigns &&
|
82
|
+
sequences == o.sequences &&
|
83
|
+
use_triggering_entity == o.use_triggering_entity
|
84
|
+
end
|
85
|
+
|
86
|
+
# @see the `==` method
|
87
|
+
def eql?(o)
|
88
|
+
self == o
|
89
|
+
end
|
90
|
+
|
91
|
+
# Calculate hash code according to all attributes.
|
92
|
+
def hash
|
93
|
+
[campaigns, sequences, use_triggering_entity].hash
|
94
|
+
end
|
95
|
+
|
96
|
+
# build the object from hash
|
97
|
+
def build_from_hash(attributes)
|
98
|
+
return nil unless attributes.is_a?(Hash)
|
99
|
+
self.class.swagger_types.each_pair do |key, type|
|
100
|
+
if type =~ /^Array<(.*)>/i
|
101
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
102
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
103
|
+
else
|
104
|
+
#TODO show warning in debug mode
|
105
|
+
end
|
106
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
107
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
108
|
+
else
|
109
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
self
|
114
|
+
end
|
115
|
+
|
116
|
+
def _deserialize(type, value)
|
117
|
+
case type.to_sym
|
118
|
+
when :DateTime
|
119
|
+
DateTime.parse(value)
|
120
|
+
when :Date
|
121
|
+
Date.parse(value)
|
122
|
+
when :String
|
123
|
+
value.to_s
|
124
|
+
when :Integer
|
125
|
+
value.to_i
|
126
|
+
when :Float
|
127
|
+
value.to_f
|
128
|
+
when :BOOLEAN
|
129
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
130
|
+
true
|
131
|
+
else
|
132
|
+
false
|
133
|
+
end
|
134
|
+
when :Object
|
135
|
+
# generic object (usually a Hash), return directly
|
136
|
+
value
|
137
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
138
|
+
inner_type = Regexp.last_match[:inner_type]
|
139
|
+
value.map { |v| _deserialize(inner_type, v) }
|
140
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
141
|
+
k_type = Regexp.last_match[:k_type]
|
142
|
+
v_type = Regexp.last_match[:v_type]
|
143
|
+
{}.tap do |hash|
|
144
|
+
value.each do |k, v|
|
145
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
else # model
|
149
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
150
|
+
_model.build_from_hash(value)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def to_s
|
155
|
+
to_hash.to_s
|
156
|
+
end
|
157
|
+
|
158
|
+
# to_body is an alias to to_body (backward compatibility))
|
159
|
+
def to_body
|
160
|
+
to_hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# return the object in the form of hash
|
164
|
+
def to_hash
|
165
|
+
hash = {}
|
166
|
+
self.class.attribute_map.each_pair do |attr, param|
|
167
|
+
value = self.send(attr)
|
168
|
+
next if value.nil?
|
169
|
+
hash[param] = _to_hash(value)
|
170
|
+
end
|
171
|
+
hash
|
172
|
+
end
|
173
|
+
|
174
|
+
# Method to output non-array value in the form of hash
|
175
|
+
# For object, use to_hash. Otherwise, just return the value
|
176
|
+
def _to_hash(value)
|
177
|
+
if value.is_a?(Array)
|
178
|
+
value.compact.map{ |v| _to_hash(v) }
|
179
|
+
elsif value.is_a?(Hash)
|
180
|
+
{}.tap do |hash|
|
181
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
182
|
+
end
|
183
|
+
elsif value.respond_to? :to_hash
|
184
|
+
value.to_hash
|
185
|
+
else
|
186
|
+
value
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
=begin
|
2
|
+
PureCloud Platform API
|
3
|
+
|
4
|
+
With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more.
|
5
|
+
|
6
|
+
OpenAPI spec version: v2
|
7
|
+
Contact: DeveloperEvangelists@inin.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
License: ININ
|
11
|
+
http://www.inin.com
|
12
|
+
|
13
|
+
Terms of Service: https://developer.mypurecloud.com/tos
|
14
|
+
|
15
|
+
=end
|
16
|
+
|
17
|
+
require 'date'
|
18
|
+
|
19
|
+
module PureCloud
|
20
|
+
class CampaignRuleCondition
|
21
|
+
attr_accessor :id
|
22
|
+
|
23
|
+
attr_accessor :parameters
|
24
|
+
|
25
|
+
attr_accessor :condition_type
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
|
31
|
+
:'id' => :'id',
|
32
|
+
|
33
|
+
:'parameters' => :'parameters',
|
34
|
+
|
35
|
+
:'condition_type' => :'conditionType'
|
36
|
+
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.swagger_types
|
42
|
+
{
|
43
|
+
:'id' => :'String',
|
44
|
+
:'parameters' => :'Hash<String, String>',
|
45
|
+
:'condition_type' => :'String'
|
46
|
+
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def initialize(attributes = {})
|
51
|
+
return unless attributes.is_a?(Hash)
|
52
|
+
|
53
|
+
# convert string to symbol for hash key
|
54
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
55
|
+
|
56
|
+
|
57
|
+
if attributes[:'id']
|
58
|
+
self.id = attributes[:'id']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes[:'parameters']
|
62
|
+
if (value = attributes[:'parameters']).is_a?(Array)
|
63
|
+
self.parameters = value
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes[:'conditionType']
|
68
|
+
self.condition_type = attributes[:'conditionType']
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
# Custom attribute writer method checking allowed values (enum).
|
74
|
+
def condition_type=(condition_type)
|
75
|
+
allowed_values = ["campaignProgress", "campaignAgents"]
|
76
|
+
if condition_type && !allowed_values.include?(condition_type)
|
77
|
+
fail "invalid value for 'condition_type', must be one of #{allowed_values}"
|
78
|
+
end
|
79
|
+
@condition_type = condition_type
|
80
|
+
end
|
81
|
+
|
82
|
+
# Check equality by comparing each attribute.
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
id == o.id &&
|
87
|
+
parameters == o.parameters &&
|
88
|
+
condition_type == o.condition_type
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
def eql?(o)
|
93
|
+
self == o
|
94
|
+
end
|
95
|
+
|
96
|
+
# Calculate hash code according to all attributes.
|
97
|
+
def hash
|
98
|
+
[id, parameters, condition_type].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# build the object from hash
|
102
|
+
def build_from_hash(attributes)
|
103
|
+
return nil unless attributes.is_a?(Hash)
|
104
|
+
self.class.swagger_types.each_pair do |key, type|
|
105
|
+
if type =~ /^Array<(.*)>/i
|
106
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
107
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
108
|
+
else
|
109
|
+
#TODO show warning in debug mode
|
110
|
+
end
|
111
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
112
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
113
|
+
else
|
114
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
self
|
119
|
+
end
|
120
|
+
|
121
|
+
def _deserialize(type, value)
|
122
|
+
case type.to_sym
|
123
|
+
when :DateTime
|
124
|
+
DateTime.parse(value)
|
125
|
+
when :Date
|
126
|
+
Date.parse(value)
|
127
|
+
when :String
|
128
|
+
value.to_s
|
129
|
+
when :Integer
|
130
|
+
value.to_i
|
131
|
+
when :Float
|
132
|
+
value.to_f
|
133
|
+
when :BOOLEAN
|
134
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
135
|
+
true
|
136
|
+
else
|
137
|
+
false
|
138
|
+
end
|
139
|
+
when :Object
|
140
|
+
# generic object (usually a Hash), return directly
|
141
|
+
value
|
142
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
143
|
+
inner_type = Regexp.last_match[:inner_type]
|
144
|
+
value.map { |v| _deserialize(inner_type, v) }
|
145
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
146
|
+
k_type = Regexp.last_match[:k_type]
|
147
|
+
v_type = Regexp.last_match[:v_type]
|
148
|
+
{}.tap do |hash|
|
149
|
+
value.each do |k, v|
|
150
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
else # model
|
154
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
155
|
+
_model.build_from_hash(value)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def to_s
|
160
|
+
to_hash.to_s
|
161
|
+
end
|
162
|
+
|
163
|
+
# to_body is an alias to to_body (backward compatibility))
|
164
|
+
def to_body
|
165
|
+
to_hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# return the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Method to output non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
def _to_hash(value)
|
182
|
+
if value.is_a?(Array)
|
183
|
+
value.compact.map{ |v| _to_hash(v) }
|
184
|
+
elsif value.is_a?(Hash)
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
187
|
+
end
|
188
|
+
elsif value.respond_to? :to_hash
|
189
|
+
value.to_hash
|
190
|
+
else
|
191
|
+
value
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
=begin
|
2
|
+
PureCloud Platform API
|
3
|
+
|
4
|
+
With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more.
|
5
|
+
|
6
|
+
OpenAPI spec version: v2
|
7
|
+
Contact: DeveloperEvangelists@inin.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
License: ININ
|
11
|
+
http://www.inin.com
|
12
|
+
|
13
|
+
Terms of Service: https://developer.mypurecloud.com/tos
|
14
|
+
|
15
|
+
=end
|
16
|
+
|
17
|
+
require 'date'
|
18
|
+
|
19
|
+
module PureCloud
|
20
|
+
class CampaignRuleEntities
|
21
|
+
attr_accessor :campaigns
|
22
|
+
|
23
|
+
attr_accessor :sequences
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
|
29
|
+
:'campaigns' => :'campaigns',
|
30
|
+
|
31
|
+
:'sequences' => :'sequences'
|
32
|
+
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.swagger_types
|
38
|
+
{
|
39
|
+
:'campaigns' => :'Array<UriReference>',
|
40
|
+
:'sequences' => :'Array<UriReference>'
|
41
|
+
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
50
|
+
|
51
|
+
|
52
|
+
if attributes[:'campaigns']
|
53
|
+
if (value = attributes[:'campaigns']).is_a?(Array)
|
54
|
+
self.campaigns = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes[:'sequences']
|
59
|
+
if (value = attributes[:'sequences']).is_a?(Array)
|
60
|
+
self.sequences = value
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
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
|
+
campaigns == o.campaigns &&
|
71
|
+
sequences == o.sequences
|
72
|
+
end
|
73
|
+
|
74
|
+
# @see the `==` method
|
75
|
+
def eql?(o)
|
76
|
+
self == o
|
77
|
+
end
|
78
|
+
|
79
|
+
# Calculate hash code according to all attributes.
|
80
|
+
def hash
|
81
|
+
[campaigns, sequences].hash
|
82
|
+
end
|
83
|
+
|
84
|
+
# build the object from hash
|
85
|
+
def build_from_hash(attributes)
|
86
|
+
return nil unless attributes.is_a?(Hash)
|
87
|
+
self.class.swagger_types.each_pair do |key, type|
|
88
|
+
if type =~ /^Array<(.*)>/i
|
89
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
90
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
91
|
+
else
|
92
|
+
#TODO show warning in debug mode
|
93
|
+
end
|
94
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
95
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
96
|
+
else
|
97
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
self
|
102
|
+
end
|
103
|
+
|
104
|
+
def _deserialize(type, value)
|
105
|
+
case type.to_sym
|
106
|
+
when :DateTime
|
107
|
+
DateTime.parse(value)
|
108
|
+
when :Date
|
109
|
+
Date.parse(value)
|
110
|
+
when :String
|
111
|
+
value.to_s
|
112
|
+
when :Integer
|
113
|
+
value.to_i
|
114
|
+
when :Float
|
115
|
+
value.to_f
|
116
|
+
when :BOOLEAN
|
117
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
118
|
+
true
|
119
|
+
else
|
120
|
+
false
|
121
|
+
end
|
122
|
+
when :Object
|
123
|
+
# generic object (usually a Hash), return directly
|
124
|
+
value
|
125
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
126
|
+
inner_type = Regexp.last_match[:inner_type]
|
127
|
+
value.map { |v| _deserialize(inner_type, v) }
|
128
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
129
|
+
k_type = Regexp.last_match[:k_type]
|
130
|
+
v_type = Regexp.last_match[:v_type]
|
131
|
+
{}.tap do |hash|
|
132
|
+
value.each do |k, v|
|
133
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
else # model
|
137
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
138
|
+
_model.build_from_hash(value)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def to_s
|
143
|
+
to_hash.to_s
|
144
|
+
end
|
145
|
+
|
146
|
+
# to_body is an alias to to_body (backward compatibility))
|
147
|
+
def to_body
|
148
|
+
to_hash
|
149
|
+
end
|
150
|
+
|
151
|
+
# return the object in the form of hash
|
152
|
+
def to_hash
|
153
|
+
hash = {}
|
154
|
+
self.class.attribute_map.each_pair do |attr, param|
|
155
|
+
value = self.send(attr)
|
156
|
+
next if value.nil?
|
157
|
+
hash[param] = _to_hash(value)
|
158
|
+
end
|
159
|
+
hash
|
160
|
+
end
|
161
|
+
|
162
|
+
# Method to output non-array value in the form of hash
|
163
|
+
# For object, use to_hash. Otherwise, just return the value
|
164
|
+
def _to_hash(value)
|
165
|
+
if value.is_a?(Array)
|
166
|
+
value.compact.map{ |v| _to_hash(v) }
|
167
|
+
elsif value.is_a?(Hash)
|
168
|
+
{}.tap do |hash|
|
169
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
170
|
+
end
|
171
|
+
elsif value.respond_to? :to_hash
|
172
|
+
value.to_hash
|
173
|
+
else
|
174
|
+
value
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
end
|
179
|
+
end
|